Skip to content

Commit

Permalink
Update to loom 1.9 (#4260)
Browse files Browse the repository at this point in the history
* Update to loom 1.9 and improve task caching

* Stable
  • Loading branch information
modmuss50 authored Dec 5, 2024
1 parent 453d4f9 commit 466a140
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 43 deletions.
24 changes: 8 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
id "idea"
id "maven-publish"
id 'jacoco'
id "fabric-loom" version "1.8.13" apply false
id "fabric-loom" version "1.9.2" apply false
id "com.diffplug.spotless" version "6.20.0"
id "org.ajoberstar.grgit" version "5.2.2"
id "me.modmuss50.remotesign" version "0.4.0" apply false
Expand Down Expand Up @@ -215,7 +215,7 @@ allprojects {
}

allprojects.each { p ->
if (metaProjects.contains(project.name)) {
if (metaProjects.contains(p.name)) {
return
}

Expand Down Expand Up @@ -247,19 +247,6 @@ allprojects {

test {
useJUnitPlatform()

afterEvaluate {
// See: https://github.com/FabricMC/fabric-loader/pull/585
def classPathGroups = loom.mods.stream()
.map { modSettings ->
SourceSetHelper.getClasspath(modSettings, getProject()).stream()
.map(File.&getAbsolutePath)
.collect(Collectors.joining(File.pathSeparator))
}
.collect(Collectors.joining(File.pathSeparator+File.pathSeparator))

systemProperty("fabric.classPathGroups", classPathGroups)
}
}

tasks.withType(ProcessResources).configureEach {
Expand Down Expand Up @@ -422,7 +409,7 @@ loom {

// Enable the gametest runner
vmArg "-Dfabric-api.gametest"
vmArg "-Dfabric-api.gametest.report-file=${project.buildDir}/junit.xml"
vmArg "-Dfabric-api.gametest.report-file=${project.layout.buildDirectory.file("junit.xml").get().getAsFile()}"
runDir "build/gametest"
}
autoTestServer {
Expand Down Expand Up @@ -452,6 +439,11 @@ loom {
}
}
}

runGametest {
outputs.file project.layout.buildDirectory.file("junit.xml")
}

test.dependsOn runGametest

def coverageTasks = [
Expand Down
19 changes: 13 additions & 6 deletions fabric-biome-api-v1/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ testDependencies(project, [
':fabric-data-generation-api-v1'
])

fabricApi {
configureDataGeneration {
outputDirectory = file("src/testmod/generated")
addToResources = false
strictValidation = true
}
}

runDatagen {
outputs.dir("src/testmod/generated")
}

sourceSets {
testmod {
resources {
Expand All @@ -24,14 +36,9 @@ sourceSets {
loom {
runs {
datagen {
inherit testmodServer
name "Data Generation"
vmArg "-Dfabric-api.datagen"
vmArg "-Dfabric-api.datagen.output-dir=${file("src/testmod/generated")}"
vmArg "-Dfabric-api.datagen.strict-validation"

source sourceSets.testmod
ideConfigGenerated = true
runDir "build/datagen"
}
}
}
Expand Down
26 changes: 6 additions & 20 deletions fabric-convention-tags-v2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,12 @@ testDependencies(project, [
':fabric-lifecycle-events-v1',
])

sourceSets {
main {
resources {
srcDirs += [
'src/generated/resources'
]
}
}
datagen {
compileClasspath += main.compileClasspath
runtimeClasspath += main.runtimeClasspath
compileClasspath += main.output
runtimeClasspath += main.output
fabricApi {
configureDataGeneration {
outputDirectory = file("src/generated/resources")
strictValidation = true
createSourceSet = true
modId = "fabric-convention-tags-v2-datagen"
}
}

Expand All @@ -32,15 +25,8 @@ dependencies {
loom {
runs {
datagen {
inherit server
name "Data Generation"
vmArg "-Dfabric-api.datagen"
vmArg "-Dfabric-api.datagen.output-dir=${file("src/generated/resources")}"
vmArg "-Dfabric-api.datagen.strict-validation"

ideConfigGenerated = true
runDir "build/datagen"
source sourceSets.datagen
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions fabric-data-generation-api-v1/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ loom {
}
}

runDatagen {
outputs.dir file("src/testmod/generated")
}

runDatagenClient {
outputs.dir file("src/testmod/generated")
}

test.dependsOn runDatagenClient

tasks.register('datapackZip', Zip) {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down

0 comments on commit 466a140

Please sign in to comment.