Skip to content

Commit c4c0936

Browse files
authored
Merge pull request #1441 from grails/extractProjectVersion
Simplify project version property
2 parents 7a72547 + 7d256e3 commit c4c0936

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

build.gradle

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,9 @@ buildscript {
1313

1414
project.ext {
1515
isTravisBuild = System.getenv().get("TRAVIS") == 'true'
16-
17-
projectMajorVersion = "7"
18-
projectMinorVersion = "0"
19-
projectPatchVersion = "9"
20-
// releaseType = "RELEASE"
21-
// releaseType = "M2"
22-
// releaseType = "RC1"
23-
releaseType = "-TEST"
24-
2516
// overall project version
26-
projectVersion = "${projectMajorVersion}.${projectMinorVersion}.${projectPatchVersion}"
27-
releaseVersion = "${projectVersion}.${releaseType}"
2817
isCiBuild = project.hasProperty("isCiBuild")
29-
isBuildSnapshot = releaseType == "BUILD-SNAPSHOT"
18+
isBuildSnapshot = version.endsWith("-SNAPSHOT")
3019

3120
nexusUsername = System.getenv("SONATYPE_USERNAME") ?: project.hasProperty("sonatypeOssUsername") ? project.sonatypeOssUsername : ''
3221
nexusPassword = System.getenv("SONATYPE_PASSWORD") ?: project.hasProperty("sonatypeOssPassword") ? project.sonatypeOssPassword : ''
@@ -42,7 +31,7 @@ configurations {
4231
all*.exclude group: "commons-logging"
4332
}
4433

45-
version = "${projectVersion}.${releaseType}"
34+
version = project.projectVersion
4635
group = "org.grails"
4736

4837
apply plugin: 'idea'
@@ -78,14 +67,14 @@ subprojects {
7867
configurations {
7968
documentation
8069
}
81-
version = "${projectVersion}.${releaseType}"
70+
version = project.projectVersion
8271
group = "org.grails"
8372

8473
afterEvaluate { project ->
8574
if (isGroovyProject(project)) {
8675
def hasSnapshotVersion = project.version.endsWith("-SNAPSHOT")
8776
if(isBuildSnapshot != hasSnapshotVersion) {
88-
throw new StopExecutionException("${project.name} has version \"${project.version}\" which is${isBuildSnapshot ? 'n\'t' : ''} a snapshot version. Current release type is ${releaseType}")
77+
throw new StopExecutionException("${project.name} has version \"${project.version}\" which is${isBuildSnapshot ? 'n\'t' : ''} a snapshot version.")
8978
}
9079
}
9180
}

gradle.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ javaAnnotationApiVersion=1.3.2
1010
elVersion=3.0.0
1111
commonsValidatorVersion=1.6
1212
hibernateVersion=5.4.10
13+
projectVersion=7.0.9.BUILD-SNAPSHOT
1314
servletApiVersion=4.0.1
1415
springVersion=5.1.11.RELEASE
1516
caffeineVersion=2.6.2
@@ -18,4 +19,4 @@ grailsAsyncVersion=3.3.2
1819
slf4jVersion=1.7.29
1920
junitVersion=4.12
2021
javassistVersion=3.21.0-GA
21-
groovyVersion=2.5.6
22+
groovyVersion=2.5.6

0 commit comments

Comments
 (0)