HHH-14083 Use a less verbose syntax for git commands
This commit is contained in:
parent
bd03cc3347
commit
fbbba7bff2
|
@ -257,22 +257,13 @@ task updateChangeLogFile {
|
||||||
group = "Release"
|
group = "Release"
|
||||||
description = "Updates the changelog.txt file and push the changes to github"
|
description = "Updates the changelog.txt file and push the changes to github"
|
||||||
doFirst{
|
doFirst{
|
||||||
|
logger.lifecycle( "Appending version '${project.releaseVersion}' to changelog..." )
|
||||||
ChangeLogFile.update( ormVersion.fullName );
|
ChangeLogFile.update( ormVersion.fullName );
|
||||||
|
|
||||||
executeGitCommand(
|
logger.lifecycle( "Adding commit to update version to '${project.releaseVersion}'..." )
|
||||||
"git add .",
|
executeGitCommand( 'add', '.' )
|
||||||
"An error occurred during the execution of git add for the changelog.txt and the release version changes."
|
executeGitCommand( 'commit', '-m', project.ormVersion.fullName )
|
||||||
)
|
executeGitCommand( 'push', gitRemote )
|
||||||
|
|
||||||
executeGitCommand(
|
|
||||||
"git commit -m \"${project.ormVersion.fullName}\"",
|
|
||||||
"An error occurred during the execution of git commit for the changelog.txt and the release version changes."
|
|
||||||
)
|
|
||||||
|
|
||||||
executeGitCommand(
|
|
||||||
"git push ${gitRemote}",
|
|
||||||
"An error occurred during the execution git push for the changelog.txt and the release version changes."
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,31 +282,15 @@ task ciRelease() {
|
||||||
if ( tag.endsWith( ".Final" ) ) {
|
if ( tag.endsWith( ".Final" ) ) {
|
||||||
tag = tag.replace( ".Final", "" )
|
tag = tag.replace( ".Final", "" )
|
||||||
}
|
}
|
||||||
executeGitCommand(
|
logger.lifecycle( "Tagging '${tag}'..." )
|
||||||
"git tag ${tag}",
|
executeGitCommand( 'tag', tag )
|
||||||
"An error occurred during the execution of git tag"
|
executeGitCommand( 'push', gitRemote, tag )
|
||||||
)
|
|
||||||
executeGitCommand(
|
|
||||||
"git push ${gitRemote} ${tag}",
|
|
||||||
"An error occurred during the execution of git push od the tag"
|
|
||||||
)
|
|
||||||
|
|
||||||
// the hibernate version is changed to the development one and the changes are pushed to github
|
logger.lifecycle( "Adding commit to update version to '${project.developmentVersion}'..." )
|
||||||
project.ormVersionFile.text = "hibernateVersion=${project.property( 'developmentVersion' )}"
|
project.ormVersionFile.text = "hibernateVersion=${project.developmentVersion}"
|
||||||
executeGitCommand(
|
executeGitCommand( 'add', '.')
|
||||||
"git add .",
|
executeGitCommand( 'commit', '-m', project.developmentVersion )
|
||||||
"An error occurred during the execution of git add for the development version change."
|
executeGitCommand( 'push', gitRemote )
|
||||||
)
|
|
||||||
|
|
||||||
executeGitCommand(
|
|
||||||
"git commit -m \"${project.property( 'developmentVersion' )}\"",
|
|
||||||
"An error occurred during the execution of git commit for the development version change."
|
|
||||||
)
|
|
||||||
|
|
||||||
executeGitCommand(
|
|
||||||
"git push ${gitRemote}",
|
|
||||||
"An error occurred during the execution git push for the development version change."
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -323,13 +298,15 @@ task ciRelease() {
|
||||||
ciRelease.dependsOn updateChangeLogFile, release
|
ciRelease.dependsOn updateChangeLogFile, release
|
||||||
release.mustRunAfter updateChangeLogFile
|
release.mustRunAfter updateChangeLogFile
|
||||||
|
|
||||||
static void executeGitCommand(String command, String errorMessage){
|
static void executeGitCommand(Object ... subcommand){
|
||||||
|
List<Object> command = ['git']
|
||||||
|
Collections.addAll( command, subcommand )
|
||||||
def proc = command.execute()
|
def proc = command.execute()
|
||||||
def code = proc.waitFor()
|
def code = proc.waitFor()
|
||||||
def stdout = inputStreamToString( proc.getInputStream() )
|
def stdout = inputStreamToString( proc.getInputStream() )
|
||||||
def stderr = inputStreamToString( proc.getErrorStream() )
|
def stderr = inputStreamToString( proc.getErrorStream() )
|
||||||
if ( code != 0 ) {
|
if ( code != 0 ) {
|
||||||
throw new GradleException( errorMessage + "\n\nstdout:\n" + stdout + "\n\nstderr:\n" + stderr )
|
throw new GradleException( "An error occurred while executing " + command + "\n\nstdout:\n" + stdout + "\n\nstderr:\n" + stderr )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue