Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,12 @@ if (project != rootProject) {
apply plugin: 'nebula.maven-base-publish'
apply plugin: 'nebula.maven-scm'

// we need to apply these again to override the build plugin
targetCompatibility = "10"
sourceCompatibility = "10"
// instruct the build plugin to omit the --release compiler flag so we can still compile against Java 9+ APIs
ext.useReleaseArg = false

// Keep compatibility with Java 8 for external users of build-tools that haven't migrated to Java 11
targetCompatibility = "8"
sourceCompatibility = "8"

// groovydoc succeeds, but has some weird internal exception...
groovydoc.enabled = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@ class BuildPlugin implements Plugin<Project> {
static void configureCompile(Project project) {
ExtraPropertiesExtension ext = project.extensions.getByType(ExtraPropertiesExtension)
ext.set('compactProfile', 'full')
ext.set('useReleaseArg', true)

project.extensions.getByType(JavaPluginExtension).sourceCompatibility = ext.get('minimumRuntimeVersion') as JavaVersion
project.extensions.getByType(JavaPluginExtension).targetCompatibility = ext.get('minimumRuntimeVersion') as JavaVersion
Expand Down Expand Up @@ -626,7 +627,9 @@ class BuildPlugin implements Plugin<Project> {
compileTask.options.incremental = true

// TODO: use native Gradle support for --release when available (cf. https://github.com/gradle/gradle/issues/2510)
compileTask.options.compilerArgs << '--release' << targetCompatibilityVersion.majorVersion
if (ext.get('useReleaseArg')) {
compileTask.options.compilerArgs << '--release' << targetCompatibilityVersion.majorVersion
}
}
// also apply release flag to groovy, which is used in build-tools
project.tasks.withType(GroovyCompile) { GroovyCompile compileTask ->
Expand All @@ -636,7 +639,9 @@ class BuildPlugin implements Plugin<Project> {
} else {
compileTask.options.fork = true
compileTask.options.forkOptions.javaHome = compilerJavaHome
compileTask.options.compilerArgs << '--release' << JavaVersion.toVersion(compileTask.targetCompatibility).majorVersion
if (ext.get('useReleaseArg')) {
compileTask.options.compilerArgs << '--release' << JavaVersion.toVersion(compileTask.targetCompatibility).majorVersion
}
}
}
}
Expand Down