1
0
mirror of synced 2025-12-23 21:03:15 -05:00

fix version selection from env file (#46)

* demonstrate failing build

* fix version selection from env file
This commit is contained in:
Jared Rhizor
2020-08-12 11:24:21 -07:00
committed by GitHub
parent e4b5f37245
commit a5bd32931d
2 changed files with 10 additions and 6 deletions

1
.env
View File

@@ -1 +1,2 @@
VERSION=0.1.0
ENV=docker

View File

@@ -3,14 +3,17 @@ plugins {
id "com.diffplug.spotless" version "5.1.1" apply false
}
Properties env = new Properties()
File envFile = new File('.env')
envFile.withInputStream {env.load(it) }
if (!env.containsKey("VERSION")) {
throw new Exception("Version not specified in .env file...")
}
allprojects {
group = "io.dataline.${rootProject.name}"
version = rootProject.file('.env').eachLine {
if (it =~ /^VERSION=/) {
return it.split(/=/, 2)[1]
}
throw new Exception("Unknown version")
}
version = env.VERSION
}
// Java projects common configurations