mirror of
https://github.com/mingjun97/gc-mojoconsole-plus.git
synced 2024-11-23 19:06:47 +00:00
Auto inject version and git hash
This commit is contained in:
parent
6c1fad2647
commit
d0e2544883
2
.gitignore
vendored
2
.gitignore
vendored
@ -11,3 +11,5 @@ build
|
||||
|
||||
# Ignore lib
|
||||
gc-plugin/lib/
|
||||
|
||||
gc-plugin/src/main/resources/plugin.json
|
@ -19,6 +19,8 @@ plugins {
|
||||
sourceCompatibility = 17
|
||||
targetCompatibility = 17
|
||||
|
||||
def version_tag = "dev-1.1.2"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
@ -50,8 +52,24 @@ dependencies {
|
||||
|
||||
}
|
||||
|
||||
|
||||
task injectGitHash {
|
||||
def gitCommitHash = {
|
||||
try {
|
||||
return 'git rev-parse --verify --short HEAD'.execute().text.trim()
|
||||
} catch (e) {
|
||||
return "GIT_NOT_FOUND"
|
||||
}
|
||||
}
|
||||
def pluginJson = {
|
||||
return new File(projectDir, "src/main/resources/plugin.json.tmpl").text.replace("{{VERSION}}", "${version_tag}-${gitCommitHash()}")
|
||||
}
|
||||
new File(projectDir, "src/main/resources/plugin.json").text = pluginJson()
|
||||
}
|
||||
|
||||
jar {
|
||||
jar.baseName = 'mojoconsole'
|
||||
|
||||
destinationDir = file(".")
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "mojoconsole-plus",
|
||||
"description": "Grasscutter In Game Web Based Console",
|
||||
"version": "dev-1.1.2",
|
||||
"version": "{{VERSION}}",
|
||||
|
||||
"mainClass": "com.mojo.consoleplus.ConsolePlus",
|
||||
"authors": ["mingjun97"]
|
Loading…
Reference in New Issue
Block a user