From efd6f1b340a7f56f7558a0490a6c78fa2dd253ba Mon Sep 17 00:00:00 2001 From: Justin Boswell Date: Tue, 9 Jun 2020 14:17:51 -0700 Subject: [PATCH] Fixed windows compile warning, added windows+VS14 CI (#121) * Updated builder version, added windows+vc14 CI * Import of latest generated SDK * clang-format on identity sample * clang-format needs to check cpp files --- .github/workflows/ci.yml | 43 ++++++++++++++------ .github/workflows/lint.yml | 4 +- identity/source/IotIdentityClient.cpp | 6 +++ jobs/source/IotJobsClient.cpp | 10 +++++ samples/identity/fleet_provisioning/main.cpp | 1 - shadow/cmake/IotShadow-cpp-config.cmake | 8 ++-- shadow/source/IotShadowClient.cpp | 8 ++++ 7 files changed, 61 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f0f5ec186..1f3345a73 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ on: - '!master' env: - BUILDER_VERSION: v0.6.0 + BUILDER_VERSION: v0.6.5 BUILDER_SOURCE: releases BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net PACKAGE_NAME: aws-iot-device-sdk-cpp-v2 @@ -31,7 +31,7 @@ jobs: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u awslabs --password-stdin export DOCKER_IMAGE=docker.pkg.github.com/awslabs/aws-crt-builder/aws-crt-${{ matrix.image }}:${{ env.BUILDER_VERSION }} docker pull $DOCKER_IMAGE - docker run --env GITHUB_REF $DOCKER_IMAGE build -p ${{ env.PACKAGE_NAME }} + docker run --env GITHUB_REF $DOCKER_IMAGE build -p ${{ env.PACKAGE_NAME }} al2: runs-on: ubuntu-latest @@ -42,8 +42,8 @@ jobs: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u awslabs --password-stdin export DOCKER_IMAGE=docker.pkg.github.com/awslabs/aws-crt-builder/aws-crt-al2-x64:${{ env.BUILDER_VERSION }} docker pull $DOCKER_IMAGE - docker run --env GITHUB_REF $DOCKER_IMAGE build -p ${{ env.PACKAGE_NAME }} al2-default-default-default-default-downstream - + docker run --env GITHUB_REF $DOCKER_IMAGE build -p ${{ env.PACKAGE_NAME }} --spec=downstream + clang-compat: runs-on: ubuntu-latest strategy: @@ -56,13 +56,13 @@ jobs: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u awslabs --password-stdin export DOCKER_IMAGE=docker.pkg.github.com/awslabs/aws-crt-builder/aws-crt-${{ env.LINUX_BASE_IMAGE }}:${{ env.BUILDER_VERSION }} docker pull $DOCKER_IMAGE - docker run --env GITHUB_REF $DOCKER_IMAGE build -p ${{ env.PACKAGE_NAME }} linux-clang-${{ matrix.version }}-linux-x64 --config Debug + docker run --env GITHUB_REF $DOCKER_IMAGE build -p ${{ env.PACKAGE_NAME }} --compiler=clang-${{ matrix.version }} --config Debug gcc-compat: runs-on: ubuntu-latest strategy: matrix: - version: [4.8, 5, 6, 7, 8] + version: [4.8, 5, 6, 7, 8] steps: # We can't use the `uses: docker://image` version yet, GitHub lacks authentication for actions -> packages - name: Build ${{ env.PACKAGE_NAME }} @@ -70,15 +70,36 @@ jobs: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u awslabs --password-stdin export DOCKER_IMAGE=docker.pkg.github.com/awslabs/aws-crt-builder/aws-crt-${{ env.LINUX_BASE_IMAGE }}:${{ env.BUILDER_VERSION }} docker pull $DOCKER_IMAGE - docker run --env GITHUB_REF $DOCKER_IMAGE build -p ${{ env.PACKAGE_NAME }} linux-gcc-${{ matrix.version }}-linux-x64 + docker run --env GITHUB_REF $DOCKER_IMAGE build -p ${{ env.PACKAGE_NAME }} --compiler=gcc-${{ matrix.version }} - windows: + windows-vs16: runs-on: windows-latest steps: - name: Build ${{ env.PACKAGE_NAME }} + consumers run: | + md D:\a\work + cd D:\a\work python -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz', 'builder.pyz')" - python builder.pyz build -p ${{ env.PACKAGE_NAME }} default-downstream + python builder.pyz build -p ${{ env.PACKAGE_NAME }} --spec=downstream + + windows-vs14: + runs-on: windows-latest + strategy: + matrix: + arch: [x86, x64] + steps: + - uses: ilammy/msvc-dev-cmd@v1 + with: + toolset: 14.0 + arch: ${{ matrix.arch }} + uwp: false + spectre: true + - name: Build ${{ env.PACKAGE_NAME }} + consumers + run: | + md D:\a\work + cd D:\a\work + python -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')" + python builder.pyz build -p ${{ env.PACKAGE_NAME }} --spec=downstream osx: runs-on: macos-latest @@ -87,6 +108,4 @@ jobs: run: | python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz', 'builder')" chmod a+x builder - ./builder build -p ${{ env.PACKAGE_NAME }} default-downstream - - + ./builder build -p ${{ env.PACKAGE_NAME }} --spec=downstream diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c784771e6..4107c6ea0 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -10,9 +10,9 @@ jobs: steps: - name: Checkout Sources uses: actions/checkout@v1 - + - name: clang-format lint uses: DoozyX/clang-format-lint-action@v0.3.1 with: # List of extensions to check - extensions: c,h + extensions: cpp,h diff --git a/identity/source/IotIdentityClient.cpp b/identity/source/IotIdentityClient.cpp index dbfc64c08..bf13edf4a 100644 --- a/identity/source/IotIdentityClient.cpp +++ b/identity/source/IotIdentityClient.cpp @@ -46,6 +46,7 @@ namespace Aws const OnSubscribeToCreateCertificateFromCsrAcceptedResponse &handler, const OnSubscribeComplete &onSubAck) { + (void)request; auto onSubscribeComplete = [handler, onSubAck]( Aws::Crt::Mqtt::MqttConnection &, uint16_t, @@ -97,6 +98,7 @@ namespace Aws const OnSubscribeToCreateKeysAndCertificateRejectedResponse &handler, const OnSubscribeComplete &onSubAck) { + (void)request; auto onSubscribeComplete = [handler, onSubAck]( Aws::Crt::Mqtt::MqttConnection &, uint16_t, @@ -148,6 +150,7 @@ namespace Aws const OnSubscribeToRegisterThingAcceptedResponse &handler, const OnSubscribeComplete &onSubAck) { + (void)request; auto onSubscribeComplete = [handler, onSubAck]( Aws::Crt::Mqtt::MqttConnection &, uint16_t, @@ -199,6 +202,7 @@ namespace Aws const OnSubscribeToRegisterThingRejectedResponse &handler, const OnSubscribeComplete &onSubAck) { + (void)request; auto onSubscribeComplete = [handler, onSubAck]( Aws::Crt::Mqtt::MqttConnection &, uint16_t, @@ -250,6 +254,7 @@ namespace Aws const OnSubscribeToCreateKeysAndCertificateAcceptedResponse &handler, const OnSubscribeComplete &onSubAck) { + (void)request; auto onSubscribeComplete = [handler, onSubAck]( Aws::Crt::Mqtt::MqttConnection &, uint16_t, @@ -301,6 +306,7 @@ namespace Aws const OnSubscribeToCreateCertificateFromCsrRejectedResponse &handler, const OnSubscribeComplete &onSubAck) { + (void)request; auto onSubscribeComplete = [handler, onSubAck]( Aws::Crt::Mqtt::MqttConnection &, uint16_t, diff --git a/jobs/source/IotJobsClient.cpp b/jobs/source/IotJobsClient.cpp index 43f78af52..22e325644 100644 --- a/jobs/source/IotJobsClient.cpp +++ b/jobs/source/IotJobsClient.cpp @@ -53,6 +53,7 @@ namespace Aws const OnSubscribeToUpdateJobExecutionAcceptedResponse &handler, const OnSubscribeComplete &onSubAck) { + (void)request; auto onSubscribeComplete = [handler, onSubAck]( Aws::Crt::Mqtt::MqttConnection &, uint16_t, @@ -104,6 +105,7 @@ namespace Aws const OnSubscribeToGetPendingJobExecutionsRejectedResponse &handler, const OnSubscribeComplete &onSubAck) { + (void)request; auto onSubscribeComplete = [handler, onSubAck]( Aws::Crt::Mqtt::MqttConnection &, uint16_t, @@ -155,6 +157,7 @@ namespace Aws const OnSubscribeToDescribeJobExecutionAcceptedResponse &handler, const OnSubscribeComplete &onSubAck) { + (void)request; auto onSubscribeComplete = [handler, onSubAck]( Aws::Crt::Mqtt::MqttConnection &, uint16_t, @@ -206,6 +209,7 @@ namespace Aws const OnSubscribeToDescribeJobExecutionRejectedResponse &handler, const OnSubscribeComplete &onSubAck) { + (void)request; auto onSubscribeComplete = [handler, onSubAck]( Aws::Crt::Mqtt::MqttConnection &, uint16_t, @@ -257,6 +261,7 @@ namespace Aws const OnSubscribeToUpdateJobExecutionRejectedResponse &handler, const OnSubscribeComplete &onSubAck) { + (void)request; auto onSubscribeComplete = [handler, onSubAck]( Aws::Crt::Mqtt::MqttConnection &, uint16_t, @@ -308,6 +313,7 @@ namespace Aws const OnSubscribeToJobExecutionsChangedEventsResponse &handler, const OnSubscribeComplete &onSubAck) { + (void)request; auto onSubscribeComplete = [handler, onSubAck]( Aws::Crt::Mqtt::MqttConnection &, uint16_t, @@ -357,6 +363,7 @@ namespace Aws const OnSubscribeToStartNextPendingJobExecutionRejectedResponse &handler, const OnSubscribeComplete &onSubAck) { + (void)request; auto onSubscribeComplete = [handler, onSubAck]( Aws::Crt::Mqtt::MqttConnection &, uint16_t, @@ -408,6 +415,7 @@ namespace Aws const OnSubscribeToNextJobExecutionChangedEventsResponse &handler, const OnSubscribeComplete &onSubAck) { + (void)request; auto onSubscribeComplete = [handler, onSubAck]( Aws::Crt::Mqtt::MqttConnection &, uint16_t, @@ -457,6 +465,7 @@ namespace Aws const OnSubscribeToGetPendingJobExecutionsAcceptedResponse &handler, const OnSubscribeComplete &onSubAck) { + (void)request; auto onSubscribeComplete = [handler, onSubAck]( Aws::Crt::Mqtt::MqttConnection &, uint16_t, @@ -508,6 +517,7 @@ namespace Aws const OnSubscribeToStartNextPendingJobExecutionAcceptedResponse &handler, const OnSubscribeComplete &onSubAck) { + (void)request; auto onSubscribeComplete = [handler, onSubAck]( Aws::Crt::Mqtt::MqttConnection &, uint16_t, diff --git a/samples/identity/fleet_provisioning/main.cpp b/samples/identity/fleet_provisioning/main.cpp index ebf806254..1680cf286 100644 --- a/samples/identity/fleet_provisioning/main.cpp +++ b/samples/identity/fleet_provisioning/main.cpp @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include diff --git a/shadow/cmake/IotShadow-cpp-config.cmake b/shadow/cmake/IotShadow-cpp-config.cmake index c64a3ff5e..8e68cfbfe 100644 --- a/shadow/cmake/IotShadow-cpp-config.cmake +++ b/shadow/cmake/IotShadow-cpp-config.cmake @@ -3,7 +3,7 @@ include(CMakeFindDependencyMacro) find_dependency(aws-crt-cpp) if (BUILD_SHARED_LIBS) - include(${CMAKE_CURRENT_LIST_DIR}/shared/@PROJECT_NAME@-targets.cmake) -else () - include(${CMAKE_CURRENT_LIST_DIR}/static/@PROJECT_NAME@-targets.cmake) -endif() \ No newline at end of file + include(${CMAKE_CURRENT_LIST_DIR}/shared/@PROJECT_NAME@-targets.cmake) +else() + include(${CMAKE_CURRENT_LIST_DIR}/static/@PROJECT_NAME@-targets.cmake) +endif() diff --git a/shadow/source/IotShadowClient.cpp b/shadow/source/IotShadowClient.cpp index 25f467d66..b715b88e8 100644 --- a/shadow/source/IotShadowClient.cpp +++ b/shadow/source/IotShadowClient.cpp @@ -50,6 +50,7 @@ namespace Aws const OnSubscribeToUpdateShadowRejectedResponse &handler, const OnSubscribeComplete &onSubAck) { + (void)request; auto onSubscribeComplete = [handler, onSubAck]( Aws::Crt::Mqtt::MqttConnection &, uint16_t, @@ -101,6 +102,7 @@ namespace Aws const OnSubscribeToDeleteShadowRejectedResponse &handler, const OnSubscribeComplete &onSubAck) { + (void)request; auto onSubscribeComplete = [handler, onSubAck]( Aws::Crt::Mqtt::MqttConnection &, uint16_t, @@ -152,6 +154,7 @@ namespace Aws const OnSubscribeToGetShadowAcceptedResponse &handler, const OnSubscribeComplete &onSubAck) { + (void)request; auto onSubscribeComplete = [handler, onSubAck]( Aws::Crt::Mqtt::MqttConnection &, uint16_t, @@ -203,6 +206,7 @@ namespace Aws const OnSubscribeToShadowUpdatedEventsResponse &handler, const OnSubscribeComplete &onSubAck) { + (void)request; auto onSubscribeComplete = [handler, onSubAck]( Aws::Crt::Mqtt::MqttConnection &, uint16_t, @@ -254,6 +258,7 @@ namespace Aws const OnSubscribeToShadowDeltaUpdatedEventsResponse &handler, const OnSubscribeComplete &onSubAck) { + (void)request; auto onSubscribeComplete = [handler, onSubAck]( Aws::Crt::Mqtt::MqttConnection &, uint16_t, @@ -305,6 +310,7 @@ namespace Aws const OnSubscribeToDeleteShadowAcceptedResponse &handler, const OnSubscribeComplete &onSubAck) { + (void)request; auto onSubscribeComplete = [handler, onSubAck]( Aws::Crt::Mqtt::MqttConnection &, uint16_t, @@ -356,6 +362,7 @@ namespace Aws const OnSubscribeToGetShadowRejectedResponse &handler, const OnSubscribeComplete &onSubAck) { + (void)request; auto onSubscribeComplete = [handler, onSubAck]( Aws::Crt::Mqtt::MqttConnection &, uint16_t, @@ -407,6 +414,7 @@ namespace Aws const OnSubscribeToUpdateShadowAcceptedResponse &handler, const OnSubscribeComplete &onSubAck) { + (void)request; auto onSubscribeComplete = [handler, onSubAck]( Aws::Crt::Mqtt::MqttConnection &, uint16_t,