Fix building error

This commit is contained in:
mingjun97 2022-05-10 23:55:40 -07:00 committed by Melledy
parent 48b5873fee
commit f16edfd58e

View File

@ -229,25 +229,22 @@ javadoc {
} }
task injectGitHash { task injectGitHash {
doLast { def gitCommitHash = {
def gitCommitHash = { try {
try { return 'git rev-parse --verify --short HEAD'.execute().text.trim()
return 'git rev-parse --verify --short HEAD'.execute().text.trim() } catch (e) {
} catch (e) { return "GIT_NOT_FOUND"
return "GIT_NOT_FOUND"
}
} }
new File(projectDir, "src/main/java/emu/grasscutter/BuildConfig.java").text = """
package emu.grasscutter;
public class BuildConfig {
public static final String VERSION = \"${version}\";
public static final String GIT_HASH = \"${gitCommitHash()}\";
}
"""
} }
new File(projectDir, "src/main/java/emu/grasscutter/BuildConfig.java").text = """
package emu.grasscutter;
public class BuildConfig {
public static final String VERSION = \"${version}\";
public static final String GIT_HASH = \"${gitCommitHash()}\";
}
"""
} }
processResources { processResources {
dependsOn "generateProto" dependsOn "generateProto"
dependsOn "injectGitHash"
} }