Skip to content

Commit

Permalink
Merge pull request #1441 from grails/extractProjectVersion
Browse files Browse the repository at this point in the history
Simplify project version property
  • Loading branch information
puneetbehl authored Mar 3, 2021
2 parents 7a72547 + 7d256e3 commit c4c0936
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
19 changes: 4 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,9 @@ buildscript {

project.ext {
isTravisBuild = System.getenv().get("TRAVIS") == 'true'

projectMajorVersion = "7"
projectMinorVersion = "0"
projectPatchVersion = "9"
// releaseType = "RELEASE"
// releaseType = "M2"
// releaseType = "RC1"
releaseType = "-TEST"

// overall project version
projectVersion = "${projectMajorVersion}.${projectMinorVersion}.${projectPatchVersion}"
releaseVersion = "${projectVersion}.${releaseType}"
isCiBuild = project.hasProperty("isCiBuild")
isBuildSnapshot = releaseType == "BUILD-SNAPSHOT"
isBuildSnapshot = version.endsWith("-SNAPSHOT")

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

version = "${projectVersion}.${releaseType}"
version = project.projectVersion
group = "org.grails"

apply plugin: 'idea'
Expand Down Expand Up @@ -78,14 +67,14 @@ subprojects {
configurations {
documentation
}
version = "${projectVersion}.${releaseType}"
version = project.projectVersion
group = "org.grails"

afterEvaluate { project ->
if (isGroovyProject(project)) {
def hasSnapshotVersion = project.version.endsWith("-SNAPSHOT")
if(isBuildSnapshot != hasSnapshotVersion) {
throw new StopExecutionException("${project.name} has version \"${project.version}\" which is${isBuildSnapshot ? 'n\'t' : ''} a snapshot version. Current release type is ${releaseType}")
throw new StopExecutionException("${project.name} has version \"${project.version}\" which is${isBuildSnapshot ? 'n\'t' : ''} a snapshot version.")
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ javaAnnotationApiVersion=1.3.2
elVersion=3.0.0
commonsValidatorVersion=1.6
hibernateVersion=5.4.10
projectVersion=7.0.9.BUILD-SNAPSHOT
servletApiVersion=4.0.1
springVersion=5.1.11.RELEASE
caffeineVersion=2.6.2
Expand All @@ -18,4 +19,4 @@ grailsAsyncVersion=3.3.2
slf4jVersion=1.7.29
junitVersion=4.12
javassistVersion=3.21.0-GA
groovyVersion=2.5.6
groovyVersion=2.5.6

0 comments on commit c4c0936

Please sign in to comment.