Skip to content

Commit

Permalink
Update dependencies (#24)
Browse files Browse the repository at this point in the history
Using latest tagged version of all dependencies.
  • Loading branch information
graebm authored May 31, 2019
1 parent 792a4b8 commit 8fa6c2a
Show file tree
Hide file tree
Showing 18 changed files with 111 additions and 57 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ set(AWS_CRT_CPP_VERSION "v0.3.0")
configure_file(include/aws/crt/Config.h.in ${CMAKE_CURRENT_LIST_DIR}/include/aws/crt/Config.h @ONLY)

if (BUILD_DEPS)
set(AWS_DEPS_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/deps)
set(AWS_DEPS_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/deps CACHE STRING "If BUILD_DEPS is on, aws common runtime dependencies build in this directory.")
if (DEFINED CMAKE_INSTALL_PREFIX)
set(AWS_DEPS_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
else()
Expand Down Expand Up @@ -136,7 +136,7 @@ file(GLOB AWS_CRT_CPP_HEADERS
${AWS_CRT_EXTERNAL_HEADERS}
)

file(GLOB AWS_CRT_SRC
file(GLOB AWS_CRT_SRC
"source/*.cpp"
)

Expand Down Expand Up @@ -208,7 +208,7 @@ aws_prepare_symbol_visibility_args(${CMAKE_PROJECT_NAME} "AWS_CRT_CPP")

#set warnings
if (MSVC)
target_compile_options(${CMAKE_PROJECT_NAME} PRIVATE /W4 /WX)
target_compile_options(${CMAKE_PROJECT_NAME} PRIVATE /W4 /WX /wd4068)
else ()
target_compile_options(${CMAKE_PROJECT_NAME} PRIVATE -Wall -Wno-long-long -pedantic -Werror)
endif ()
Expand Down
17 changes: 11 additions & 6 deletions aws-common-runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ set(AWS_DEPS_DOWNLOAD_DIR "${AWS_DEPS_BUILD_DIR}/downloads" CACHE PATH "Dependen

message("install dir ${AWS_DEPS_INSTALL_DIR}")
set(AWS_C_COMMON_URL "https://github.com/awslabs/aws-c-common.git")
set(AWS_C_COMMON_SHA "v0.3.6")
set(AWS_C_COMMON_SHA "v0.3.11")
include(BuildAwsCCommon)

if (UNIX AND NOT APPLE)
Expand All @@ -27,23 +27,28 @@ if (UNIX AND NOT APPLE)
endif()

set(AWS_C_IO_URL "https://github.com/awslabs/aws-c-io.git")
set(AWS_C_IO_SHA "v0.3.0")
set(AWS_C_IO_SHA "v0.3.9")
include(BuildAwsCIO)

set(AWS_C_COMPRESSION_URL "https://github.com/awslabs/aws-c-compression.git")
set(AWS_C_COMPRESSION_SHA "v0.2.1")
include(BuildAwsCCompression)

set(AWS_C_HTTP_URL "https://github.com/awslabs/aws-c-http.git")
set(AWS_C_HTTP_SHA "v0.2.2")
set(AWS_C_HTTP_SHA "v0.2.16")
include(BuildAwsCHttp)

set(AWS_C_MQTT_URL "https://github.com/awslabs/aws-c-mqtt.git")
set(AWS_C_MQTT_SHA "v0.3.5")
set(AWS_C_MQTT_SHA "v0.3.7")
include(BuildAwsCMqtt)

set(AWS_C_CAL_URL "https://github.com/awslabs/aws-c-cal.git")
set(AWS_C_CAL_SHA "v0.1.4")
set(AWS_C_CAL_SHA "v0.1.5")
include(BuildAwsCCal)

add_dependencies(AwsCCompression AwsCCommon)
add_dependencies(AwsCMqtt AwsCIO)
add_dependencies(AwsCHttp AwsCIO)
add_dependencies(AwsCHttp AwsCIO AwsCCompression)
add_dependencies(AwsCCal AwsCCommon)

if (UNIX AND NOT APPLE)
Expand Down
50 changes: 50 additions & 0 deletions aws-common-runtime/cmake/BuildAwsCCompression.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
if("${TARGET_ARCH}" STREQUAL ANDROID)
ExternalProject_Add(AwsCCompression
PREFIX ${AWS_DEPS_BUILD_DIR}
GIT_REPOSITORY ${AWS_C_COMPRESSION_URL}
GIT_TAG ${AWS_C_COMPRESSION_SHA}
BUILD_IN_SOURCE 0
UPDATE_COMMAND ""
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${AWS_DEPS_INSTALL_DIR}
-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
-DANDROID_NATIVE_API_LEVEL=${ANDROID_NATIVE_API_LEVEL}
-DANDROID_ABI=${ANDROID_ABI}
-DANDROID_TOOLCHAIN_NAME=${ANDROID_TOOLCHAIN_NAME}
-DANDROID_STANDALONE_TOOLCHAIN=${ANDROID_STANDALONE_TOOLCHAIN}
-DANDROID_STL=${ANDROID_STL}
-DENABLE_HW_OPTIMIZATION=OFF
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
)
elseif(MSVC)
ExternalProject_Add(AwsCCompression
PREFIX ${AWS_DEPS_BUILD_DIR}
GIT_REPOSITORY ${AWS_C_COMPRESSION_URL}
GIT_TAG ${AWS_C_COMPRESSION_SHA}
BUILD_IN_SOURCE 0
UPDATE_COMMAND ""
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${AWS_DEPS_INSTALL_DIR}
-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
)
else()
ExternalProject_Add(AwsCCompression
PREFIX ${AWS_DEPS_BUILD_DIR}
GIT_REPOSITORY ${AWS_C_COMPRESSION_URL}
GIT_TAG ${AWS_C_COMPRESSION_SHA}
BUILD_IN_SOURCE 0
UPDATE_COMMAND ""
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${AWS_DEPS_INSTALL_DIR}
-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
)
endif()
3 changes: 0 additions & 3 deletions aws-common-runtime/cmake/BuildAwsCHttp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ if("${TARGET_ARCH}" STREQUAL ANDROID)
BUILD_IN_SOURCE 0
UPDATE_COMMAND ""
CMAKE_ARGS
-DCMAKE_PREFIX_PATH=${AWS_DEPS_INSTALL_DIR}
-DCMAKE_INSTALL_PREFIX=${AWS_DEPS_INSTALL_DIR}
-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
Expand All @@ -28,7 +27,6 @@ elseif(MSVC)
BUILD_IN_SOURCE 0
UPDATE_COMMAND ""
CMAKE_ARGS
-DCMAKE_PREFIX_PATH=${AWS_DEPS_INSTALL_DIR}
-DCMAKE_INSTALL_PREFIX=${AWS_DEPS_INSTALL_DIR}
-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
Expand All @@ -45,7 +43,6 @@ else()
BUILD_IN_SOURCE 0
UPDATE_COMMAND ""
CMAKE_ARGS
-DCMAKE_PREFIX_PATH=${AWS_DEPS_INSTALL_DIR}
-DCMAKE_INSTALL_PREFIX=${AWS_DEPS_INSTALL_DIR}
-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
Expand Down
4 changes: 3 additions & 1 deletion codebuild/common-windows.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@

mkdir build
cd build
cmake %* -DBUILD_DEPS=ON -DCMAKE_BUILD_TYPE="Release" ../ || goto error

REM Building deps to %TEMP% to avoid max path length errors during build
cmake %* -DBUILD_DEPS=ON -DAWS_DEPS_BUILD_DIR="%TEMP%" -DCMAKE_BUILD_TYPE="Release" ../ || goto error
msbuild.exe aws-crt-cpp.vcxproj /p:Configuration=Release || goto error
msbuild.exe tests/aws-crt-cpp-tests.vcxproj /p:Configuration=Release
ctest -V || goto error
Expand Down
5 changes: 2 additions & 3 deletions include/aws/crt/StlAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* permissions and limitations under the License.
*/

#include <assert.h>
#include <memory>

#include <aws/common/common.h>
Expand Down Expand Up @@ -48,13 +47,13 @@ namespace Aws
typename Base::pointer allocate(size_type n, const void *hint = nullptr)
{
(void)hint;
assert(g_allocator);
AWS_ASSERT(g_allocator);
return reinterpret_cast<typename Base::pointer>(aws_mem_acquire(g_allocator, n * sizeof(T)));
}

void deallocate(typename Base::pointer p, size_type)
{
assert(g_allocator);
AWS_ASSERT(g_allocator);
aws_mem_release(g_allocator, p);
}
};
Expand Down
3 changes: 2 additions & 1 deletion include/aws/crt/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ namespace Aws

AWS_CRT_CPP_API Allocator *DefaultAllocator() noexcept;
AWS_CRT_CPP_API ByteBuf ByteBufFromCString(const char *str) noexcept;
AWS_CRT_CPP_API ByteBuf ByteBufFromArray(const uint8_t *array, size_t len) noexcept;
AWS_CRT_CPP_API ByteBuf ByteBufFromEmptyArray(const uint8_t *array, size_t len) noexcept;
AWS_CRT_CPP_API ByteBuf ByteBufFromArray(const uint8_t *array, size_t capacity) noexcept;
AWS_CRT_CPP_API ByteBuf ByteBufNewCopy(Allocator *alloc, const uint8_t *array, size_t len);
AWS_CRT_CPP_API void ByteBufDelete(ByteBuf &);

Expand Down
2 changes: 1 addition & 1 deletion samples/mqtt_pub_sub/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ set(CMAKE_C_FLAGS_DEBUGOPT "")

#set warnings
if (MSVC)
target_compile_options(${PUB_SUB_PROJECT_NAME} PRIVATE /W4 /WX)
target_compile_options(${PUB_SUB_PROJECT_NAME} PRIVATE /W4 /WX /wd4068)
else ()
target_compile_options(${PUB_SUB_PROJECT_NAME} PRIVATE -Wall -Wno-long-long -pedantic -Werror)
endif ()
Expand Down
3 changes: 2 additions & 1 deletion source/Api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ namespace Aws
g_allocator = allocator;
Io::InitTlsStaticState(allocator);
aws_http_library_init(allocator);
aws_mqtt_library_init(allocator);

cJSON_Hooks hooks;
hooks.malloc_fn = s_cJSONAlloc;
Expand All @@ -45,6 +46,7 @@ namespace Aws
static void s_cleanUpApi()
{
g_allocator = nullptr;
aws_mqtt_library_clean_up();
aws_http_library_clean_up();
Io::CleanUpTlsStaticState();
}
Expand All @@ -59,7 +61,6 @@ namespace Aws
{
aws_load_error_strings();
aws_io_load_error_strings();
aws_mqtt_load_error_strings();
}

const char *ErrorDebugString(int error) noexcept { return aws_error_debug_str(error); }
Expand Down
34 changes: 17 additions & 17 deletions source/JsonObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ namespace Aws

String JsonView::GetString(const char *key) const
{
assert(m_value);
AWS_ASSERT(m_value);
auto item = cJSON_GetObjectItemCaseSensitive(m_value, key);
auto str = cJSON_GetStringValue(item);
return str != nullptr ? str : "";
Expand All @@ -379,31 +379,31 @@ namespace Aws

bool JsonView::GetBool(const char *key) const
{
assert(m_value);
AWS_ASSERT(m_value);
auto item = cJSON_GetObjectItemCaseSensitive(m_value, key);
assert(item);
AWS_ASSERT(item);
return item->valueint != 0;
}

bool JsonView::AsBool() const
{
assert(cJSON_IsBool(m_value));
AWS_ASSERT(cJSON_IsBool(m_value));
return cJSON_IsTrue(m_value) != 0;
}

int JsonView::GetInteger(const String &key) const { return GetInteger(key.c_str()); }

int JsonView::GetInteger(const char *key) const
{
assert(m_value);
AWS_ASSERT(m_value);
auto item = cJSON_GetObjectItemCaseSensitive(m_value, key);
assert(item);
AWS_ASSERT(item);
return item->valueint;
}

int JsonView::AsInteger() const
{
assert(cJSON_IsNumber(m_value)); // can be double or value larger than int_max, but at least not UB
AWS_ASSERT(cJSON_IsNumber(m_value)); // can be double or value larger than int_max, but at least not UB
return m_value->valueint;
}

Expand All @@ -413,31 +413,31 @@ namespace Aws

int64_t JsonView::AsInt64() const
{
assert(cJSON_IsNumber(m_value));
AWS_ASSERT(cJSON_IsNumber(m_value));
return static_cast<int64_t>(m_value->valuedouble);
}

double JsonView::GetDouble(const String &key) const { return GetDouble(key.c_str()); }

double JsonView::GetDouble(const char *key) const
{
assert(m_value);
AWS_ASSERT(m_value);
auto item = cJSON_GetObjectItemCaseSensitive(m_value, key);
assert(item);
AWS_ASSERT(item);
return item->valuedouble;
}

double JsonView::AsDouble() const
{
assert(cJSON_IsNumber(m_value));
AWS_ASSERT(cJSON_IsNumber(m_value));
return m_value->valuedouble;
}

JsonView JsonView::GetJsonObject(const String &key) const { return GetJsonObject(key.c_str()); }

JsonView JsonView::GetJsonObject(const char *key) const
{
assert(m_value);
AWS_ASSERT(m_value);
auto item = cJSON_GetObjectItemCaseSensitive(m_value, key);
return item;
}
Expand All @@ -446,24 +446,24 @@ namespace Aws

JsonObject JsonView::GetJsonObjectCopy(const char *key) const
{
assert(m_value);
AWS_ASSERT(m_value);
/* force a deep copy */
return JsonObject(cJSON_GetObjectItemCaseSensitive(m_value, key));
}

JsonView JsonView::AsObject() const
{
assert(cJSON_IsObject(m_value));
AWS_ASSERT(cJSON_IsObject(m_value));
return m_value;
}

Vector<JsonView> JsonView::GetArray(const String &key) const { return GetArray(key.c_str()); }

Vector<JsonView> JsonView::GetArray(const char *key) const
{
assert(m_value);
AWS_ASSERT(m_value);
auto array = cJSON_GetObjectItemCaseSensitive(m_value, key);
assert(cJSON_IsArray(array));
AWS_ASSERT(cJSON_IsArray(array));
Vector<JsonView> returnArray(static_cast<size_t>(cJSON_GetArraySize(array)));

auto element = array->child;
Expand All @@ -477,7 +477,7 @@ namespace Aws

Vector<JsonView> JsonView::AsArray() const
{
assert(cJSON_IsArray(m_value));
AWS_ASSERT(cJSON_IsArray(m_value));
Vector<JsonView> returnArray(static_cast<size_t>(cJSON_GetArraySize(m_value)));

auto element = m_value->child;
Expand Down
9 changes: 7 additions & 2 deletions source/Types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,14 @@ namespace Aws

ByteBuf ByteBufFromCString(const char *str) noexcept { return aws_byte_buf_from_c_str(str); }

ByteBuf ByteBufFromArray(const uint8_t *array, size_t len) noexcept
ByteBuf ByteBufFromEmptyArray(const uint8_t *array, size_t len) noexcept
{
return aws_byte_buf_from_array(array, len);
return aws_byte_buf_from_empty_array(array, len);
}

ByteBuf ByteBufFromArray(const uint8_t *array, size_t capacity) noexcept
{
return aws_byte_buf_from_array(array, capacity);
}

ByteBuf ByteBufNewCopy(Allocator *alloc, const uint8_t *array, size_t len)
Expand Down
3 changes: 1 addition & 2 deletions source/UUID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ namespace Aws
String uuidStr;
uuidStr.reserve(AWS_UUID_STR_LEN);

auto outBuf = ByteBufFromArray(reinterpret_cast<const uint8_t *>(uuidStr.data()), uuidStr.capacity());
outBuf.len = 0;
auto outBuf = ByteBufFromEmptyArray(reinterpret_cast<const uint8_t *>(uuidStr.data()), uuidStr.capacity());
aws_uuid_to_str(&m_uuid, &outBuf);
return uuidStr;
}
Expand Down
10 changes: 5 additions & 5 deletions source/http/HttpConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ namespace Aws

bool HttpClientConnection::CreateConnection(const HttpClientConnectionOptions &connectionOptions) noexcept
{
assert(connectionOptions.onConnectionSetup);
assert(connectionOptions.onConnectionShutdown);
assert(connectionOptions.socketOptions);
AWS_ASSERT(connectionOptions.onConnectionSetup);
AWS_ASSERT(connectionOptions.onConnectionShutdown);
AWS_ASSERT(connectionOptions.socketOptions);

auto *callbackData =
New<ConnectionCallbackData>(connectionOptions.allocator, connectionOptions.allocator);
Expand Down Expand Up @@ -162,8 +162,8 @@ namespace Aws
std::shared_ptr<HttpClientStream> HttpClientConnection::NewClientStream(
const HttpRequestOptions &requestOptions) noexcept
{
assert(requestOptions.onIncomingHeaders);
assert(requestOptions.onStreamComplete);
AWS_ASSERT(requestOptions.onIncomingHeaders);
AWS_ASSERT(requestOptions.onStreamComplete);

aws_http_request_options options;
AWS_ZERO_STRUCT(options);
Expand Down
Loading

0 comments on commit 8fa6c2a

Please sign in to comment.