Skip to content

Commit 2cea0af

Browse files
authored
Merge pull request #2386 from dondonz/support-non-git-download-issue-2350
Fix issue building zip and gzip downloads
2 parents c5b814c + 6d51a08 commit 2cea0af

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

build.gradle

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,22 @@ plugins {
1414

1515

1616
def getDevelopmentVersion() {
17-
def output = new StringBuilder()
18-
def error = new StringBuilder()
17+
def gitCheckOutput = new StringBuilder()
18+
def gitCheckError = new StringBuilder()
19+
def gitCheck = ["git", "rev-parse", "--is-inside-work-tree"].execute()
20+
gitCheck.waitForProcessOutput(gitCheckOutput, gitCheckError)
21+
def isGit = gitCheckOutput.toString().trim()
22+
if (isGit != "true") {
23+
def version = "0.0.0-" + new SimpleDateFormat('yyyy-MM-dd\'T\'HH-mm-ss').format(new Date()) + "-no-git"
24+
println "created development version: $version"
25+
return version
26+
}
27+
28+
def gitHashOutput = new StringBuilder()
29+
def gitHashError = new StringBuilder()
1930
def gitShortHash = ["git", "-C", projectDir.toString(), "rev-parse", "--short", "HEAD"].execute()
20-
gitShortHash.waitForProcessOutput(output, error)
21-
def gitHash = output.toString().trim()
31+
gitShortHash.waitForProcessOutput(gitHashOutput, gitHashError)
32+
def gitHash = gitHashOutput.toString().trim()
2233
if (gitHash.isEmpty()) {
2334
println "git hash is empty: error: ${error.toString()}"
2435
throw new IllegalStateException("git hash could not be determined")

0 commit comments

Comments
 (0)