Build Java8-compatible release (#1586)

* Build Java8-compatible release

Use the new options.release Gradle property to make sure builds are
compatible with Java 8, which is the runtime on Appengine.

This new property replaces sourceCompatibility, targetCompatibility, and
bootclasspath (wasn't previously set, which is the reason why we
couldn't detect Java9 api usage when building).
This commit is contained in:
Weimin Yu 2022-04-11 11:00:00 -04:00 committed by GitHub
parent d5f2529b07
commit 980ae68dc7
3 changed files with 7 additions and 10 deletions

View file

@ -331,6 +331,13 @@ subprojects {
apply from: "${rootDir.path}/java_common.gradle" apply from: "${rootDir.path}/java_common.gradle"
if (project.name != 'docs') {
compileJava {
// TODO: Remove this once we migrate off AppEngine.
options.release = 8
}
}
if (project.name == 'third_party') return if (project.name == 'third_party') return
project.tasks.test.dependsOn runPresubmits project.tasks.test.dependsOn runPresubmits

View file

@ -37,9 +37,6 @@ test {
useJUnitPlatform() useJUnitPlatform()
} }
sourceCompatibility = '11'
targetCompatibility = '11'
task flowDocsTool(type: JavaExec) { task flowDocsTool(type: JavaExec) {
systemProperty 'test.projectRoot', rootProject.projectRootDir systemProperty 'test.projectRoot', rootProject.projectRootDir
jvmArgs = ['--add-exports', 'jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED'] jvmArgs = ['--add-exports', 'jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED']

View file

@ -128,13 +128,6 @@ tasks.withType(JavaCompile).configureEach {
} }
} }
// TODO: Change source version to 11 after target version is changed to 11 and
// once we figure out what's wrong with Dagger compilation with source version
// >8.
sourceCompatibility = '8'
// TODO: Change target version to 11. Source version can stay at 8.
targetCompatibility = '8'
compileJava { options.encoding = "UTF-8" } compileJava { options.encoding = "UTF-8" }
compileTestJava { options.encoding = "UTF-8" } compileTestJava { options.encoding = "UTF-8" }