Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
3447d5e9
Commit
3447d5e9
authored
Jun 26, 2022
by
KingRainbow44
Browse files
Change 'injectGitHash' task to properly format 'BuildConfig'
parent
44736059
Changes
1
Show whitespace changes
Inline
Side-by-side
build.gradle
View file @
3447d5e9
...
...
@@ -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 {
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
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment