Skip to content

Commit

Permalink
Fix a couple of future deprecations in Gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
SquidDev committed Oct 19, 2023
1 parent ae5a661 commit e67c94d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ abstract class CCTweakedExtension(
}

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 jacoco = project.extensions.getByType(JacocoPluginExtension::class.java)
Expand All @@ -185,7 +185,7 @@ abstract class CCTweakedExtension(
jacoco.applyTo(this)
extensions.configure(JacocoTaskExtension::class.java) {
includes = listOf("dan200.computercraft.*")
classDumpDir = classDump
classDumpDir = classDump.get().asFile

// 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ abstract class ClientJavaExec : JavaExec() {
if (!clientDebug) systemProperty("cctest.client", "")
if (renderdoc) environment("LD_PRELOAD", "/usr/lib/librenderdoc.so")
systemProperty("cctest.gametest-report", testResults.get().asFile.absoluteFile)
workingDir(project.buildDir.resolve("gametest").resolve(name))
workingDir(project.layout.buildDirectory.dir("gametest/$name"))
}

init {
Expand Down
4 changes: 3 additions & 1 deletion projects/core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
//
// SPDX-License-Identifier: MPL-2.0

import cc.tweaked.gradle.getAbsolutePath

plugins {
`java-library`
`java-test-fixtures`
Expand Down Expand Up @@ -45,7 +47,7 @@ tasks.processResources {
}

tasks.test {
systemProperty("cct.test-files", buildDir.resolve("tmp/testFiles").absolutePath)
systemProperty("cct.test-files", layout.buildDirectory.dir("tmp/testFiles").getAbsolutePath())
}

tasks.testFixturesJar {
Expand Down
2 changes: 1 addition & 1 deletion projects/fabric/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ loom {
configureForGameTest(this)

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")
}
}
Expand Down
6 changes: 3 additions & 3 deletions projects/forge/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ val luaJavadoc by tasks.registering(Javadoc::class) {
source(project(":core").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

val options = options as StandardJavadocDocletOptions
Expand Down Expand Up @@ -237,7 +237,7 @@ tasks.assemble { dependsOn("jarJar") }
// Check tasks

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) {
Expand Down Expand Up @@ -266,7 +266,7 @@ val runGametest by tasks.registering(JavaExec::class) {

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)
tasks.check { dependsOn(runGametest) }
Expand Down

0 comments on commit e67c94d

Please sign in to comment.