From 3b296cc0c75e8757cec964dc7e805806c689f0ed Mon Sep 17 00:00:00 2001 From: Marcono1234 Date: Sat, 1 Jun 2024 02:36:54 +0200 Subject: [PATCH] Fix API compatibility workflow failing when building previous version (#2694) The workflow is currently failing for the jpms-test module: > Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile (default-compile) on project jpms-test: > Fatal error compiling: error: bad value for --module-version option: 'JAPICMP-OLD' Therefore this commit changes the dummy version number format. --- .github/workflows/check-api-compatibility.yml | 15 ++++++++++++--- pom.xml | 10 ++++------ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.github/workflows/check-api-compatibility.yml b/.github/workflows/check-api-compatibility.yml index 635ed4ef63..7845cbe298 100644 --- a/.github/workflows/check-api-compatibility.yml +++ b/.github/workflows/check-api-compatibility.yml @@ -8,8 +8,17 @@ jobs: check-api-compatibility: runs-on: ubuntu-latest + # This setup tries to determine API incompatibility only for the changes introduced by the + # pull request. It does this by first checking out the 'old' version and installing it into + # the local Maven repository before then using japicmp to compare it to the current changes. + # + # Alternatively it would also be possible to compare against the last release version instead. + # + # Both approaches have their advantages and disadvantages, see description of + # https://github.com/google/gson/pull/2692 for details. + steps: - - name: Checkout old version + - name: Check out old version uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 with: ref: ${{ github.event.pull_request.base.sha }} @@ -26,11 +35,11 @@ jobs: run: | cd gson-old-japicmp # Set dummy version - mvn --batch-mode --no-transfer-progress org.codehaus.mojo:versions-maven-plugin:2.11.0:set -DnewVersion=JAPICMP-OLD + mvn --batch-mode --no-transfer-progress org.codehaus.mojo:versions-maven-plugin:2.16.2:set "-DnewVersion=0.0.0-JAPICMP-OLD" # Install artifacts with dummy version in local repository; used later by Maven plugin for comparison mvn --batch-mode --no-transfer-progress install -DskipTests - - name: Checkout new version + - name: Check out new version uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 - name: Check API compatibility diff --git a/pom.xml b/pom.xml index f755076592..b5a2292138 100644 --- a/pom.xml +++ b/pom.xml @@ -477,14 +477,12 @@ ${project.groupId} ${project.artifactId} - JAPICMP-OLD + 0.0.0-JAPICMP-OLD - - - ${project.build.directory}/${project.build.finalName}.${project.packaging} - - + + + true true