Merge pull request #18527 from rjernst/java9_release

Build: Use -release with java 9 instead of -source/-target
This commit is contained in:
Ryan Ernst 2016-05-23 12:52:19 -07:00
commit a862feab6b
2 changed files with 16 additions and 5 deletions

View File

@ -144,6 +144,14 @@ subprojects {
// see https://discuss.gradle.org/t/add-custom-javadoc-option-that-does-not-take-an-argument/5959 // see https://discuss.gradle.org/t/add-custom-javadoc-option-that-does-not-take-an-argument/5959
javadoc.options.encoding='UTF8' javadoc.options.encoding='UTF8'
javadoc.options.addStringOption('Xdoclint:all,-missing', '-quiet') 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')
}*/
} }
} }

View File

@ -143,7 +143,7 @@ class BuildPlugin implements Plugin<Project> {
} }
project.rootProject.ext.javaHome = javaHome project.rootProject.ext.javaHome = javaHome
project.rootProject.ext.javaVersion = javaVersion project.rootProject.ext.javaVersion = javaVersionEnum
project.rootProject.ext.buildChecksDone = true project.rootProject.ext.buildChecksDone = true
} }
project.targetCompatibility = minimumJava project.targetCompatibility = minimumJava
@ -387,10 +387,13 @@ class BuildPlugin implements Plugin<Project> {
options.encoding = 'UTF-8' options.encoding = 'UTF-8'
//options.incremental = true //options.incremental = true
// gradle ignores target/source compatibility when it is "unnecessary", but since to compile with if (project.javaVersion == JavaVersion.VERSION_1_9) {
// java 9, gradle is running in java 8, it incorrectly thinks it is unnecessary // hack until gradle supports java 9's new "-release" arg
assert minimumJava == JavaVersion.VERSION_1_8 assert minimumJava == JavaVersion.VERSION_1_8
options.compilerArgs << '-target' << '1.8' << '-source' << '1.8' options.compilerArgs << '-release' << '8'
project.sourceCompatibility = null
project.targetCompatibility = null
}
} }
} }
} }