From 5a08176a8576dd0875fb7180b24f7afab0abbbe6 Mon Sep 17 00:00:00 2001 From: darkweird Date: Thu, 6 Jul 2023 14:26:45 +0300 Subject: [PATCH] build(bumpup-gradle): upgrade gradle and code for it. --- .../src/main/kotlin/terasology-module.gradle.kts | 4 ++-- build.gradle | 14 +++++++------- config/gradle/common.gradle | 8 ++++---- engine-tests/build.gradle | 4 ++-- engine/build.gradle | 6 +----- facades/TeraEd/build.gradle | 4 ++-- gradle/wrapper/gradle-wrapper.properties | 2 +- subsystems/build.gradle | 2 +- 8 files changed, 20 insertions(+), 24 deletions(-) diff --git a/build-logic/src/main/kotlin/terasology-module.gradle.kts b/build-logic/src/main/kotlin/terasology-module.gradle.kts index a92054aa69e..1f850654e46 100644 --- a/build-logic/src/main/kotlin/terasology-module.gradle.kts +++ b/build-logic/src/main/kotlin/terasology-module.gradle.kts @@ -28,10 +28,10 @@ apply(from = "$rootDir/config/gradle/publish.gradle") // Handle some logic related to where what is configure { main { - java.outputDir = buildDir.resolve("classes") + java.destinationDirectory.set(buildDir.resolve("classes")) } test { - java.outputDir = buildDir.resolve("testClasses") + java.destinationDirectory.set(buildDir.resolve("testClasses")) } } diff --git a/build.gradle b/build.gradle index 4d01409dc25..59361245cf1 100644 --- a/build.gradle +++ b/build.gradle @@ -63,7 +63,7 @@ import static org.gradle.internal.logging.text.StyledTextOutput.Style // Test for right version of Java in use for running this script assert org.gradle.api.JavaVersion.current().isJava11Compatible() -if(!(JavaVersion.current() == JavaVersion.VERSION_11)) { +if (!(JavaVersion.current() == JavaVersion.VERSION_11)) { def out = services.get(StyledTextOutputFactory).create("an-ouput") out.withStyle(Style.FailureHeader).println(""" WARNING: Compiling with a JDK of not version 11. While some other Javas may be @@ -102,7 +102,7 @@ configurations { dependencies { // For the "natives" configuration make it depend on the native files from LWJGL natives platform("org.lwjgl:lwjgl-bom:$LwjglVersion") - ["natives-linux","natives-windows","natives-macos"].forEach { + ["natives-linux", "natives-windows", "natives-macos"].forEach { natives "org.lwjgl:lwjgl::$it" natives "org.lwjgl:lwjgl-assimp::$it" natives "org.lwjgl:lwjgl-glfw::$it" @@ -158,12 +158,12 @@ task extractJNLuaNatives(type: Copy) { into("$dirNatives") } -task extractNativeBulletNatives(type:Copy) { +task extractNativeBulletNatives(type: Copy) { description = "Extracts the JNBullet natives from the downloaded zip" from { configurations.natives.collect { it.getName().contains('JNBullet') ? zipTree(it) : [] } } - into ("$dirNatives") + into("$dirNatives") } @@ -202,8 +202,8 @@ clean.doLast { allprojects { configurations.all { resolutionStrategy.dependencySubstitution { - substitute module("org.terasology.engine:engine") because "we have sources!" with project(":engine") - substitute module("org.terasology.engine:engine-tests") because "we have sources!" with project(":engine-tests") + substitute module("org.terasology.engine:engine") using project(":engine") because "we have sources!" + substitute module("org.terasology.engine:engine-tests") using project(":engine-tests") because "we have sources!" } } } @@ -214,7 +214,7 @@ project(":modules").subprojects.forEach { proj -> project(":modules").subprojects { configurations.all { resolutionStrategy.dependencySubstitution { - substitute module("org.terasology.modules:${proj.name}") because "we have sources!" with project(":modules:${proj.name}") + substitute module("org.terasology.modules:${proj.name}") using project(":modules:${proj.name}") because "we have sources!" } } } diff --git a/config/gradle/common.gradle b/config/gradle/common.gradle index 302006bdd59..023cd32bc8a 100644 --- a/config/gradle/common.gradle +++ b/config/gradle/common.gradle @@ -56,7 +56,7 @@ test { // showStandardStreams: makes the standard streams (err and out) visible at console when running tests testLogging.showStandardStreams = true reports { - junitXml.enabled = true +// junitXml.enabled = true } // Arguments to include while running tests jvmArgs '-Xms512m', '-Xmx1024m' @@ -80,9 +80,9 @@ jacocoTestReport { dependsOn test // Despite doc saying this should be automatic we need to explicitly add it anyway :-( reports { // Used to be exec, but that had a binary incompatibility between JaCoCo 0.7.4 and 0.7.5 and issues with some plugins - xml.enabled true - csv.enabled false - html.enabled true +// xml.enabled true +// csv.enabled false +// html.enabled true } } diff --git a/engine-tests/build.gradle b/engine-tests/build.gradle index 0f6de9e0d88..b156d0dfcc7 100644 --- a/engine-tests/build.gradle +++ b/engine-tests/build.gradle @@ -44,8 +44,8 @@ println "Version for $project.name loaded as $version for group $group" sourceSets { // Adjust output path (changed with the Gradle 6 upgrade, this puts it back) - main.java.outputDir = new File("$buildDir/classes") - test.java.outputDir = new File("$buildDir/testClasses") + main.java.destinationDirectory = new File("$buildDir/classes") + test.java.destinationDirectory = new File("$buildDir/testClasses") } // Primary dependencies definition diff --git a/engine/build.gradle b/engine/build.gradle index 2bad356f42d..2e6747da1d6 100644 --- a/engine/build.gradle +++ b/engine/build.gradle @@ -44,7 +44,7 @@ sourceSets { } java { // Adjust output path (changed with the Gradle 6 upgrade, this puts it back) - outputDir = new File("$buildDir/classes") + destinationDirectory = new File("$buildDir/classes") } } } @@ -263,10 +263,6 @@ task copyResourcesToClasses(type: Copy) { mustRunAfter compileJava } -tasks.named("classes") { - dependsOn(tasks.named("copyResourcesToClasses")) -} - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // General IDE customization // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/facades/TeraEd/build.gradle b/facades/TeraEd/build.gradle index 4b1f24b7228..772770c6f65 100644 --- a/facades/TeraEd/build.gradle +++ b/facades/TeraEd/build.gradle @@ -19,8 +19,8 @@ group = 'org.terasology.facades' sourceSets { // Adjust output path (changed with the Gradle 6 upgrade, this puts it back) - main.java.outputDir = new File("$buildDir/classes") - test.java.outputDir = new File("$buildDir/testClasses") + main.java.destinationDirectory = new File("$buildDir/classes") + test.java.destinationDirectory = new File("$buildDir/testClasses") } dependencies { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 25d3265315f..b93c46a5fcc 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/subsystems/build.gradle b/subsystems/build.gradle index 0e6771f98f1..cb50dc0bdc5 100644 --- a/subsystems/build.gradle +++ b/subsystems/build.gradle @@ -9,7 +9,7 @@ subprojects { def sourceSets = project.getConvention().getPlugin(JavaPluginConvention.class).sourceSets - sourceSets.main.java.outputDir = new File("$buildDir/classes") + sourceSets.main.java.destinationDirectory = new File("$buildDir/classes") idea { module { // Change around the output a bit