mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-23 06:07:22 +00:00
Change 'injectGitHash' task to properly format 'BuildConfig'
This commit is contained in:
parent
6ea556896a
commit
52032c39be
18
build.gradle
18
build.gradle
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user