diff options
author | Juuxel <6596629+Juuxel@users.noreply.github.com> | 2021-11-22 12:11:15 +0200 |
---|---|---|
committer | Juuxel <6596629+Juuxel@users.noreply.github.com> | 2021-11-22 12:11:15 +0200 |
commit | de9289ca6f9a5fdc5fc575e0226fbdb4e4d83c31 (patch) | |
tree | 89a4a062181e2d6cbb7bb5ed6dc9e92f2c4f0ec7 | |
parent | 463c19b2564e6abd9b29a131a363f3ef6c9938e9 (diff) | |
download | LibGui-de9289ca6f9a5fdc5fc575e0226fbdb4e4d83c31.tar.gz LibGui-de9289ca6f9a5fdc5fc575e0226fbdb4e4d83c31.tar.bz2 LibGui-de9289ca6f9a5fdc5fc575e0226fbdb4e4d83c31.zip |
Use java toolchains
-rw-r--r-- | GuiTest/build.gradle | 3 | ||||
-rw-r--r-- | build.gradle | 19 | ||||
-rw-r--r-- | javadoc/build.gradle | 3 |
3 files changed, 16 insertions, 9 deletions
diff --git a/GuiTest/build.gradle b/GuiTest/build.gradle index 429a718..17d3faa 100644 --- a/GuiTest/build.gradle +++ b/GuiTest/build.gradle @@ -2,9 +2,6 @@ plugins { id 'fabric-loom' } -sourceCompatibility = JavaVersion.VERSION_16 -targetCompatibility = JavaVersion.VERSION_16 - if(rootProject.file('private.gradle').exists()) { //Publishing details apply from: rootProject.file('private.gradle') } diff --git a/build.gradle b/build.gradle index 39c5940..5f2f9de 100644 --- a/build.gradle +++ b/build.gradle @@ -5,9 +5,6 @@ plugins { id 'checkstyle' } -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 - if(rootProject.file('private.gradle').exists()) { //Publishing details apply from: 'private.gradle' } @@ -61,6 +58,22 @@ java { withJavadocJar() } +allprojects { + plugins.withId('java') { // when the java plugin is applied in the project + java { + // Use Java 17 toolchain if running on older version of Java, but allow newer versions + if (!JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) { + toolchain { + languageVersion = JavaLanguageVersion.of(17) + } + } else { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + } + } +} + tasks.withType(JavaCompile) { // ensure that the encoding is set to UTF-8, no matter what the system default is // this fixes some edge cases with special characters not displaying correctly diff --git a/javadoc/build.gradle b/javadoc/build.gradle index e8300bb..bde068f 100644 --- a/javadoc/build.gradle +++ b/javadoc/build.gradle @@ -1,6 +1,3 @@ plugins { id 'java' } - -sourceCompatibility = rootProject.sourceCompatibility -targetCompatibility = rootProject.targetCompatibility |