@@ -213,27 +213,31 @@ subprojects {
213
213
}
214
214
215
215
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"
220
223
}
221
- return stdout.toString().trim()
222
224
}
223
225
224
226
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
+ }
234
238
}
235
239
236
- tasks.create (" numismaticsPublish" ) {
240
+ tasks.register (" numismaticsPublish" ) {
237
241
when (val platform = System .getenv(" PLATFORM" )) {
238
242
" both" -> {
239
243
dependsOn(tasks.build, " :fabric:publish" , " :forge:publish" , " :common:publish" , " :fabric:publishMods" , " :forge:publishMods" )
0 commit comments