mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-12-01 18:24:06 +00:00
Mark development builds in the console
Purple fins, DEV tag, branch and build age
This commit is contained in:
1 parent
df31f1e2e3
commit
8893432b6f
9 files changed
+226
-11
No files matched your search
@@ -235,6 +235,18 @@ tasks.named('processResources').configure { Task resources ->
|
||||
}
|
||||
def templateSource = file('src/main/templates')
|
||||
def templateDest = layout.buildDirectory.dir('generated/sources/templates')
|
||||
def sourceHashesProvided = { -> providers.environmentVariable('MULTIPLEXOR_SOURCE_HASHES').isPresent() }
|
||||
def gitOutput = { String... arguments ->
|
||||
try {
|
||||
Process process = new ProcessBuilder(['git', '-C', rootProject.projectDir.absolutePath] + arguments.toList())
|
||||
.redirectError(ProcessBuilder.Redirect.DISCARD)
|
||||
.start()
|
||||
String output = new String(process.inputStream.readAllBytes(), StandardCharsets.UTF_8).trim()
|
||||
return process.waitFor() == 0 ? output : null
|
||||
} catch (Exception ignored) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
def generateTemplates = tasks.register('generateTemplates', Copy) {
|
||||
inputs.properties([
|
||||
environment: providers.provider {
|
||||
@@ -283,6 +295,23 @@ def generateTemplates = tasks.register('generateTemplates', Copy) {
|
||||
logger.error('Git commit hash not found', failure)
|
||||
return 'unknown'
|
||||
},
|
||||
branch: providers.provider {
|
||||
if (sourceHashesProvided()) {
|
||||
return ''
|
||||
}
|
||||
String branch = gitOutput('rev-parse', '--abbrev-ref', 'HEAD')
|
||||
if (branch == null || branch == 'HEAD') {
|
||||
return ''
|
||||
}
|
||||
return branch.replace('\\', '\\\\').replace('"', '\\"')
|
||||
},
|
||||
dirty: providers.provider {
|
||||
if (sourceHashesProvided()) {
|
||||
return false
|
||||
}
|
||||
String status = gitOutput('status', '--porcelain')
|
||||
return status != null && !status.isEmpty()
|
||||
},
|
||||
minecraftVersion: providers.gradleProperty('minecraftVersion'),
|
||||
])
|
||||
|
||||
|
||||
Reference in new issue
Block a user