@@ -147,15 +147,32 @@ jobs:
147147 echo "plugin_directory=josm/plugins/${{ inputs.plugin-directory }}" >> $GITHUB_OUTPUT
148148
149149 - name : Build with Ant
150+ id : build-ant
151+ # Don't build with ant if we can build with maven
152+ if : ${{ hashFiles('josm/plugins/${{ inputs.plugin-directory }}/build.xml') != '' && hashFiles('josm/plugins/${{ inputs.plugin-directory }}/pom.xml') == ''}}
150153 run : |
154+ # Note: This should be deprecated at some point.
151155 cd $GITHUB_WORKSPACE/josm/plugins/${{ inputs.plugin-directory }}
152156 ant -noinput -buildfile build.xml -Dplugin.version=${{ steps.version.outputs.version }}
153157
158+ - name : Build with maven
159+ if : ${{ hashFiles('josm/plugins/${{ inputs.plugin-directory }}/pom.xml') != '' }}
160+ run : |
161+ cd $GITHUB_WORKSPACE/josm/plugins/${{ inputs.plugin-directory }}
162+ mvn --file ../pom.xml package install --projects org.openstreetmap.josm:josm,org.openstreetmap.josm:josm-unittest -DskipTests
163+ mvn --file pom.xml -Dplugin.version=${{ steps.version.outputs.version }} javadoc:jar sources:jar -DskipTests
164+
154165 - name : Perform attestation
155166 if : ${{ startsWith(github.ref, 'refs/tags/') || inputs.perform-revision-tagging }}
156167 uses : actions/attest-build-provenance@v1
157168 with :
158- subject-path : josm/dist/${{ inputs.plugin-jar-name }}.jar, josm/dist/${{ inputs.plugin-jar-name }}-sources.jar, josm/dist/${{ inputs.plugin-jar-name }}-javadoc.jar
169+ subject-path : |
170+ josm/dist/${{ inputs.plugin-jar-name }}.jar
171+ josm/dist/${{ inputs.plugin-jar-name }}-sources.jar
172+ josm/dist/${{ inputs.plugin-jar-name }}-javadoc.jar
173+ josm/distMaven/${{ inputs.plugin-jar-name }}.jar
174+ josm/plugins/${{ inputs.plugin-directory }}/target/${{ inputs.plugin-jar-name }}-*-sources.jar
175+ josm/plugins/${{ inputs.plugin-directory }}/target/${{ inputs.plugin-jar-name }}-*-javadoc.jar
159176
160177 - name : Upload plugin build
161178 id : cache-plugin-build
@@ -166,6 +183,9 @@ jobs:
166183 josm/dist/${{ inputs.plugin-jar-name }}.jar
167184 josm/dist/${{ inputs.plugin-jar-name }}-javadoc.jar
168185 josm/dist/${{ inputs.plugin-jar-name }}-sources.jar
186+ josm/distMaven/${{ inputs.plugin-jar-name }}.jar
187+ josm/plugins/${{ inputs.plugin-directory }}/target/${{ inputs.plugin-jar-name }}-*-sources.jar
188+ josm/plugins/${{ inputs.plugin-directory }}/target/${{ inputs.plugin-jar-name }}-*-javadoc.jar
169189
170190 plugin-test :
171191 runs-on : ${{ inputs.operating-system }}
@@ -209,17 +229,23 @@ jobs:
209229 ~/.ivy2/cache/
210230 ~/.ant/cache
211231
212- - name : Test with Ant
213- id : ant-test
232+ - name : Test
214233 run : |
215234 cd $GITHUB_WORKSPACE/josm/plugins/${{ inputs.plugin-directory }}
216235 # Not all plugins have tests.
217236 if [ -d "test" ]; then TEST_REPORT_PATH="test/report"; elif [ -d "src/test" ]; then TEST_REPORT_PATH="src/test/report"; else exit 0; fi
218- echo "TEST_REPORT_PATH=${TEST_REPORT_PATH}" >> $GITHUB_ENV
219237
220- ant -diagnostics
221-
222- ant -noinput -buildfile build.xml -Dplugin.version=$version -Dtest.headless=true test
238+ if [ -f "pom.xml" ]; then
239+ echo "TEST_REPORT_PATH=target/surefire-reports" >> $GITHUB_ENV
240+ mvn test
241+ elif [ -f "build.xml" ]; then
242+ echo "TEST_REPORT_PATH=${TEST_REPORT_PATH}" >> $GITHUB_ENV
243+ ant -diagnostics
244+ ant -noinput -buildfile build.xml -Dplugin.version=$version -Dtest.headless=true test
245+ else
246+ # Fail since we don't have a build target.
247+ exit 1
248+ fi
223249
224250 - name : Upload Ant reports
225251 if : ${{ always() }}
0 commit comments