Skip to content

Commit a9b3a42

Browse files
Fix Ant build failures on JDK 9+ by injecting javac properties
Modified .github/workflows/pr.yml to pass -Djavac.source=1.8 -Djavac.target=1.8 to Ant commands when running on JDK 9+ (i.e., non-JDK 8 builds). This overrides the project.properties setting (1.6) which caused 'Source option 6 is no longer supported' errors on modern JDKs, while preserving the legacy configuration for the default JDK 8 pipeline.
1 parent 013fda2 commit a9b3a42

File tree

1 file changed

+30
-5
lines changed

1 file changed

+30
-5
lines changed

.github/workflows/pr.yml

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,19 @@ jobs:
229229
unzip master.zip -d ..
230230
mv ../cn1-binaries-master ../cn1-binaries
231231
- name: Build with Ant
232-
run: xvfb-run ant test-javase
232+
run: |
233+
ANT_OPTS_ARGS=""
234+
if [ "${{ matrix.java-version }}" != "8" ]; then
235+
ANT_OPTS_ARGS="-Djavac.source=1.8 -Djavac.target=1.8"
236+
fi
237+
xvfb-run ant $ANT_OPTS_ARGS test-javase
233238
- name: Build CLDC11 JAR
234-
run: ant -noinput -buildfile Ports/CLDC11/build.xml jar
239+
run: |
240+
ANT_OPTS_ARGS=""
241+
if [ "${{ matrix.java-version }}" != "8" ]; then
242+
ANT_OPTS_ARGS="-Djavac.source=1.8 -Djavac.target=1.8"
243+
fi
244+
ant $ANT_OPTS_ARGS -noinput -buildfile Ports/CLDC11/build.xml jar
235245
236246
- name: Build Release
237247
if: matrix.java-version == 8
@@ -253,7 +263,12 @@ jobs:
253263
cd ..
254264
255265
- name: Build iOS Port
256-
run: ant -noinput -buildfile Ports/iOSPort/build.xml jar
266+
run: |
267+
ANT_OPTS_ARGS=""
268+
if [ "${{ matrix.java-version }}" != "8" ]; then
269+
ANT_OPTS_ARGS="-Djavac.source=1.8 -Djavac.target=1.8"
270+
fi
271+
ant $ANT_OPTS_ARGS -noinput -buildfile Ports/iOSPort/build.xml jar
257272
258273
- name: Build iOS VM API
259274
run: mvn -f vm/JavaAPI/pom.xml package
@@ -269,7 +284,12 @@ jobs:
269284
run: mvn -f vm/ByteCodeTranslator/pom.xml package
270285

271286
- name: Build CLDC 11 VM
272-
run: ant -noinput -buildfile Ports/CLDC11/build.xml jar
287+
run: |
288+
ANT_OPTS_ARGS=""
289+
if [ "${{ matrix.java-version }}" != "8" ]; then
290+
ANT_OPTS_ARGS="-Djavac.source=1.8 -Djavac.target=1.8"
291+
fi
292+
ant $ANT_OPTS_ARGS -noinput -buildfile Ports/CLDC11/build.xml jar
273293
274294
- name: Upload a Build Artifact
275295
if: matrix.java-version == 8
@@ -286,7 +306,12 @@ jobs:
286306
path: Ports/CLDC11/dist/CLDC11.jar
287307

288308
- name: Build Android Port
289-
run: ant -noinput -buildfile Ports/Android/build.xml jar
309+
run: |
310+
ANT_OPTS_ARGS=""
311+
if [ "${{ matrix.java-version }}" != "8" ]; then
312+
ANT_OPTS_ARGS="-Djavac.source=1.8 -Djavac.target=1.8"
313+
fi
314+
ant $ANT_OPTS_ARGS -noinput -buildfile Ports/Android/build.xml jar
290315
291316
- name: Packaging Everything
292317
if: matrix.java-version == 8

0 commit comments

Comments
 (0)