Skip to content

Commit 84bc8de

Browse files
committed
Allow building w/ Java 17 locally
This allows contributors to build with Java 17 locally as follows: - Java 17 builds and does not use JSpecify - Java 25 builds and runs JSpecify - Java 25 w/ `jspecify.enabled=true` builds and runs JSpecify - Java 25 w/ `jspecify.enabled=false` does not JSpecify Signed-off-by: onobc <[email protected]>
1 parent ef56296 commit 84bc8de

File tree

2 files changed

+77
-41
lines changed

2 files changed

+77
-41
lines changed

.github/workflows/ci-pr.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ jobs:
1717
include:
1818
- javaVersion: 25
1919
distribution: 'liberica'
20+
- javaVersion: 17
21+
distribution: 'temurin'
2022
runs-on: ubuntu-latest
2123
steps:
2224
- uses: actions/checkout@v4

pom.xml

Lines changed: 75 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -190,47 +190,6 @@
190190
<artifactId>maven-site-plugin</artifactId>
191191
<version>${maven-site-plugin.version}</version>
192192
</plugin>
193-
<plugin>
194-
<groupId>org.apache.maven.plugins</groupId>
195-
<artifactId>maven-compiler-plugin</artifactId>
196-
<version>${maven-compiler-plugin.version}</version>
197-
<configuration>
198-
<release>${java.version}</release>
199-
<showWarnings>true</showWarnings>
200-
<compilerArgs>
201-
<compilerArg>-parameters</compilerArg>
202-
<compilerArg>-Xdoclint:none</compilerArg>
203-
<compilerArg>-Werror</compilerArg>
204-
<compilerArg>-XDcompilePolicy=simple</compilerArg>
205-
<compilerArg>--should-stop=ifError=FLOW</compilerArg>
206-
<compilerArg>
207-
-Xplugin:ErrorProne
208-
<!-- Disable all built-in error prone checks -->
209-
-XepDisableAllChecks
210-
<!-- JSpecify mode https://github.com/uber/NullAway/wiki/JSpecify-Support -->
211-
-XepOpt:NullAway:JSpecifyMode=true
212-
<!-- Check JSpecify annotations -->
213-
-Xep:NullAway:ERROR
214-
-XepOpt:NullAway:OnlyNullMarked
215-
-XepOpt:NullAway:TreatGeneratedAsUnannotated=true
216-
<!-- https://github.com/uber/NullAway/issues/162 -->
217-
-XepExcludedPaths:.*/src/test/java/.*
218-
</compilerArg>
219-
</compilerArgs>
220-
<annotationProcessorPaths>
221-
<path>
222-
<groupId>com.google.errorprone</groupId>
223-
<artifactId>error_prone_core</artifactId>
224-
<version>${error-prone.version}</version>
225-
</path>
226-
<path>
227-
<groupId>com.uber.nullaway</groupId>
228-
<artifactId>nullaway</artifactId>
229-
<version>${nullaway.version}</version>
230-
</path>
231-
</annotationProcessorPaths>
232-
</configuration>
233-
</plugin>
234193
<plugin>
235194
<groupId>org.apache.maven.plugins</groupId>
236195
<artifactId>maven-surefire-plugin</artifactId>
@@ -464,6 +423,81 @@
464423
</plugins>
465424
</build>
466425
</profile>
426+
<profile>
427+
<id>java17</id>
428+
<activation>
429+
<jdk>[17,)</jdk>
430+
</activation>
431+
<build>
432+
<plugins>
433+
<plugin>
434+
<groupId>org.apache.maven.plugins</groupId>
435+
<artifactId>maven-compiler-plugin</artifactId>
436+
<version>${maven-compiler-plugin.version}</version>
437+
<configuration>
438+
<source>${java.version}</source>
439+
<target>${java.version}</target>
440+
<compilerArgument>-parameters</compilerArgument>
441+
</configuration>
442+
</plugin>
443+
</plugins>
444+
</build>
445+
</profile>
446+
<profile>
447+
<id>jspecify</id>
448+
<activation>
449+
<jdk>[25,)</jdk>
450+
<property>
451+
<name>jspecify.enabled</name>
452+
<value>!false</value>
453+
</property>
454+
</activation>
455+
<build>
456+
<plugins>
457+
<plugin>
458+
<groupId>org.apache.maven.plugins</groupId>
459+
<artifactId>maven-compiler-plugin</artifactId>
460+
<version>${maven-compiler-plugin.version}</version>
461+
<configuration>
462+
<release>${java.version}</release>
463+
<showWarnings>true</showWarnings>
464+
<compilerArgs>
465+
<compilerArg>-parameters</compilerArg>
466+
<compilerArg>-Xdoclint:none</compilerArg>
467+
<compilerArg>-Werror</compilerArg>
468+
<compilerArg>-XDcompilePolicy=simple</compilerArg>
469+
<compilerArg>--should-stop=ifError=FLOW</compilerArg>
470+
<compilerArg>
471+
-Xplugin:ErrorProne
472+
<!-- Disable all built-in error prone checks -->
473+
-XepDisableAllChecks
474+
<!-- JSpecify mode https://github.com/uber/NullAway/wiki/JSpecify-Support -->
475+
-XepOpt:NullAway:JSpecifyMode=true
476+
<!-- Check JSpecify annotations -->
477+
-Xep:NullAway:ERROR
478+
-XepOpt:NullAway:OnlyNullMarked
479+
-XepOpt:NullAway:TreatGeneratedAsUnannotated=true
480+
<!-- https://github.com/uber/NullAway/issues/162 -->
481+
-XepExcludedPaths:.*/src/test/java/.*
482+
</compilerArg>
483+
</compilerArgs>
484+
<annotationProcessorPaths>
485+
<path>
486+
<groupId>com.google.errorprone</groupId>
487+
<artifactId>error_prone_core</artifactId>
488+
<version>${error-prone.version}</version>
489+
</path>
490+
<path>
491+
<groupId>com.uber.nullaway</groupId>
492+
<artifactId>nullaway</artifactId>
493+
<version>${nullaway.version}</version>
494+
</path>
495+
</annotationProcessorPaths>
496+
</configuration>
497+
</plugin>
498+
</plugins>
499+
</build>
500+
</profile>
467501
<profile>
468502
<id>staging</id>
469503
<distributionManagement>

0 commit comments

Comments
 (0)