1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-27 00:38:11 -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 { fun readVersion() : String {
val p = java.util.Properties() val localFile =
var localFile = java.io.File("src/main/resources/kobalt.properties") listOf("src/main/resources/kobalt.properties",
if (! localFile.exists()) { homeDir("kotlin", "kobalt", "src/main/resources/kobalt.properties")).first { File(it).exists() }
localFile = File(homeDir("kotlin", "kobalt", "src/main/resources/kobalt.properties")) 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 = "") @Task(name = "copyVersionForWrapper", runBefore = arrayOf("assemble"), runAfter = arrayOf("compile"), description = "")