mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-27 03:46:17 -06:00
Gradle:
- default is now Java 8 toolchain (to fix Eclipse project import) - `src/main/module-info` and `src/main/java9` are compiled with Java 11 toolchain (if global toolchain is Java 8) - `src/main/module-info` and `src/main/java9` are no longer imported into Eclipse projects - task `errorprone` now uses at least Java 11 toolchain
This commit is contained in:
@@ -18,7 +18,14 @@ plugins {
|
||||
java
|
||||
}
|
||||
|
||||
if( java.toolchain.languageVersion.get().asInt() >= 9 ) {
|
||||
// for Eclipse IDE project import, exclude if:
|
||||
// - plugin "eclipse" is applied; e.g. if running in Eclipse IDE with buildship plugin
|
||||
// - no taskNames specified at command line; e.g. if buildship synchronizes projects
|
||||
val exclude =
|
||||
rootProject.plugins.hasPlugin( "eclipse" ) &&
|
||||
gradle.startParameter.taskNames.isEmpty()
|
||||
|
||||
if( !exclude ) {
|
||||
sourceSets {
|
||||
create( "java9" ) {
|
||||
java {
|
||||
@@ -35,6 +42,13 @@ if( java.toolchain.languageVersion.get().asInt() >= 9 ) {
|
||||
named<JavaCompile>( "compileJava9Java" ) {
|
||||
sourceCompatibility = "9"
|
||||
targetCompatibility = "9"
|
||||
|
||||
// if global toolchain is Java 8, then use Java 11 to build
|
||||
if( java.toolchain.languageVersion.get().asInt() < 9 ) {
|
||||
javaCompiler.set( javaToolchains.compilerFor {
|
||||
languageVersion.set( JavaLanguageVersion.of( 11 ) )
|
||||
} )
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
|
||||
@@ -29,7 +29,14 @@ plugins {
|
||||
java
|
||||
}
|
||||
|
||||
if( java.toolchain.languageVersion.get().asInt() >= 9 ) {
|
||||
// for Eclipse IDE project import, exclude if:
|
||||
// - plugin "eclipse" is applied; e.g. if running in Eclipse IDE with buildship plugin
|
||||
// - no taskNames specified at command line; e.g. if buildship synchronizes projects
|
||||
val exclude =
|
||||
rootProject.plugins.hasPlugin( "eclipse" ) &&
|
||||
gradle.startParameter.taskNames.isEmpty()
|
||||
|
||||
if( !exclude ) {
|
||||
sourceSets {
|
||||
create( "module-info" ) {
|
||||
java {
|
||||
@@ -58,6 +65,13 @@ if( java.toolchain.languageVersion.get().asInt() >= 9 ) {
|
||||
options.compilerArgs.add( "--module-path" )
|
||||
options.compilerArgs.add( configurations.runtimeClasspath.get().asPath
|
||||
+ File.pathSeparator + configurations.compileClasspath.get().asPath )
|
||||
|
||||
// if global toolchain is Java 8, then use Java 11 to build
|
||||
if( java.toolchain.languageVersion.get().asInt() < 9 ) {
|
||||
javaCompiler.set( javaToolchains.compilerFor {
|
||||
languageVersion.set( JavaLanguageVersion.of( 11 ) )
|
||||
} )
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
|
||||
@@ -18,6 +18,8 @@ plugins {
|
||||
java
|
||||
}
|
||||
|
||||
val toolchainJavaVersion: String by rootProject.extra
|
||||
|
||||
java.toolchain {
|
||||
languageVersion = JavaLanguageVersion.of( System.getProperty( "toolchain", "11" ) )
|
||||
languageVersion = JavaLanguageVersion.of( toolchainJavaVersion )
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user