diff --git a/build.gradle b/build.gradle index 97e0d5056..40a691846 100644 --- a/build.gradle +++ b/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 {