为版本号添加提交hash

This commit is contained in:
Light_Quanta 2024-05-19 14:20:10 +08:00
parent 25a3f41e88
commit 45829d736a
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959

View file

@ -4,7 +4,16 @@ plugins {
id 'org.spongepowered.mixin' version '0.7.+'
}
version = '0.0.8-SNAPSHOT'
def getGitCommitHash() {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = stdout
}
return stdout.toString().trim()
}
version = '0.0.8-SNAPSHOT-' + getGitCommitHash()
group = 'com.Atsushio.target'
archivesBaseName = 'target'