Skip to content

Commit 8fce4ae

Browse files
author
Dmitry Tretyakov
committed
Refactor code
1 parent 72944b4 commit 8fce4ae

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

app/build.gradle

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,18 @@ def getGitHubCommit = {
99
def changeOutput = new ByteArrayOutputStream()
1010
def gitVersionName = ""
1111

12-
execOperations.exec {
13-
it.commandLine 'git', 'rev-list', '--max-count=1', 'HEAD'
14-
it.standardOutput = hashOutput
15-
}
12+
hashOutput = providers.exec {
13+
commandLine('git', 'rev-list', '--max-count=1', 'HEAD')
14+
}.standardOutput
1615

17-
execOperations.exec {
18-
it.commandLine 'git', 'diff-index', '--shortstat', 'HEAD'
19-
it.standardOutput = changeOutput
20-
}
16+
changeOutput = providers.exec {
17+
commandLine('git', 'diff-index', '--shortstat', 'HEAD')
18+
}.standardOutput
2119

22-
gitVersionName = hashOutput.asText.get().trim().substring(0, 7)
23-
if (!changeOutput.asText.get().trim().empty) {
20+
gitVersionName = hashOutput.asText().get().trim().substring(0, 7)
21+
if (!changeOutput.asText().get().trim().empty) {
2422
def pattern = Pattern.compile("\\d+");
25-
def matcher = pattern.matcher(changeOutput.asText.get().trim())
23+
def matcher = pattern.matcher(changeOutput.asText().get().trim())
2624
if (matcher.find()) {
2725
gitVersionName += "-" + matcher.group()
2826
}

0 commit comments

Comments
 (0)