From 2a667ed0963a599129e57c5db667c76c8f2432c2 Mon Sep 17 00:00:00 2001 From: RednedEpic Date: Sun, 27 Feb 2022 23:11:27 -0600 Subject: [PATCH] Use System.getenv instead of System.getProperty --- core/build.gradle.kts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 91ad66cab..ac21acd2b 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -87,16 +87,12 @@ configure { replaceToken("\${version}", "${project.version} ($gitVersion)", mainFile) replaceToken("\${gitVersion}", gitVersion, mainFile) - replaceToken("\${buildNumber}", Integer.parseInt(System.getProperty("BUILD_NUMBER", "-1")), mainFile) + replaceToken("\${buildNumber}", buildNumber(), mainFile) replaceToken("\${branch}", branchName(), mainFile) } -fun Project.branchName(): String { - val out = ByteArrayOutputStream() - exec { - commandLine = listOf("git", "rev-parse", "--abbrev-ref", "HEAD") - standardOutput = out - } +fun Project.branchName(): String = + System.getenv("GIT_BRANCH") ?: "local/dev" - return out.toString(Charsets.UTF_8.name()).trim() -} \ No newline at end of file +fun Project.buildNumber(): Int = + Integer.parseInt(System.getenv("BUILD_NUMBER") ?: "-1") \ No newline at end of file