@@ -9,12 +9,24 @@ plugins {
99apply plugin : ' java'
1010
1111ext {
12- assert JavaVersion . current() == JavaVersion . VERSION_1_8 : " Set JAVA_HOME to JDK 8. Current version is ${ JavaVersion.current() } "
12+ isJava8 = JavaVersion . current() == JavaVersion . VERSION_1_8
1313 jsr308 = file(new File (" .." )). absolutePath
1414 cfPath = " ${ jsr308} /checker-framework"
1515 cfiPath = " ${ jsr308} /checker-framework-inference"
1616 afu = " ${ jsr308} /annotation-tools/annotation-file-utilities"
1717 picoPath = " ${ jsr308} /immutability"
18+ compilerArgsForRunningCF = [
19+ // Keep in sync with checker-framework/build.gradle.
20+ " --add-exports" , " jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED" ,
21+ " --add-exports" , " jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED" ,
22+ " --add-exports" , " jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED" ,
23+ " --add-exports" , " jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED" ,
24+ " --add-exports" , " jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED" ,
25+ " --add-exports" , " jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED" ,
26+ " --add-exports" , " jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED" ,
27+ " --add-exports" , " jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED" ,
28+ " --add-opens" , " jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED" ,
29+ ]
1830}
1931
2032println ' ==================================='
@@ -96,7 +108,11 @@ afterEvaluate {
96108
97109 environment " external_checker_classpath" , " ${ picoPath} /build/classes/java/main:${ picoPath} /build/resources/main"
98110
99- jvmArgs " -Xbootclasspath/p:${ cfiPath} /dist/javac.jar"
111+ if (isJava8) {
112+ jvmArgs " -Xbootclasspath/p:${ cfiPath} /dist/javac.jar"
113+ } else {
114+ jvmArgs + = compilerArgsForRunningCF
115+ }
100116
101117 testLogging {
102118 // Always run the tests
0 commit comments