Skip to content

Commit

Permalink
update get version code
Browse files Browse the repository at this point in the history
  • Loading branch information
xpenatan committed Jan 11, 2024
1 parent 6d11bae commit cd99883
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,22 @@ object LibExt {
}

private fun getVersion(): String {
val file = File("gradle.properties")
val properties = Properties()
properties.load(file.inputStream())
val version = properties.getProperty("version")

val isRelease = System.getenv("RELEASE")
val isReleaseStr = System.getenv("RELEASE")
val isRelease = isReleaseStr != null && isReleaseStr.toBoolean()
var libVersion = "-SNAPSHOT"
if(isRelease != null && isRelease.toBoolean()) {
libVersion = version
val file = File("gradle.properties")
if(file.exists()) {
val properties = Properties()
properties.load(file.inputStream())
val version = properties.getProperty("version")
if(isRelease) {
libVersion = version
}
}
else {
if(isRelease) {
throw RuntimeException("properties should exist")
}
}
println("gdx-teavm Version: $libVersion")
return libVersion
Expand Down

0 comments on commit cd99883

Please sign in to comment.