Skip to content

Commit

Permalink
Simplify getGitVersion() in build.gradle.kts
Browse files Browse the repository at this point in the history
  • Loading branch information
markwhitaker committed Oct 3, 2024
1 parent 8f829c2 commit db09db1
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,11 @@ kotlin {
}
}

fun getGitVersion(): String {
try {
val process = ProcessBuilder("git", "describe", "--tags", "--always").start()
val output = process.inputStream.bufferedReader().readLine()
process.waitFor()
return output
} catch (e: Exception) {
return "1.0.0"
}
fun getGitVersion() = try {
val process = ProcessBuilder("git", "describe", "--tags", "--always").start()
val output = process.inputStream.bufferedReader().readLine()
process.waitFor()
output
} catch (_: Exception) {
"1.0.0"
}

0 comments on commit db09db1

Please sign in to comment.