Move the update to version.properties to a release task

This is necessary if we want to check that the working tree is empty as
part of the release process (see next commit).
This commit is contained in:
Yoann Rodière 2020-06-03 11:48:45 +02:00 committed by Andrea Boriero
parent 7dbd813996
commit 70721d80a7
2 changed files with 17 additions and 13 deletions

View File

@ -9,18 +9,13 @@ apply plugin: 'base'
File versionFile = file( "${rootProject.projectDir}/gradle/version.properties" ) 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 { ext {
ormVersionFile = versionFile ormVersionFile = versionFile
ormVersion = HibernateVersion.fromFile( versionFile, project ) ormVersion = HibernateVersion.fromFile( versionFile, project )
// Override during releases
if ( project.hasProperty( 'releaseVersion' ) ) {
ormVersion = new HibernateVersion( project.releaseVersion, project )
}
baselineJavaVersion = '1.8' baselineJavaVersion = '1.8'
jpaVersion = new JpaVersion('2.2') jpaVersion = new JpaVersion('2.2')
} }

View File

@ -253,10 +253,19 @@ if ( project.hasProperty( 'gitRemote' ) ) {
gitRemote = project.property( 'gitRemote' ) gitRemote = project.property( 'gitRemote' )
} }
task updateChangeLogFile { task addVersionCommit {
group = "Release" 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{ 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..." ) logger.lifecycle( "Appending version '${project.releaseVersion}' to changelog..." )
ChangeLogFile.update( ormVersion.fullName ); ChangeLogFile.update( ormVersion.fullName );
@ -295,8 +304,8 @@ task ciRelease() {
} }
} }
ciRelease.dependsOn updateChangeLogFile, release ciRelease.dependsOn addVersionCommit, release
release.mustRunAfter updateChangeLogFile release.mustRunAfter addVersionCommit
static void executeGitCommand(Object ... subcommand){ static void executeGitCommand(Object ... subcommand){
List<Object> command = ['git'] List<Object> command = ['git']