Skip to content

Commit

Permalink
Enable gradle's configuration-cache (#3742)
Browse files Browse the repository at this point in the history
  • Loading branch information
mezz authored Sep 6, 2024
1 parent 9e851b4 commit 7b75d12
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 23 deletions.
12 changes: 11 additions & 1 deletion Forge/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import net.darkhax.curseforgegradle.TaskPublishCurseForge
import net.minecraftforge.gradle.common.tasks.DownloadMavenArtifact
import net.minecraftforge.gradle.common.tasks.JarExec
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import net.darkhax.curseforgegradle.Constants as CFG_Constants
Expand Down Expand Up @@ -148,7 +150,7 @@ tasks.withType<JavaCompile>().configureEach {
}
}

tasks.processResources {
tasks.withType<ProcessResources> {
dependencyProjects.forEach {
from(it.sourceSets.main.get().resources)
}
Expand Down Expand Up @@ -247,3 +249,11 @@ sourceSets.forEach {
it.output.setResourcesDir(outputDir)
it.java.destinationDirectory.set(outputDir)
}

tasks.withType<DownloadMavenArtifact> {
notCompatibleWithConfigurationCache("uses Task.project at execution time")
}

tasks.withType<JarExec> {
notCompatibleWithConfigurationCache("uses external process at execution time")
}
6 changes: 6 additions & 0 deletions ForgeApi/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import net.minecraftforge.gradle.common.tasks.DownloadMavenArtifact

plugins {
id("java")
id("idea")
Expand Down Expand Up @@ -120,3 +122,7 @@ publishing {
}
}
}

tasks.withType<DownloadMavenArtifact> {
notCompatibleWithConfigurationCache("uses Task.project at execution time")
}
2 changes: 1 addition & 1 deletion NeoForge/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ tasks.withType<JavaCompile>().configureEach {
}
}

tasks.withType<ProcessResources>().configureEach {
tasks.withType<ProcessResources> {
dependencyProjects.forEach {
from(it.sourceSets.main.get().resources)
}
Expand Down
41 changes: 20 additions & 21 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -101,28 +101,27 @@ subprojects {
}

tasks.withType<ProcessResources> {
// this will ensure that this task is redone when the versions change.
inputs.property("version", version)

val properties = mapOf(
"curseHomepageUrl" to curseHomepageUrl,
"fabricApiVersion" to fabricApiVersion,
"fabricLoaderVersion" to fabricLoaderVersion,
"forgeVersionRange" to forgeVersionRange,
"githubUrl" to githubUrl,
"forgeLoaderVersionRange" to forgeLoaderVersionRange,
"neoforgeVersionRange" to neoforgeVersionRange,
"neoforgeLoaderVersionRange" to neoforgeLoaderVersionRange,
"minecraftVersion" to minecraftVersion,
"minecraftVersionRange" to minecraftVersionRange,
"modAuthor" to modAuthor,
"modDescription" to modDescription,
"modId" to modId,
"modJavaVersion" to modJavaVersion,
"modName" to modName,
"version" to version,
)
inputs.properties(properties)
filesMatching(listOf("META-INF/mods.toml", "META-INF/neoforge.mods.toml", "pack.mcmeta", "fabric.mod.json")) {
expand(mapOf(
"curseHomepageUrl" to curseHomepageUrl,
"fabricApiVersion" to fabricApiVersion,
"fabricLoaderVersion" to fabricLoaderVersion,
"forgeVersionRange" to forgeVersionRange,
"githubUrl" to githubUrl,
"forgeLoaderVersionRange" to forgeLoaderVersionRange,
"neoforgeVersionRange" to neoforgeVersionRange,
"neoforgeLoaderVersionRange" to neoforgeLoaderVersionRange,
"minecraftVersion" to minecraftVersion,
"minecraftVersionRange" to minecraftVersionRange,
"modAuthor" to modAuthor,
"modDescription" to modDescription,
"modId" to modId,
"modJavaVersion" to modJavaVersion,
"modName" to modName,
"version" to version,
))
expand(properties)
}
}

Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ org.gradle.daemon=true
# Disabled because this breaks ForgeGradle tasks
org.gradle.configureondemand=false
org.gradle.caching=true
org.gradle.configuration-cache=true
org.gradle.configuration-cache.problems=warn

# JEI
modName=Just Enough Items
Expand Down

0 comments on commit 7b75d12

Please sign in to comment.