mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-12-04 05:18:05 +00:00
Update to Gradle 8.x
- Update to Loom 1.2 and FG 6.0. ForgeGradle has changed how it generates the runXyz tasks, which makes running our tests much harder. I've raised an issue upstream, but for now we do some nasty poking of internals. - Fix Sodium/Iris tests. Loom 1.1 changed how remapped configurations are generated - we create a dummy source set and associate the remapped configuration with that. All nasty stuff. - Publish the common library. I'm not a fan of this, but given how much internals I'm poking elsewhere, should probably get off my high horse. - Add renderdoc support to the client gametests, enabled with -Prenderdoc.
This commit is contained in:
@@ -7,6 +7,7 @@ import cc.tweaked.gradle.clientClasses
|
||||
import cc.tweaked.gradle.commonClasses
|
||||
|
||||
plugins {
|
||||
id("cc-tweaked.publishing")
|
||||
id("cc-tweaked.vanilla")
|
||||
id("cc-tweaked.gametest")
|
||||
}
|
||||
|
||||
@@ -21,15 +21,25 @@ cct {
|
||||
}
|
||||
|
||||
fun addRemappedConfiguration(name: String) {
|
||||
// There was a regression in Loom 1.1 which means that targetConfigurationName doesn't do anything, and remap
|
||||
// configurations just get added to the main source set (https://github.com/FabricMC/fabric-loom/issues/843).
|
||||
// To get around that, we create our own source set and register a remap configuration with that. This does
|
||||
// introduce a bit of noise, but it's not the end of the world.
|
||||
val ourSourceSet = sourceSets.register(name) {
|
||||
// Try to make this source set as much of a non-entity as possible.
|
||||
listOf(allSource, java, resources, kotlin).forEach { it.setSrcDirs(emptyList<File>()) }
|
||||
}
|
||||
val capitalName = name.replaceFirstChar { it.titlecase(Locale.ROOT) }
|
||||
loom.addRemapConfiguration("mod$capitalName") {
|
||||
onCompileClasspath.set(false)
|
||||
onRuntimeClasspath.set(true)
|
||||
sourceSet.set(ourSourceSet)
|
||||
targetConfigurationName.set(name)
|
||||
}
|
||||
configurations.create(name) {
|
||||
isCanBeConsumed = false
|
||||
isCanBeResolved = true
|
||||
}
|
||||
val capitalName = name.capitalize(Locale.ROOT)
|
||||
loom.addRemapConfiguration("mod$capitalName") {
|
||||
onCompileClasspath.set(false)
|
||||
onRuntimeClasspath.set(false)
|
||||
targetConfigurationName.set(name)
|
||||
extendsFrom(configurations["${name}RuntimeClasspath"])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,8 +35,6 @@ minecraft {
|
||||
property("forge.logging.markers", "REGISTRIES")
|
||||
property("forge.logging.console.level", "debug")
|
||||
|
||||
forceExit = false
|
||||
|
||||
mods.register("computercraft") {
|
||||
cct.sourceDirectories.get().forEach {
|
||||
if (it.classes) sources(it.sourceSet)
|
||||
@@ -262,11 +260,7 @@ val runGametest by tasks.registering(JavaExec::class) {
|
||||
dependsOn("cleanRunGametest")
|
||||
usesService(MinecraftRunnerService.get(gradle))
|
||||
|
||||
// Copy from runGameTestServer. We do it in this slightly odd way as runGameTestServer
|
||||
// isn't created until the task is configured (which is no good for us).
|
||||
val exec = tasks.getByName<JavaExec>("runGameTestServer")
|
||||
dependsOn(exec.dependsOn)
|
||||
exec.copyToFull(this)
|
||||
setRunConfig(minecraft.runs["gameTestServer"])
|
||||
|
||||
systemProperty("cctest.gametest-report", project.buildDir.resolve("test-results/$name.xml").absolutePath)
|
||||
}
|
||||
@@ -275,7 +269,7 @@ tasks.check { dependsOn(runGametest) }
|
||||
|
||||
val runGametestClient by tasks.registering(ClientJavaExec::class) {
|
||||
description = "Runs client-side gametests with no mods"
|
||||
copyFrom("runTestClient")
|
||||
setRunConfig(minecraft.runs["testClient"])
|
||||
tags("client")
|
||||
}
|
||||
cct.jacoco(runGametestClient)
|
||||
|
||||
Reference in New Issue
Block a user