Change 'injectGitHash' task to properly format 'BuildConfig'

This commit is contained in:
KingRainbow44 2022-06-26 12:22:10 -04:00
parent 447360594d
commit 3447d5e91e

View File

@ -251,17 +251,19 @@ task injectGitHash {
def gitCommitHash = {
try {
return 'git rev-parse --verify --short HEAD'.execute().text.trim()
} catch (e) {
} catch (ignored) {
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 final class BuildConfig {
public static final String VERSION = \"${version}\";
public static final String GIT_HASH = \"${gitCommitHash()}\";
}"""
}
processResources {