prepare for 6.0.0.Alpha8

This commit is contained in:
Steve Ebersole 2021-05-18 15:50:10 -05:00
parent 5ae9e9fb7e
commit 2e1ebfc4da
1 changed files with 88 additions and 40 deletions

View File

@ -260,7 +260,7 @@ artifacts {
task releaseChecks { task releaseChecks {
group 'Release' group 'Release'
description description 'Checks and preparation for release'
} }
task changeLogFile { task changeLogFile {
@ -270,40 +270,82 @@ task changeLogFile {
dependsOn project.tasks.releaseChecks dependsOn project.tasks.releaseChecks
doFirst { doFirst {
logger.lifecycle( "Appending version '${project.releaseVersion}' to changelog..." ) logger.lifecycle( "Appending version `${project.releaseVersion}` to changelog..." )
ChangeLogFile.update( ormVersion.fullName ); ChangeLogFile.update( ormVersion.fullName );
} }
} }
task addVersionCommit { task changeToReleaseVersion {
group "Release" group 'Release'
description "Adds a commit for setting the released version" description 'Updates `gradle/version.properties` file to the specified release-version'
dependsOn project.tasks.releaseChecks dependsOn project.tasks.releaseChecks
doFirst { doFirst {
logger.lifecycle( "Updating version to '${project.releaseVersion}'..." ) logger.lifecycle( "Updating version-file to release-version : `${project.releaseVersion}`" )
project.ormVersionFile.text = "hibernateVersion=${project.releaseVersion}" updateVersionFile( project.releaseVersion )
logger.lifecycle( "Adding commit to update version to '${project.releaseVersion}'..." )
executeGitCommand( 'add', '.' )
executeGitCommand( 'commit', '-m', project.ormVersion.fullName )
} }
} }
task gitPreparationForRelease {
dependsOn changeLogFile
dependsOn changeToReleaseVersion
doLast {
logger.lifecycle( "Performing pre-steps Git commit : `${project.releaseVersion}`" )
executeGitCommand( 'add', '.' )
executeGitCommand( 'commit', '-m', "Pre-steps for release : `${project.ormVersion.fullName}`" )
}
}
task changeToDevelopmentVersion {
group 'Release'
description 'Updates `gradle/version.properties` file to the specified development-version'
dependsOn project.tasks.releaseChecks
doFirst {
logger.lifecycle( "Updating version-file to development-version : `${project.developmentVersion}`" )
updateVersionFile( project.developmentVersion )
}
}
task gitTasksAfterRelease {
dependsOn changeToDevelopmentVersion
doLast {
logger.lifecycle( "Performing pre-steps Git commit : `${project.releaseVersion}`" )
executeGitCommand( 'add', '.' )
executeGitCommand( 'commit', '-m', "Post-steps for release : `${project.ormVersion.fullName}`" )
if ( project.releaseTag != '' ) {
logger.lifecycle("Tagging release : `${project.releaseTag}`...")
executeGitCommand( 'tag', project.releaseTag )
}
}
}
void updateVersionFile(String version) {
logger.lifecycle( "Updating `gradle/version.properties` version to `${version}`" )
project.ormVersionFile.text = "hibernateVersion=${version}"
}
task publishReleaseArtifacts { task publishReleaseArtifacts {
dependsOn releaseChecks dependsOn releaseChecks
dependsOn uploadDocumentation dependsOn uploadDocumentation
dependsOn uploadBundlesSourceForge dependsOn uploadBundlesSourceForge
mustRunAfter gitPreparationForRelease
} }
task release { task release {
group 'Release' group 'Release'
description 'Performs a release on local check-out, including updating changelog and ' description 'Performs a release on local check-out, including updating changelog and '
dependsOn changeLogFile dependsOn gitPreparationForRelease
dependsOn addVersionCommit
dependsOn publishReleaseArtifacts dependsOn publishReleaseArtifacts
finalizedBy gitTasksAfterRelease
} }
rootProject.subprojects.each { Project subProject -> rootProject.subprojects.each { Project subProject ->
@ -320,6 +362,21 @@ task ciReleaseChecks {
dependsOn releaseChecks dependsOn releaseChecks
} }
task gitTasksAfterCiRelease {
dependsOn gitTasksAfterRelease
doLast {
if ( project.createTag ) {
logger.lifecycle( "Pushing branch and tag to remote `${project.gitRemote}`..." )
executeGitCommand( 'push', '--atomic', project.gitRemote , project.gitBranch, project.releaseTag )
}
else {
logger.lifecycle("Pushing branch to remote `${project.gitRemote}`..." )
executeGitCommand( 'push', project.gitRemote , project.gitBranch )
}
}
}
task ciRelease { task ciRelease {
group 'Release' group 'Release'
description 'Performs a release: the hibernate version is set and the changelog.txt file updated, the changes are pushed to github, then the release is performed, tagged and the hibernate version is set to the development one.' description 'Performs a release: the hibernate version is set and the changelog.txt file updated, the changes are pushed to github, then the release is performed, tagged and the hibernate version is set to the development one.'
@ -327,34 +384,8 @@ task ciRelease {
dependsOn ciReleaseChecks dependsOn ciReleaseChecks
dependsOn release dependsOn release
doLast { finalizedBy gitTasksAfterCiRelease
String tag = null
if ( !project.hasProperty( 'noTag' ) ) {
tag = project.ormVersion.fullName
// the release is tagged and the tag is pushed to github
if ( tag.endsWith( ".Final" ) ) {
tag = tag.replace( ".Final", "" )
} }
logger.lifecycle( "Tagging '${tag}'..." )
executeGitCommand( 'tag', tag )
}
logger.lifecycle( "Adding commit to update version to '${project.developmentVersion}'..." )
project.ormVersionFile.text = "hibernateVersion=${project.developmentVersion}"
executeGitCommand( 'add', '.')
executeGitCommand( 'commit', '-m', project.developmentVersion )
if ( tag != null ) {
logger.lifecycle("Pushing branch and tag to remote '${project.gitRemote}'...")
executeGitCommand( 'push', '--atomic', project.gitRemote , project.gitBranch, tag )
}
else {
logger.lifecycle("Pushing branch to remote '${project.gitRemote}'...")
executeGitCommand( 'push', project.gitRemote , project.gitBranch )
}
}
}
ciRelease.mustRunAfter addVersionCommit
static String executeGitCommand(Object ... subcommand){ static String executeGitCommand(Object ... subcommand){
List<Object> command = ['git'] List<Object> command = ['git']
@ -490,8 +521,11 @@ gradle.getTaskGraph().whenReady {tg->
project.ext { project.ext {
releaseVersion = project.property( 'releaseVersion' ) releaseVersion = project.property( 'releaseVersion' )
developmentVersion = project.property( 'developmentVersion' ) developmentVersion = project.property( 'developmentVersion' )
createTag = ! project.hasProperty( 'noTag' )
releaseTag = determineReleaseTag( project )
} }
logger.lifecycle( "Checking that the working tree is clean..." ) logger.lifecycle( "Checking that the working tree is clean..." )
String uncommittedFiles = executeGitCommand( 'status', '--porcelain' ) String uncommittedFiles = executeGitCommand( 'status', '--porcelain' )
if ( !uncommittedFiles.isEmpty() ) { if ( !uncommittedFiles.isEmpty() ) {
@ -535,3 +569,17 @@ gradle.getTaskGraph().whenReady {tg->
} }
} }
static String determineReleaseTag(Project project) {
if ( ! project.hasProperty( 'noTag' ) ) {
return "";
}
final String tag = project.ormVersion.fullName
if ( tag.endsWith( ".Final" ) ) {
return tag.replace( ".Final", "" )
}
return tag;
}