Skip to content

Commit 76645cf

Browse files
authored
Add a build qualifier system property to the build (#1215)
Allows build processes to pick up a qualifier to add into the version at build time instead of depending on it from a version file. By default, it will continue to use alpha1 as the qualifier until the ES build changes the master branch to ship an unqualified snapshot version during the 7 prerelease period.
1 parent 2dbe70e commit 76645cf

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

buildSrc/build.gradle

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,31 @@ boolean localRepo = project.getProperties().containsKey("localRepo")
1010

1111
Properties props = new Properties()
1212
props.load(project.file('esh-version.properties').newDataInputStream())
13-
version = props.getProperty('eshadoop')
13+
String eshVersion = props.getProperty('eshadoop')
1414
String esVersion = props.getProperty('elasticsearch')
1515

16+
// determine if we're building a prerelease or candidate (alphaX/betaX/rcX)
17+
// TODO: This default should be removed when ES stops using alpha1 as its default qualifier
18+
String qualifier = System.getProperty("build.version_qualifier", "alpha1")
19+
if (qualifier.isEmpty() == false) {
20+
if (qualifier.matches("(alpha|beta|rc)\\d+") == false) {
21+
throw new IllegalStateException("Invalid qualifier: " + qualifier)
22+
}
23+
eshVersion += "-" + qualifier
24+
esVersion += "-" + qualifier
25+
}
26+
1627
// determine if we're building a snapshot or not (by default we will be)
1728
boolean snapshot = "true".equals(System.getProperty("build.snapshot", "true"))
1829
if (snapshot) {
1930
// we update the version property to reflect if we are building a snapshot or a release build
20-
version += "-SNAPSHOT"
21-
props.put("eshadoop", version)
31+
eshVersion += "-SNAPSHOT"
32+
esVersion += "-SNAPSHOT"
2233
}
2334

35+
props.put("eshadoop", eshVersion)
36+
props.put("elasticsearch", esVersion)
37+
2438
repositories {
2539
jcenter()
2640
mavenCentral()
@@ -45,7 +59,7 @@ dependencies {
4559
compile 'org.springframework.build.gradle:propdeps-plugin:0.0.7'
4660

4761
if (localRepo) {
48-
compile name: "build-tools-${version}"
62+
compile name: "build-tools-${esVersion}"
4963
} else {
5064
compile group: 'org.elasticsearch.gradle', name: 'build-tools', version: esVersion
5165
}

buildSrc/esh-version.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
eshadoop = 7.0.0-alpha1
2-
elasticsearch = 7.0.0-alpha1-SNAPSHOT
1+
eshadoop = 7.0.0
2+
elasticsearch = 7.0.0

0 commit comments

Comments
 (0)