Merge pull request #18527 from rjernst/java9_release
Build: Use -release with java 9 instead of -source/-target
This commit is contained in:
commit
a862feab6b
|
@ -144,6 +144,14 @@ subprojects {
|
|||
// see https://discuss.gradle.org/t/add-custom-javadoc-option-that-does-not-take-an-argument/5959
|
||||
javadoc.options.encoding='UTF8'
|
||||
javadoc.options.addStringOption('Xdoclint:all,-missing', '-quiet')
|
||||
/*
|
||||
TODO: building javadocs with java 9 b118 is currently broken with weird errors, so
|
||||
for now this is commented out...try again with the next ea build...
|
||||
javadoc.executable = new File(project.javaHome, 'bin/javadoc')
|
||||
if (project.javaVersion == JavaVersion.VERSION_1_9) {
|
||||
// TODO: remove this hack! gradle should be passing this...
|
||||
javadoc.options.addStringOption('source', '8')
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -143,7 +143,7 @@ class BuildPlugin implements Plugin<Project> {
|
|||
}
|
||||
|
||||
project.rootProject.ext.javaHome = javaHome
|
||||
project.rootProject.ext.javaVersion = javaVersion
|
||||
project.rootProject.ext.javaVersion = javaVersionEnum
|
||||
project.rootProject.ext.buildChecksDone = true
|
||||
}
|
||||
project.targetCompatibility = minimumJava
|
||||
|
@ -387,10 +387,13 @@ class BuildPlugin implements Plugin<Project> {
|
|||
options.encoding = 'UTF-8'
|
||||
//options.incremental = true
|
||||
|
||||
// gradle ignores target/source compatibility when it is "unnecessary", but since to compile with
|
||||
// java 9, gradle is running in java 8, it incorrectly thinks it is unnecessary
|
||||
if (project.javaVersion == JavaVersion.VERSION_1_9) {
|
||||
// hack until gradle supports java 9's new "-release" arg
|
||||
assert minimumJava == JavaVersion.VERSION_1_8
|
||||
options.compilerArgs << '-target' << '1.8' << '-source' << '1.8'
|
||||
options.compilerArgs << '-release' << '8'
|
||||
project.sourceCompatibility = null
|
||||
project.targetCompatibility = null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue