diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f49fd86e..11e0c451f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,6 +68,9 @@ if (BUILD_DEPS) list(APPEND AWSLC_CMAKE_ARGUMENTS -DFIPS=ON) list(APPEND AWSLC_CMAKE_ARGUMENTS -DDISABLE_PERL=OFF) + # Pick up GO_PATH env-var, set by aws-crt-builder when cross-compiling, see: + # https://github.com/awslabs/aws-crt-builder/blob/31307c808ed9f2ea1eb16503b25a9b582f886481/builder/imports/golang.py#L84 + # https://github.com/awslabs/aws-crt-builder/blob/31307c808ed9f2ea1eb16503b25a9b582f886481/builder/actions/cmake.py#L110 if (DEFINED ENV{GO_PATH}) list(APPEND AWSLC_CMAKE_ARGUMENTS -DGO_EXECUTABLE=$ENV{GO_PATH}/go) message(STATUS "Overriding GO_EXECUTABLE to ${GO_EXECUTABLE}") diff --git a/codebuild/cd/generic-unix-build.sh b/codebuild/cd/generic-unix-build.sh index 2dd4174d4..ee72af627 100755 --- a/codebuild/cd/generic-unix-build.sh +++ b/codebuild/cd/generic-unix-build.sh @@ -29,10 +29,20 @@ chmod a+x builder GIT_TAG=$(git describe --tags) ./builder build -p aws-crt-java --target=$AWS_CRT_TARGET run_tests=false -# Builder corss-compiles the shared lib to `target/cmake-build/aws-crt-java/`, move it to the expected path for mvn to generate the jar. -mv target/cmake-build/aws-crt-java/* target/cmake-build/ + +# When cross-compiling with builder, the shared lib gets an extra "/aws-crt-java/" in its path. +# Move it to expected location. +if [ -d target/cmake-build/aws-crt-java/lib ]; then + mv target/cmake-build/aws-crt-java/lib target/cmake-build/lib +fi + +# Double check that shared lib is where we expect +if ! find target/cmake-build/lib -type f -name "*.so" | grep -q .; then + echo "No .so files found" + exit 1 +fi JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 mvn -B package -DskipTests -Dshared-lib.skip=true -Dcrt.classifier=$CLASSIFIER -aws s3 cp --recursive --include "*.so" target/cmake-build/lib s3://aws-crt-java-pipeline/${GIT_TAG}/lib +aws s3 cp --recursive --exclude "*" --include "*.so" target/cmake-build/lib s3://aws-crt-java-pipeline/${GIT_TAG}/lib aws s3 cp target/ s3://aws-crt-java-pipeline/${GIT_TAG}/jar/ --recursive --exclude "*" --include "aws-crt*.jar" diff --git a/codebuild/cd/linux-aarch64-fips-build.sh b/codebuild/cd/linux-aarch64-fips-build.sh index edece0f05..15f4df370 100644 --- a/codebuild/cd/linux-aarch64-fips-build.sh +++ b/codebuild/cd/linux-aarch64-fips-build.sh @@ -18,8 +18,19 @@ chmod a+x builder GIT_TAG=$(git describe --tags) ./builder build -p aws-crt-java run_tests=false --target=linux-arm64 --cmake-extra=-DCRT_FIPS=ON -mv target/cmake-build/aws-crt-java/* target/cmake-build/ + +# When cross-compiling with builder, the shared lib gets an extra "/aws-crt-java/" in its path. +# Move it to expected location. +if [ -d target/cmake-build/aws-crt-java/lib ]; then + mv target/cmake-build/aws-crt-java/lib target/cmake-build/lib +fi + +# Double check that shared lib is where we expect +if ! find target/cmake-build/lib -type f -name "*.so" | grep -q .; then + echo "No .so files found" + exit 1 +fi JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 mvn -B package -DskipTests -Dshared-lib.skip=true -Dcrt.classifier=linux-aarch_64-fips -aws s3 cp --recursive --include "*.so" target/cmake-build/lib s3://aws-crt-java-pipeline/${GIT_TAG}/fips_lib +aws s3 cp --recursive --exclude "*" --include "*.so" target/cmake-build/lib s3://aws-crt-java-pipeline/${GIT_TAG}/fips_lib diff --git a/codebuild/cd/manylinux-x64-fips-build.yml b/codebuild/cd/manylinux-x64-fips-build.yml index e42a090d4..5e2027f20 100644 --- a/codebuild/cd/manylinux-x64-fips-build.yml +++ b/codebuild/cd/manylinux-x64-fips-build.yml @@ -11,9 +11,8 @@ phases: - git submodule update --init # double check aws-lc is the FIPS approved branch. - bash ./codebuild/cd/test-fips-branch.sh - - curl -OL https://go.dev/dl/go1.21.6.linux-amd64.tar.gz && mkdir ./go - - tar -C ./go -xvf go1.21.6.linux-amd64.tar.gz - - export PATH=$PATH:./go/go/bin + # aws-lc FIPS build requires golang for codegen + - yum install -y golang - mvn -B package -DskipTests -Dcrt.classifier=linux-x86_64-fips -Dcmake.crt_fips=ON post_build: diff --git a/codebuild/cd/musl-linux-build.sh b/codebuild/cd/musl-linux-build.sh index 4613c18ce..83731105a 100755 --- a/codebuild/cd/musl-linux-build.sh +++ b/codebuild/cd/musl-linux-build.sh @@ -23,5 +23,11 @@ docker container prune -f # Upload the artifacts to S3 export GIT_TAG=$(git describe --tags) -aws s3 cp --recursive --include "*.so" target/cmake-build/lib s3://aws-crt-java-pipeline/${GIT_TAG}/lib +# Double check that shared lib is where we expect +if ! find target/cmake-build/lib -type f -name "*.so" | grep -q .; then + echo "No .so files found" + exit 1 +fi + +aws s3 cp --recursive --exclude "*" --include "*.so" target/cmake-build/lib s3://aws-crt-java-pipeline/${GIT_TAG}/lib aws s3 cp target/ s3://aws-crt-java-pipeline/${GIT_TAG}/jar/ --recursive --exclude "*" --include "aws-crt*.jar"