Skip to content

Commit a84692c

Browse files
committed
Enable config cache
1 parent 2f43123 commit a84692c

File tree

2 files changed

+20
-15
lines changed

2 files changed

+20
-15
lines changed

build.gradle.kts

+19-15
Original file line numberDiff line numberDiff line change
@@ -213,27 +213,31 @@ subprojects {
213213
}
214214

215215
fun calculateGitHash(): String {
216-
val stdout = ByteArrayOutputStream()
217-
exec {
218-
commandLine("git", "rev-parse", "HEAD")
219-
standardOutput = stdout
216+
try {
217+
val output = providers.exec {
218+
commandLine("git", "rev-parse", "HEAD")
219+
}
220+
return output.standardOutput.asText.get().trim()
221+
} catch (ignored: Throwable) {
222+
return "unknown"
220223
}
221-
return stdout.toString().trim()
222224
}
223225

224226
fun hasUnstaged(): Boolean {
225-
val stdout = ByteArrayOutputStream()
226-
exec {
227-
commandLine("git", "status", "--porcelain")
228-
standardOutput = stdout
229-
}
230-
val result = stdout.toString().replace("M gradlew", "").trimEnd()
231-
if (result.isNotEmpty())
232-
println("Found stageable results:\n${result}\n")
233-
return result.isNotEmpty()
227+
try {
228+
val output = providers.exec {
229+
commandLine("git", "status", "--porcelain")
230+
}
231+
val result = output.standardOutput.asText.get().replace("/M gradlew(\\.bat)?/", "").trim()
232+
if (result.isNotEmpty())
233+
println("Found stageable results:\n ${result}\n")
234+
return result.isNotEmpty()
235+
} catch (ignored: Throwable) {
236+
return false
237+
}
234238
}
235239

236-
tasks.create("numismaticsPublish") {
240+
tasks.register("numismaticsPublish") {
237241
when (val platform = System.getenv("PLATFORM")) {
238242
"both" -> {
239243
dependsOn(tasks.build, ":fabric:publish", ":forge:publish", ":common:publish", ":fabric:publishMods", ":forge:publishMods")

gradle.properties

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
org.gradle.jvmargs = -Xmx3G
22
org.gradle.caching = true
3+
org.gradle.configuration-cache=true
34

45
# Mod Info
56
archives_base_name = CreateNumismatics

0 commit comments

Comments
 (0)