1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-10-21 17:07:39 +00:00

Fix a couple of future deprecations in Gradle

This commit is contained in:
Jonathan Coates
2023-10-19 18:28:15 +01:00
parent ae5a661a47
commit e67c94d1bd
5 changed files with 10 additions and 8 deletions

View File

@@ -173,7 +173,7 @@ abstract class CCTweakedExtension(
} }
fun <T> jacoco(task: NamedDomainObjectProvider<T>) where T : Task, T : JavaForkOptions { fun <T> jacoco(task: NamedDomainObjectProvider<T>) where T : Task, T : JavaForkOptions {
val classDump = project.buildDir.resolve("jacocoClassDump/${task.name}") val classDump = project.layout.buildDirectory.dir("jacocoClassDump/${task.name}")
val reportTaskName = "jacoco${task.name.capitalized()}Report" val reportTaskName = "jacoco${task.name.capitalized()}Report"
val jacoco = project.extensions.getByType(JacocoPluginExtension::class.java) val jacoco = project.extensions.getByType(JacocoPluginExtension::class.java)
@@ -185,7 +185,7 @@ abstract class CCTweakedExtension(
jacoco.applyTo(this) jacoco.applyTo(this)
extensions.configure(JacocoTaskExtension::class.java) { extensions.configure(JacocoTaskExtension::class.java) {
includes = listOf("dan200.computercraft.*") includes = listOf("dan200.computercraft.*")
classDumpDir = classDump classDumpDir = classDump.get().asFile
// Older versions of modlauncher don't include a protection domain (and thus no code // Older versions of modlauncher don't include a protection domain (and thus no code
// source). Jacoco skips such classes by default, so we need to explicitly include them. // source). Jacoco skips such classes by default, so we need to explicitly include them.

View File

@@ -58,7 +58,7 @@ abstract class ClientJavaExec : JavaExec() {
if (!clientDebug) systemProperty("cctest.client", "") if (!clientDebug) systemProperty("cctest.client", "")
if (renderdoc) environment("LD_PRELOAD", "/usr/lib/librenderdoc.so") if (renderdoc) environment("LD_PRELOAD", "/usr/lib/librenderdoc.so")
systemProperty("cctest.gametest-report", testResults.get().asFile.absoluteFile) systemProperty("cctest.gametest-report", testResults.get().asFile.absoluteFile)
workingDir(project.buildDir.resolve("gametest").resolve(name)) workingDir(project.layout.buildDirectory.dir("gametest/$name"))
} }
init { init {

View File

@@ -2,6 +2,8 @@
// //
// SPDX-License-Identifier: MPL-2.0 // SPDX-License-Identifier: MPL-2.0
import cc.tweaked.gradle.getAbsolutePath
plugins { plugins {
`java-library` `java-library`
`java-test-fixtures` `java-test-fixtures`
@@ -45,7 +47,7 @@ tasks.processResources {
} }
tasks.test { tasks.test {
systemProperty("cct.test-files", buildDir.resolve("tmp/testFiles").absolutePath) systemProperty("cct.test-files", layout.buildDirectory.dir("tmp/testFiles").getAbsolutePath())
} }
tasks.testFixturesJar { tasks.testFixturesJar {

View File

@@ -169,7 +169,7 @@ loom {
configureForGameTest(this) configureForGameTest(this)
property("fabric-api.gametest") property("fabric-api.gametest")
property("fabric-api.gametest.report-file", project.buildDir.resolve("test-results/runGametest.xml").absolutePath) property("fabric-api.gametest.report-file", layout.buildDirectory.dir("test-results/runGametest.xml").getAbsolutePath())
runDir("run/gametest") runDir("run/gametest")
} }
} }

View File

@@ -185,7 +185,7 @@ val luaJavadoc by tasks.registering(Javadoc::class) {
source(project(":core").sourceSets.main.get().java) source(project(":core").sourceSets.main.get().java)
source(project(":common").sourceSets.main.get().java) source(project(":common").sourceSets.main.get().java)
setDestinationDir(buildDir.resolve("docs/luaJavadoc")) destinationDir = layout.buildDirectory.dir("docs/luaJavadoc").get().asFile
classpath = sourceSets.main.get().compileClasspath classpath = sourceSets.main.get().compileClasspath
val options = options as StandardJavadocDocletOptions val options = options as StandardJavadocDocletOptions
@@ -237,7 +237,7 @@ tasks.assemble { dependsOn("jarJar") }
// Check tasks // Check tasks
tasks.test { tasks.test {
systemProperty("cct.test-files", buildDir.resolve("tmp/testFiles").absolutePath) systemProperty("cct.test-files", layout.buildDirectory.dir("tmp/testFiles").getAbsolutePath())
} }
val lintLua by tasks.registering(IlluaminateExec::class) { val lintLua by tasks.registering(IlluaminateExec::class) {
@@ -266,7 +266,7 @@ val runGametest by tasks.registering(JavaExec::class) {
setRunConfig(minecraft.runs["gameTestServer"]) setRunConfig(minecraft.runs["gameTestServer"])
systemProperty("cctest.gametest-report", project.buildDir.resolve("test-results/$name.xml").absolutePath) systemProperty("cctest.gametest-report", layout.buildDirectory.dir("test-results/$name.xml").getAbsolutePath())
} }
cct.jacoco(runGametest) cct.jacoco(runGametest)
tasks.check { dependsOn(runGametest) } tasks.check { dependsOn(runGametest) }