From c27e6557f480c4512702e321ae9d6702b62e06c0 Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Wed, 24 Jul 2024 18:59:25 +0000 Subject: [PATCH 01/20] Use generated poms in java test --- .github/workflows/test_java.yml | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test_java.yml b/.github/workflows/test_java.yml index 189e5c2907f9..98b4cfdf6834 100644 --- a/.github/workflows/test_java.yml +++ b/.github/workflows/test_java.yml @@ -99,10 +99,6 @@ jobs: run: | mv ${{ steps.build-protoc.outputs.protoc }} protoc sudo rm -rf _build - - name: Install snapshot version locally (not using generated pom.xml) - run: | - mvn -e -B -Dhttps.protocols=TLSv1.2 install -Dmaven.test.skip=true - working-directory: java - name: Generate pom.xml files from the template uses: protocolbuffers/protobuf-ci/bazel-docker@v3 with: @@ -111,16 +107,16 @@ jobs: bazel-cache: java_linux/11 # protobuf-java and protobuf-java-util are the member of the BOM bash: | - bazel build //java/core:core_mvn-pom //java/util:util_mvn-pom - cp bazel-bin/java/core/core_mvn-pom.xml . - cp bazel-bin/java/util/util_mvn-pom.xml . - - name: Copy the generated pom.xml files to the local Maven repository - shell: bash + bazel build //java/core:core_mvn-pom //java/kotlin-lite:kotlin-lite_mvn-pom //java/kotlin:kotlin_mvn-pom //java/lite:lite_mvn-pom //java/util:util_mvn-pom + cp -f bazel-bin/java/core/core_mvn-pom.xml //java/core/pom.xml + cp -f bazel-bin/java/kotlin-lite/kotlin-lite_mvn-pom.xml //java/kotlin-lite/pom.xml + cp -f bazel-bin/java/kotlin/kotlin_mvn-pom.xml //java/kotlin/pom.xml + cp -f bazel-bin/java/lite/lite_mvn-pom.xml //java/lite/pom.xml + cp -f bazel-bin/java/util/util_mvn-pom.xml //java/util/pom.xml + - name: Install snapshot version locally (using generated pom.xml) run: | - LOCAL_MAVEN_GROUP_DIR="${HOME}/.m2/repository/com/google/protobuf" - VERSION=$(grep "" core_mvn-pom.xml | sed "s/\(.*\)<\/version>/\1/" | xargs) - cp core_mvn-pom.xml ${LOCAL_MAVEN_GROUP_DIR}/protobuf-java/${VERSION}/protobuf-java-${VERSION}.pom - cp util_mvn-pom.xml ${LOCAL_MAVEN_GROUP_DIR}/protobuf-java-util/${VERSION}/protobuf-java-util-${VERSION}.pom + mvn -e -B -Dhttps.protocols=TLSv1.2 install -Dmaven.test.skip=true + working-directory: java - name: Clean up run: | sudo rm -rf _build From ec548a29501f2b807976395a171f242fba5940a0 Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Wed, 24 Jul 2024 20:02:16 +0000 Subject: [PATCH 02/20] Fix lite bazel target --- .github/workflows/test_java.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_java.yml b/.github/workflows/test_java.yml index 98b4cfdf6834..1fcb2aa34c83 100644 --- a/.github/workflows/test_java.yml +++ b/.github/workflows/test_java.yml @@ -107,8 +107,9 @@ jobs: bazel-cache: java_linux/11 # protobuf-java and protobuf-java-util are the member of the BOM bash: | - bazel build //java/core:core_mvn-pom //java/kotlin-lite:kotlin-lite_mvn-pom //java/kotlin:kotlin_mvn-pom //java/lite:lite_mvn-pom //java/util:util_mvn-pom + bazel build //java/core:core_mvn-pom //java/core:lite_mvn-pom //java/kotlin-lite:kotlin-lite_mvn-pom //java/kotlin:kotlin_mvn-pom //java/util:util_mvn-pom cp -f bazel-bin/java/core/core_mvn-pom.xml //java/core/pom.xml + cp -f bazel-bin/java/core/lite_mvn-pom.xml //java/lite/pom.xml cp -f bazel-bin/java/kotlin-lite/kotlin-lite_mvn-pom.xml //java/kotlin-lite/pom.xml cp -f bazel-bin/java/kotlin/kotlin_mvn-pom.xml //java/kotlin/pom.xml cp -f bazel-bin/java/lite/lite_mvn-pom.xml //java/lite/pom.xml From 3a2433feb37368905ccf92d66a94a852b2c749c8 Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Wed, 24 Jul 2024 20:39:48 +0000 Subject: [PATCH 03/20] Use java as working directory --- .github/workflows/test_java.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test_java.yml b/.github/workflows/test_java.yml index 1fcb2aa34c83..ee723aa652f7 100644 --- a/.github/workflows/test_java.yml +++ b/.github/workflows/test_java.yml @@ -105,15 +105,14 @@ jobs: image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:11-1fdbb997433cb22c1e49ef75ad374a8d6bb88702 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: java_linux/11 - # protobuf-java and protobuf-java-util are the member of the BOM bash: | bazel build //java/core:core_mvn-pom //java/core:lite_mvn-pom //java/kotlin-lite:kotlin-lite_mvn-pom //java/kotlin:kotlin_mvn-pom //java/util:util_mvn-pom - cp -f bazel-bin/java/core/core_mvn-pom.xml //java/core/pom.xml - cp -f bazel-bin/java/core/lite_mvn-pom.xml //java/lite/pom.xml - cp -f bazel-bin/java/kotlin-lite/kotlin-lite_mvn-pom.xml //java/kotlin-lite/pom.xml - cp -f bazel-bin/java/kotlin/kotlin_mvn-pom.xml //java/kotlin/pom.xml - cp -f bazel-bin/java/lite/lite_mvn-pom.xml //java/lite/pom.xml - cp -f bazel-bin/java/util/util_mvn-pom.xml //java/util/pom.xml + cp -f bazel-bin/java/core/core_mvn-pom.xml core/pom.xml + cp -f bazel-bin/java/core/lite_mvn-pom.xml lite/pom.xml + cp -f bazel-bin/java/kotlin-lite/kotlin-lite_mvn-pom.xml kotlin-lite/pom.xml + cp -f bazel-bin/java/kotlin/kotlin_mvn-pom.xml kotlin/pom.xml + cp -f bazel-bin/java/util/util_mvn-pom.xml util/pom.xml + working-directory: java - name: Install snapshot version locally (using generated pom.xml) run: | mvn -e -B -Dhttps.protocols=TLSv1.2 install -Dmaven.test.skip=true From 37538f67a1c26d02bec62a451511aa185404299a Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Wed, 24 Jul 2024 21:04:01 +0000 Subject: [PATCH 04/20] Separate generate and copy step --- .github/workflows/test_java.yml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test_java.yml b/.github/workflows/test_java.yml index ee723aa652f7..9cc031e4c83b 100644 --- a/.github/workflows/test_java.yml +++ b/.github/workflows/test_java.yml @@ -107,12 +107,19 @@ jobs: bazel-cache: java_linux/11 bash: | bazel build //java/core:core_mvn-pom //java/core:lite_mvn-pom //java/kotlin-lite:kotlin-lite_mvn-pom //java/kotlin:kotlin_mvn-pom //java/util:util_mvn-pom - cp -f bazel-bin/java/core/core_mvn-pom.xml core/pom.xml - cp -f bazel-bin/java/core/lite_mvn-pom.xml lite/pom.xml - cp -f bazel-bin/java/kotlin-lite/kotlin-lite_mvn-pom.xml kotlin-lite/pom.xml - cp -f bazel-bin/java/kotlin/kotlin_mvn-pom.xml kotlin/pom.xml - cp -f bazel-bin/java/util/util_mvn-pom.xml util/pom.xml - working-directory: java + cp bazel-bin/java/core/core_mvn-pom.xml . + cp bazel-bin/java/core/lite_mvn-pom.xml . + cp bazel-bin/java/kotlin-lite/kotlin-lite_mvn-pom.xml . + cp bazel-bin/java/kotlin/kotlin_mvn-pom.xml . + cp bazel-bin/java/util/util_mvn-pom.xml . + - name: Copy the generated pom.xml files to the java repository + shell: bash + run: | + cp -f core_mvn-pom.xml core/pom.xml + cp -f lite_mvn-pom.xml lite/pom.xml + cp -f kotlin-lite_mvn-pom.xml kotlin-lite/pom.xml + cp -f kotlin_mvn-pom.xml kotlin/pom.xml + cp -f util_mvn-pom.xml util/pom.xml - name: Install snapshot version locally (using generated pom.xml) run: | mvn -e -B -Dhttps.protocols=TLSv1.2 install -Dmaven.test.skip=true From a19581edc18e31ae9cb3b64993227be2a133c835 Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Wed, 24 Jul 2024 21:38:03 +0000 Subject: [PATCH 05/20] Specify java as the working directory --- .github/workflows/test_java.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test_java.yml b/.github/workflows/test_java.yml index 9cc031e4c83b..3db16c3f934c 100644 --- a/.github/workflows/test_java.yml +++ b/.github/workflows/test_java.yml @@ -120,6 +120,7 @@ jobs: cp -f kotlin-lite_mvn-pom.xml kotlin-lite/pom.xml cp -f kotlin_mvn-pom.xml kotlin/pom.xml cp -f util_mvn-pom.xml util/pom.xml + working-directory: java - name: Install snapshot version locally (using generated pom.xml) run: | mvn -e -B -Dhttps.protocols=TLSv1.2 install -Dmaven.test.skip=true From f963ba980cb8ba10e985c4fd51b4879ff605eccf Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Thu, 25 Jul 2024 16:21:38 +0000 Subject: [PATCH 06/20] Use output of steps to get pom files --- .github/workflows/test_java.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test_java.yml b/.github/workflows/test_java.yml index 3db16c3f934c..229a6a2f68b3 100644 --- a/.github/workflows/test_java.yml +++ b/.github/workflows/test_java.yml @@ -100,6 +100,7 @@ jobs: mv ${{ steps.build-protoc.outputs.protoc }} protoc sudo rm -rf _build - name: Generate pom.xml files from the template + id: generate-poms uses: protocolbuffers/protobuf-ci/bazel-docker@v3 with: image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:11-1fdbb997433cb22c1e49ef75ad374a8d6bb88702 @@ -115,11 +116,11 @@ jobs: - name: Copy the generated pom.xml files to the java repository shell: bash run: | - cp -f core_mvn-pom.xml core/pom.xml - cp -f lite_mvn-pom.xml lite/pom.xml - cp -f kotlin-lite_mvn-pom.xml kotlin-lite/pom.xml - cp -f kotlin_mvn-pom.xml kotlin/pom.xml - cp -f util_mvn-pom.xml util/pom.xml + mv -f ${{ steps.generate-poms.outputs.core_mvn-pom.xml }} core/pom.xml + mv -f ${{ steps.generate-poms.outputs.lite_mvn-pom.xml }} lite/pom.xml + mv -f ${{ steps.generate-poms.outputs.kotlin-lite_mvn-pom.xml }} kotlin-lite/pom.xml + mv -f ${{ steps.generate-poms.outputs.kotlin_mvn-pom.xml }} kotlin/pom.xml + mv -f ${{ steps.generate-poms.outputs.util_mvn-pom.xml }} util/pom.xml working-directory: java - name: Install snapshot version locally (using generated pom.xml) run: | From 6d068db2bf35d4fccc55e3394bea07278fd4323d Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Thu, 25 Jul 2024 16:43:19 +0000 Subject: [PATCH 07/20] Set step output --- .github/workflows/test_java.yml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test_java.yml b/.github/workflows/test_java.yml index 229a6a2f68b3..ba73bb574a9a 100644 --- a/.github/workflows/test_java.yml +++ b/.github/workflows/test_java.yml @@ -108,19 +108,24 @@ jobs: bazel-cache: java_linux/11 bash: | bazel build //java/core:core_mvn-pom //java/core:lite_mvn-pom //java/kotlin-lite:kotlin-lite_mvn-pom //java/kotlin:kotlin_mvn-pom //java/util:util_mvn-pom - cp bazel-bin/java/core/core_mvn-pom.xml . + mv bazel-bin/java/core/core_mvn-pom.xml . + echo "core-pom=core_mvn-pom.xml" >> "$GITHUB_OUTPUT" cp bazel-bin/java/core/lite_mvn-pom.xml . + echo "lite-pom=lite_mvn-pom.xml" >> "$GITHUB_OUTPUT" cp bazel-bin/java/kotlin-lite/kotlin-lite_mvn-pom.xml . + echo "kotlin-lite-pom=kotlin-lite_mvn-pom.xml" >> "$GITHUB_OUTPUT" cp bazel-bin/java/kotlin/kotlin_mvn-pom.xml . + echo "kotlin-pom=kotlin_mvn-pom.xml" >> "$GITHUB_OUTPUT" cp bazel-bin/java/util/util_mvn-pom.xml . + echo "util-pom=util_mvn-pom.xml" >> "$GITHUB_OUTPUT" - name: Copy the generated pom.xml files to the java repository shell: bash run: | - mv -f ${{ steps.generate-poms.outputs.core_mvn-pom.xml }} core/pom.xml - mv -f ${{ steps.generate-poms.outputs.lite_mvn-pom.xml }} lite/pom.xml - mv -f ${{ steps.generate-poms.outputs.kotlin-lite_mvn-pom.xml }} kotlin-lite/pom.xml - mv -f ${{ steps.generate-poms.outputs.kotlin_mvn-pom.xml }} kotlin/pom.xml - mv -f ${{ steps.generate-poms.outputs.util_mvn-pom.xml }} util/pom.xml + mv -f ${{ steps.generate-poms.outputs.core-pom }} core/pom.xml + mv -f ${{ steps.generate-poms.outputs.lite-pom }} lite/pom.xml + mv -f ${{ steps.generate-poms.outputs.kotlin-lite-pom }} kotlin-lite/pom.xml + mv -f ${{ steps.generate-poms.outputs.kotlin-pom }} kotlin/pom.xml + mv -f ${{ steps.generate-poms.outputs.util-pom }} util/pom.xml working-directory: java - name: Install snapshot version locally (using generated pom.xml) run: | From c886a6e65000945fd87e3c11a505a53bd7560c19 Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Thu, 25 Jul 2024 20:15:10 +0000 Subject: [PATCH 08/20] Try different strategy to copy generated files --- .github/workflows/test_java.yml | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test_java.yml b/.github/workflows/test_java.yml index ba73bb574a9a..69c089972200 100644 --- a/.github/workflows/test_java.yml +++ b/.github/workflows/test_java.yml @@ -100,7 +100,6 @@ jobs: mv ${{ steps.build-protoc.outputs.protoc }} protoc sudo rm -rf _build - name: Generate pom.xml files from the template - id: generate-poms uses: protocolbuffers/protobuf-ci/bazel-docker@v3 with: image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:11-1fdbb997433cb22c1e49ef75ad374a8d6bb88702 @@ -108,25 +107,19 @@ jobs: bazel-cache: java_linux/11 bash: | bazel build //java/core:core_mvn-pom //java/core:lite_mvn-pom //java/kotlin-lite:kotlin-lite_mvn-pom //java/kotlin:kotlin_mvn-pom //java/util:util_mvn-pom - mv bazel-bin/java/core/core_mvn-pom.xml . - echo "core-pom=core_mvn-pom.xml" >> "$GITHUB_OUTPUT" - cp bazel-bin/java/core/lite_mvn-pom.xml . - echo "lite-pom=lite_mvn-pom.xml" >> "$GITHUB_OUTPUT" - cp bazel-bin/java/kotlin-lite/kotlin-lite_mvn-pom.xml . - echo "kotlin-lite-pom=kotlin-lite_mvn-pom.xml" >> "$GITHUB_OUTPUT" - cp bazel-bin/java/kotlin/kotlin_mvn-pom.xml . - echo "kotlin-pom=kotlin_mvn-pom.xml" >> "$GITHUB_OUTPUT" - cp bazel-bin/java/util/util_mvn-pom.xml . - echo "util-pom=util_mvn-pom.xml" >> "$GITHUB_OUTPUT" + mkdir -p generatedPoms + cp bazel-bin/java/core/core_mvn-pom.xml generatedPoms/core_mvn-pom.xml + cp bazel-bin/java/core/lite_mvn-pom.xml generatedPoms/lite_mvn-pom.xml + cp bazel-bin/java/kotlin-lite/kotlin-lite_mvn-pom.xml generatedPoms/kotlin-lite_mvn-pom.xml + cp bazel-bin/java/kotlin/kotlin_mvn-pom.xml generatedPoms/kotlin_mvn-pom.xml + cp bazel-bin/java/util/util_mvn-pom.xml generatedPoms/util_mgn-pom.xml - name: Copy the generated pom.xml files to the java repository - shell: bash run: | - mv -f ${{ steps.generate-poms.outputs.core-pom }} core/pom.xml - mv -f ${{ steps.generate-poms.outputs.lite-pom }} lite/pom.xml - mv -f ${{ steps.generate-poms.outputs.kotlin-lite-pom }} kotlin-lite/pom.xml - mv -f ${{ steps.generate-poms.outputs.kotlin-pom }} kotlin/pom.xml - mv -f ${{ steps.generate-poms.outputs.util-pom }} util/pom.xml - working-directory: java + mv -f generatedPoms/core_mvn-pom.xml java/core/pom.xml + mv -f generatedPoms/lite_mvn-pom.xml java/lite/pom.xml + mv -f generatedPoms/kotlin-lite_mvn-pom.xml java/kotlin-lite/pom.xml + mv -f generatedPoms/kotlin_mvn-pom.xml java/kotlin/pom.xml + mv -f generatedPoms/util_mvn-pom.xml java/util/pom.xml - name: Install snapshot version locally (using generated pom.xml) run: | mvn -e -B -Dhttps.protocols=TLSv1.2 install -Dmaven.test.skip=true From e477423a311caf318244658aadebb7a8a0851a5f Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Thu, 25 Jul 2024 20:24:58 +0000 Subject: [PATCH 09/20] Make new temp directory --- .github/workflows/test_java.yml | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test_java.yml b/.github/workflows/test_java.yml index 69c089972200..7e13240e9083 100644 --- a/.github/workflows/test_java.yml +++ b/.github/workflows/test_java.yml @@ -113,21 +113,24 @@ jobs: cp bazel-bin/java/kotlin-lite/kotlin-lite_mvn-pom.xml generatedPoms/kotlin-lite_mvn-pom.xml cp bazel-bin/java/kotlin/kotlin_mvn-pom.xml generatedPoms/kotlin_mvn-pom.xml cp bazel-bin/java/util/util_mvn-pom.xml generatedPoms/util_mgn-pom.xml - - name: Copy the generated pom.xml files to the java repository + - name: Copy the generated pom.xml files to a copy of the java repository run: | - mv -f generatedPoms/core_mvn-pom.xml java/core/pom.xml - mv -f generatedPoms/lite_mvn-pom.xml java/lite/pom.xml - mv -f generatedPoms/kotlin-lite_mvn-pom.xml java/kotlin-lite/pom.xml - mv -f generatedPoms/kotlin_mvn-pom.xml java/kotlin/pom.xml - mv -f generatedPoms/util_mvn-pom.xml java/util/pom.xml + cp -r java testMaven + mv -f generatedPoms/core_mvn-pom.xml testMaven/core/pom.xml + mv -f generatedPoms/lite_mvn-pom.xml testMaven/lite/pom.xml + mv -f generatedPoms/kotlin-lite_mvn-pom.xml testMaven/kotlin-lite/pom.xml + mv -f generatedPoms/kotlin_mvn-pom.xml testMaven/kotlin/pom.xml + mv -f generatedPoms/util_mvn-pom.xml testMaven/util/pom.xml - name: Install snapshot version locally (using generated pom.xml) run: | mvn -e -B -Dhttps.protocols=TLSv1.2 install -Dmaven.test.skip=true - working-directory: java - - name: Clean up - run: | - sudo rm -rf _build + working-directory: testMaven - name: Validate Protobuf BOM uses: googleapis/java-cloud-bom/tests/validate-bom@fd56f04bb0bc581776a74031591f0b3bc5e7920a # v26.13.0 with: - bom-path: java/bom/pom.xml + bom-path: testMaven/bom/pom.xml + - name: Clean up + run: | + sudo rm -rf _build + sudo rm -rf generatedPoms + sudo rm -rf testMaven From ad53fc6101c7e67d952f61fac2f6301c53f5d26f Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Thu, 25 Jul 2024 20:31:37 +0000 Subject: [PATCH 10/20] Add debugging --- .github/workflows/test_java.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test_java.yml b/.github/workflows/test_java.yml index 7e13240e9083..ecf0c1c41249 100644 --- a/.github/workflows/test_java.yml +++ b/.github/workflows/test_java.yml @@ -116,6 +116,8 @@ jobs: - name: Copy the generated pom.xml files to a copy of the java repository run: | cp -r java testMaven + ls -la testMaven + ls -la generatedPoms mv -f generatedPoms/core_mvn-pom.xml testMaven/core/pom.xml mv -f generatedPoms/lite_mvn-pom.xml testMaven/lite/pom.xml mv -f generatedPoms/kotlin-lite_mvn-pom.xml testMaven/kotlin-lite/pom.xml From c560f4bdbf0e587d716537abf89a612d7bb28ab1 Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Thu, 25 Jul 2024 20:40:04 +0000 Subject: [PATCH 11/20] Add correct permissions --- .github/workflows/test_java.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test_java.yml b/.github/workflows/test_java.yml index ecf0c1c41249..554680e63381 100644 --- a/.github/workflows/test_java.yml +++ b/.github/workflows/test_java.yml @@ -113,9 +113,11 @@ jobs: cp bazel-bin/java/kotlin-lite/kotlin-lite_mvn-pom.xml generatedPoms/kotlin-lite_mvn-pom.xml cp bazel-bin/java/kotlin/kotlin_mvn-pom.xml generatedPoms/kotlin_mvn-pom.xml cp bazel-bin/java/util/util_mvn-pom.xml generatedPoms/util_mgn-pom.xml + chmod -R 755 generatedPoms - name: Copy the generated pom.xml files to a copy of the java repository run: | cp -r java testMaven + chmod -R 755 testMaven ls -la testMaven ls -la generatedPoms mv -f generatedPoms/core_mvn-pom.xml testMaven/core/pom.xml From 67df3d00608fd199f3fe5e4cb88075078b6f6695 Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Thu, 25 Jul 2024 20:51:10 +0000 Subject: [PATCH 12/20] cp instead of mv --- .github/workflows/test_java.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test_java.yml b/.github/workflows/test_java.yml index 554680e63381..e03c8abaf33b 100644 --- a/.github/workflows/test_java.yml +++ b/.github/workflows/test_java.yml @@ -120,11 +120,11 @@ jobs: chmod -R 755 testMaven ls -la testMaven ls -la generatedPoms - mv -f generatedPoms/core_mvn-pom.xml testMaven/core/pom.xml - mv -f generatedPoms/lite_mvn-pom.xml testMaven/lite/pom.xml - mv -f generatedPoms/kotlin-lite_mvn-pom.xml testMaven/kotlin-lite/pom.xml - mv -f generatedPoms/kotlin_mvn-pom.xml testMaven/kotlin/pom.xml - mv -f generatedPoms/util_mvn-pom.xml testMaven/util/pom.xml + cp -f generatedPoms/core_mvn-pom.xml testMaven/core/pom.xml + cp -f generatedPoms/lite_mvn-pom.xml testMaven/lite/pom.xml + cp -f generatedPoms/kotlin-lite_mvn-pom.xml testMaven/kotlin-lite/pom.xml + cp -f generatedPoms/kotlin_mvn-pom.xml testMaven/kotlin/pom.xml + cp -f generatedPoms/util_mvn-pom.xml testMaven/util/pom.xml - name: Install snapshot version locally (using generated pom.xml) run: | mvn -e -B -Dhttps.protocols=TLSv1.2 install -Dmaven.test.skip=true From ec37809f7cf15673a92573dc453418e6cfec7005 Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Thu, 25 Jul 2024 20:56:19 +0000 Subject: [PATCH 13/20] Fix typo --- .github/workflows/test_java.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_java.yml b/.github/workflows/test_java.yml index e03c8abaf33b..aacbeb4da63e 100644 --- a/.github/workflows/test_java.yml +++ b/.github/workflows/test_java.yml @@ -112,7 +112,7 @@ jobs: cp bazel-bin/java/core/lite_mvn-pom.xml generatedPoms/lite_mvn-pom.xml cp bazel-bin/java/kotlin-lite/kotlin-lite_mvn-pom.xml generatedPoms/kotlin-lite_mvn-pom.xml cp bazel-bin/java/kotlin/kotlin_mvn-pom.xml generatedPoms/kotlin_mvn-pom.xml - cp bazel-bin/java/util/util_mvn-pom.xml generatedPoms/util_mgn-pom.xml + cp bazel-bin/java/util/util_mvn-pom.xml generatedPoms/util_mvn-pom.xml chmod -R 755 generatedPoms - name: Copy the generated pom.xml files to a copy of the java repository run: | From ba720cbf106fab739c194630fb890b2a24f54031 Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Thu, 25 Jul 2024 21:06:12 +0000 Subject: [PATCH 14/20] Delete chmod stuff --- .github/workflows/test_java.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/test_java.yml b/.github/workflows/test_java.yml index aacbeb4da63e..290dff0cdcac 100644 --- a/.github/workflows/test_java.yml +++ b/.github/workflows/test_java.yml @@ -113,13 +113,9 @@ jobs: cp bazel-bin/java/kotlin-lite/kotlin-lite_mvn-pom.xml generatedPoms/kotlin-lite_mvn-pom.xml cp bazel-bin/java/kotlin/kotlin_mvn-pom.xml generatedPoms/kotlin_mvn-pom.xml cp bazel-bin/java/util/util_mvn-pom.xml generatedPoms/util_mvn-pom.xml - chmod -R 755 generatedPoms - name: Copy the generated pom.xml files to a copy of the java repository run: | cp -r java testMaven - chmod -R 755 testMaven - ls -la testMaven - ls -la generatedPoms cp -f generatedPoms/core_mvn-pom.xml testMaven/core/pom.xml cp -f generatedPoms/lite_mvn-pom.xml testMaven/lite/pom.xml cp -f generatedPoms/kotlin-lite_mvn-pom.xml testMaven/kotlin-lite/pom.xml From ca025d6a6940a78bd81b5b577ad134ddccf6d24e Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Thu, 25 Jul 2024 21:10:57 +0000 Subject: [PATCH 15/20] Try with existing pom files --- .github/workflows/test_java.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/test_java.yml b/.github/workflows/test_java.yml index 290dff0cdcac..3e034bd4f37e 100644 --- a/.github/workflows/test_java.yml +++ b/.github/workflows/test_java.yml @@ -116,11 +116,6 @@ jobs: - name: Copy the generated pom.xml files to a copy of the java repository run: | cp -r java testMaven - cp -f generatedPoms/core_mvn-pom.xml testMaven/core/pom.xml - cp -f generatedPoms/lite_mvn-pom.xml testMaven/lite/pom.xml - cp -f generatedPoms/kotlin-lite_mvn-pom.xml testMaven/kotlin-lite/pom.xml - cp -f generatedPoms/kotlin_mvn-pom.xml testMaven/kotlin/pom.xml - cp -f generatedPoms/util_mvn-pom.xml testMaven/util/pom.xml - name: Install snapshot version locally (using generated pom.xml) run: | mvn -e -B -Dhttps.protocols=TLSv1.2 install -Dmaven.test.skip=true From 0b8996c37769aed02f2e1657d3d00a60bdd60a0c Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Thu, 25 Jul 2024 21:25:26 +0000 Subject: [PATCH 16/20] Try everything but core --- .github/workflows/test_java.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test_java.yml b/.github/workflows/test_java.yml index 3e034bd4f37e..cea3dc76e9ba 100644 --- a/.github/workflows/test_java.yml +++ b/.github/workflows/test_java.yml @@ -116,6 +116,10 @@ jobs: - name: Copy the generated pom.xml files to a copy of the java repository run: | cp -r java testMaven + cp -f generatedPoms/lite_mvn-pom.xml testMaven/lite/pom.xml + cp -f generatedPoms/kotlin-lite_mvn-pom.xml testMaven/kotlin-lite/pom.xml + cp -f generatedPoms/kotlin_mvn-pom.xml testMaven/kotlin/pom.xml + cp -f generatedPoms/util_mvn-pom.xml testMaven/util/pom.xml - name: Install snapshot version locally (using generated pom.xml) run: | mvn -e -B -Dhttps.protocols=TLSv1.2 install -Dmaven.test.skip=true From cd70033266c119e137ccf493e851a770c2119c48 Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Thu, 25 Jul 2024 21:38:22 +0000 Subject: [PATCH 17/20] Add test sources to pom template --- .github/workflows/test_java.yml | 1 + java/core/pom_template.xml | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/.github/workflows/test_java.yml b/.github/workflows/test_java.yml index cea3dc76e9ba..290dff0cdcac 100644 --- a/.github/workflows/test_java.yml +++ b/.github/workflows/test_java.yml @@ -116,6 +116,7 @@ jobs: - name: Copy the generated pom.xml files to a copy of the java repository run: | cp -r java testMaven + cp -f generatedPoms/core_mvn-pom.xml testMaven/core/pom.xml cp -f generatedPoms/lite_mvn-pom.xml testMaven/lite/pom.xml cp -f generatedPoms/kotlin-lite_mvn-pom.xml testMaven/kotlin-lite/pom.xml cp -f generatedPoms/kotlin_mvn-pom.xml testMaven/kotlin/pom.xml diff --git a/java/core/pom_template.xml b/java/core/pom_template.xml index 11bd41964f8d..698657515b57 100644 --- a/java/core/pom_template.xml +++ b/java/core/pom_template.xml @@ -21,6 +21,38 @@ + + + org.codehaus.mojo + build-helper-maven-plugin + + + add-generated-sources + generate-sources + + add-source + + + + ${generated.sources.dir} + + + + + add-generated-test-sources + generate-test-sources + + add-test-source + + + + ${generated.testsources.dir} + + + + + + org.apache.felix From c78ef3c1ddac7cc85c0b77e14df091b2b185ae60 Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Fri, 26 Jul 2024 16:28:47 +0000 Subject: [PATCH 18/20] Use mvn install-file --- .github/workflows/test_java.yml | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/.github/workflows/test_java.yml b/.github/workflows/test_java.yml index 290dff0cdcac..f9129e89b18c 100644 --- a/.github/workflows/test_java.yml +++ b/.github/workflows/test_java.yml @@ -99,38 +99,23 @@ jobs: run: | mv ${{ steps.build-protoc.outputs.protoc }} protoc sudo rm -rf _build - - name: Generate pom.xml files from the template + - name: Generate maven artifacts with bazel and install using maven uses: protocolbuffers/protobuf-ci/bazel-docker@v3 with: image: us-docker.pkg.dev/protobuf-build/containers/test/linux/java:11-1fdbb997433cb22c1e49ef75ad374a8d6bb88702 credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} bazel-cache: java_linux/11 bash: | - bazel build //java/core:core_mvn-pom //java/core:lite_mvn-pom //java/kotlin-lite:kotlin-lite_mvn-pom //java/kotlin:kotlin_mvn-pom //java/util:util_mvn-pom - mkdir -p generatedPoms - cp bazel-bin/java/core/core_mvn-pom.xml generatedPoms/core_mvn-pom.xml - cp bazel-bin/java/core/lite_mvn-pom.xml generatedPoms/lite_mvn-pom.xml - cp bazel-bin/java/kotlin-lite/kotlin-lite_mvn-pom.xml generatedPoms/kotlin-lite_mvn-pom.xml - cp bazel-bin/java/kotlin/kotlin_mvn-pom.xml generatedPoms/kotlin_mvn-pom.xml - cp bazel-bin/java/util/util_mvn-pom.xml generatedPoms/util_mvn-pom.xml - - name: Copy the generated pom.xml files to a copy of the java repository - run: | - cp -r java testMaven - cp -f generatedPoms/core_mvn-pom.xml testMaven/core/pom.xml - cp -f generatedPoms/lite_mvn-pom.xml testMaven/lite/pom.xml - cp -f generatedPoms/kotlin-lite_mvn-pom.xml testMaven/kotlin-lite/pom.xml - cp -f generatedPoms/kotlin_mvn-pom.xml testMaven/kotlin/pom.xml - cp -f generatedPoms/util_mvn-pom.xml testMaven/util/pom.xml - - name: Install snapshot version locally (using generated pom.xml) - run: | - mvn -e -B -Dhttps.protocols=TLSv1.2 install -Dmaven.test.skip=true - working-directory: testMaven + bazel build //java:release + mvn install:install-file -Dfile=bazel-bin/java/core/core_mvn-project.jar -DpomFile=bazel-bin/java/core/core_mvn-pom.xml + mvn install:install-file -Dfile=bazel-bin/java/core/lite_mvn-project.jar -DpomFile=bazel-bin/java/core/lite_mvn-pom.xml + mvn install:install-file -Dfile=bazel-bin/java/kotlin-lite/kotlin-lite_mvn-project.jar -DpomFile=bazel-bin/java/kotlin-lite/kotlin-lite_mvn-pom.xml + mvn install:install-file -Dfile=bazel-bin/java/kotlin/kotlin_mvn-project.jar -DpomFile=bazel-bin/java/kotlin/kotlin_mvn-pom.xml + mvn install:install-file -Dfile=bazel-bin/java/util/util_mvn-project.jar -DpomFile=bazel-bin/java/util/util_mvn-pom.xml - name: Validate Protobuf BOM uses: googleapis/java-cloud-bom/tests/validate-bom@fd56f04bb0bc581776a74031591f0b3bc5e7920a # v26.13.0 with: - bom-path: testMaven/bom/pom.xml + bom-path: java/bom/pom.xml - name: Clean up run: | sudo rm -rf _build - sudo rm -rf generatedPoms - sudo rm -rf testMaven From 00ef8d33b65004192b55b0be157cc70c8bce99ea Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Fri, 26 Jul 2024 16:46:59 +0000 Subject: [PATCH 19/20] Clean up test --- .github/workflows/test_java.yml | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/.github/workflows/test_java.yml b/.github/workflows/test_java.yml index f9129e89b18c..5c7c487f56d1 100644 --- a/.github/workflows/test_java.yml +++ b/.github/workflows/test_java.yml @@ -80,25 +80,14 @@ jobs: # # not work correctly with the toolchain in this Docker image. # bazel: test --test_output=all //java:linkage_monitor --spawn_strategy=standalone --features=-layering_check - protobuf-bom: - name: Protobuf Maven BOM + protobuf-maven: + name: Test Maven runs-on: ubuntu-latest steps: - name: Checkout pending changes uses: protocolbuffers/protobuf-ci/checkout@v3 with: ref: ${{ inputs.safe-checkout }} - - name: Build protoc - id: build-protoc - uses: protocolbuffers/protobuf-ci/cross-compile-protoc@v3 - with: - image: us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:6.3.0-91a0ac83e968068672bc6001a4d474cfd9a50f1d - credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} - architecture: linux-x86_64 - - name: Move protoc into place and clean up - run: | - mv ${{ steps.build-protoc.outputs.protoc }} protoc - sudo rm -rf _build - name: Generate maven artifacts with bazel and install using maven uses: protocolbuffers/protobuf-ci/bazel-docker@v3 with: @@ -116,6 +105,3 @@ jobs: uses: googleapis/java-cloud-bom/tests/validate-bom@fd56f04bb0bc581776a74031591f0b3bc5e7920a # v26.13.0 with: bom-path: java/bom/pom.xml - - name: Clean up - run: | - sudo rm -rf _build From c7c2d9b5656c8a82ccc0413a85c952d0912f06e8 Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Fri, 26 Jul 2024 17:09:52 +0000 Subject: [PATCH 20/20] Add back cleanup step --- .github/workflows/test_java.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test_java.yml b/.github/workflows/test_java.yml index 5c7c487f56d1..2939620b7eb3 100644 --- a/.github/workflows/test_java.yml +++ b/.github/workflows/test_java.yml @@ -101,6 +101,9 @@ jobs: mvn install:install-file -Dfile=bazel-bin/java/kotlin-lite/kotlin-lite_mvn-project.jar -DpomFile=bazel-bin/java/kotlin-lite/kotlin-lite_mvn-pom.xml mvn install:install-file -Dfile=bazel-bin/java/kotlin/kotlin_mvn-project.jar -DpomFile=bazel-bin/java/kotlin/kotlin_mvn-pom.xml mvn install:install-file -Dfile=bazel-bin/java/util/util_mvn-project.jar -DpomFile=bazel-bin/java/util/util_mvn-pom.xml + - name: Clean up + run: | + sudo rm -rf _build - name: Validate Protobuf BOM uses: googleapis/java-cloud-bom/tests/validate-bom@fd56f04bb0bc581776a74031591f0b3bc5e7920a # v26.13.0 with: