1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 16:28:12 -07:00

Cleaner version computation.

This commit is contained in:
Cedric Beust 2016-03-17 01:36:55 +04:00
parent 427f9cafa4
commit 33d5afd6c3

View file

@ -169,13 +169,13 @@ val kobaltApp = project(kobaltPluginApi, wrapper) {
}
fun readVersion() : String {
val p = java.util.Properties()
var localFile = java.io.File("src/main/resources/kobalt.properties")
if (! localFile.exists()) {
localFile = File(homeDir("kotlin", "kobalt", "src/main/resources/kobalt.properties"))
val localFile =
listOf("src/main/resources/kobalt.properties",
homeDir("kotlin", "kobalt", "src/main/resources/kobalt.properties")).first { File(it).exists() }
with(java.util.Properties()) {
load(java.io.FileReader(localFile))
return getProperty("kobalt.version")
}
p.load(java.io.FileReader(localFile))
return p.getProperty("kobalt.version")
}
@Task(name = "copyVersionForWrapper", runBefore = arrayOf("assemble"), runAfter = arrayOf("compile"), description = "")