Add static fields for build date and commit hash
This commit is contained in:
parent
5de4616df0
commit
efb7ad89b3
2 changed files with 11 additions and 10 deletions
13
build.gradle
13
build.gradle
|
@ -155,26 +155,21 @@ installDist {
|
||||||
}
|
}
|
||||||
|
|
||||||
task processSource(type: Sync) {
|
task processSource(type: Sync) {
|
||||||
def date = new Date().format("d MMM yyyy")
|
|
||||||
def gitOutput = new ByteArrayOutputStream()
|
def gitOutput = new ByteArrayOutputStream()
|
||||||
|
|
||||||
exec {
|
exec {
|
||||||
commandLine 'git', 'describe'
|
commandLine 'git', 'rev-parse', '--short', 'HEAD'
|
||||||
standardOutput = gitOutput
|
standardOutput = gitOutput
|
||||||
errorOutput = new ByteArrayOutputStream()
|
errorOutput = new ByteArrayOutputStream()
|
||||||
ignoreExitValue = true
|
ignoreExitValue = true
|
||||||
}
|
}
|
||||||
|
|
||||||
def description = date
|
|
||||||
def tag = gitOutput.toString().trim()
|
|
||||||
|
|
||||||
// TODO: Implement extended description in Java code
|
|
||||||
if (tag) description = "$tag; $description"
|
|
||||||
|
|
||||||
from 'src'
|
from 'src'
|
||||||
|
|
||||||
filter {
|
filter {
|
||||||
line -> line.replaceAll('__builddate__', date)
|
line -> line
|
||||||
|
.replaceAll('__builddate__', new Date().format("d MMM yyyy"))
|
||||||
|
.replaceAll('__commithash__', gitOutput.toString().trim())
|
||||||
} into "${project.buildDir}/src"
|
} into "${project.buildDir}/src"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,13 @@ import helma.util.ResourceProperties;
|
||||||
*/
|
*/
|
||||||
public class Server implements Runnable {
|
public class Server implements Runnable {
|
||||||
// version string
|
// version string
|
||||||
public static final String version = "🐜 (__builddate__)";
|
public static final String version = "🐜";
|
||||||
|
|
||||||
|
// build date
|
||||||
|
public static final String buildDate = "__builddate__";
|
||||||
|
|
||||||
|
// commit hash
|
||||||
|
public static final String commitHash = "__commithash__";
|
||||||
|
|
||||||
// static server instance
|
// static server instance
|
||||||
private static Server server;
|
private static Server server;
|
||||||
|
|
Loading…
Add table
Reference in a new issue