Skip to content

Commit

Permalink
HHH-14083 Move the update to version.properties to a release task
Browse files Browse the repository at this point in the history
  • Loading branch information
yrodiere authored and dreab8 committed Jun 22, 2020
1 parent fbbba7b commit b56ea9f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
13 changes: 4 additions & 9 deletions gradle/base-information.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,13 @@ apply plugin: 'base'

File versionFile = file( "${rootProject.projectDir}/gradle/version.properties" )

if ( project.hasProperty( 'releaseVersion' ) ) {
if ( !project.hasProperty( 'developmentVersion' ) ) {
throw new GradleException(
"When the releaseVersion parameter is specified, the parameter developmentVersion is required as well."
)
}
versionFile.text = "hibernateVersion=${project.property( 'releaseVersion' )}"
}

ext {
ormVersionFile = versionFile
ormVersion = HibernateVersion.fromFile( versionFile, project )
// Override during releases
if ( project.hasProperty( 'releaseVersion' ) ) {
ormVersion = new HibernateVersion( project.releaseVersion, project )
}
baselineJavaVersion = '1.8'
jpaVersion = new JpaVersion('2.2')
}
Expand Down
17 changes: 13 additions & 4 deletions release/release.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,19 @@ if ( project.hasProperty( 'gitRemote' ) ) {
gitRemote = project.property( 'gitRemote' )
}

task updateChangeLogFile {
task addVersionCommit {
group = "Release"
description = "Updates the changelog.txt file and push the changes to github"
description = "Updates the changelog.txt file, adds a commit for the released version and push the changes to github"
doFirst{
if ( !project.hasProperty( 'releaseVersion' ) ) {
throw new GradleException(
"The releaseVersion parameter is necessary to create the version commit."
)
}

logger.lifecycle( "Updating version to '${project.releaseVersion}'..." )
project.ormVersionFile.text = "hibernateVersion=${project.releaseVersion}"

logger.lifecycle( "Appending version '${project.releaseVersion}' to changelog..." )
ChangeLogFile.update( ormVersion.fullName );

Expand Down Expand Up @@ -295,8 +304,8 @@ task ciRelease() {
}
}

ciRelease.dependsOn updateChangeLogFile, release
release.mustRunAfter updateChangeLogFile
ciRelease.dependsOn addVersionCommit, release
release.mustRunAfter addVersionCommit

static void executeGitCommand(Object ... subcommand){
List<Object> command = ['git']
Expand Down

0 comments on commit b56ea9f

Please sign in to comment.