HHH-12190 - General tidying of Gradle scripts

- adding `ciBuild` task, standardizing `release` task
This commit is contained in:
Steve Ebersole 2018-01-22 11:28:24 -06:00
parent 3e5556216c
commit 9e20eece55
4 changed files with 36 additions and 19 deletions

View File

@ -48,25 +48,26 @@ allprojects {
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Link together all release tasks // Release Task
// relies on the fact that subprojects will appropriately define a release task
// themselves if they have any release-related activities to perform
task release { task release {
doFirst { description = "The task performed when we are performing a release build. Relies on " +
println "Starting version $project.hibernateVersion release" "the fact that subprojects will appropriately define a release task " +
} "themselves if they have any release-related activities to perform"
} }
task ciBuild // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if ( project.isSnapshot ) { // CI Build Task
// only run the ci build tasks for SNAPSHOT versions
tasks.ciBuild.dependsOn clean task ciBuild {
tasks.ciBuild.dependsOn test description = "The task performed when one of the 'main' jobs are triggered on the " +
tasks.ciBuild.dependsOn publish "CI server. Just as above, relies on the fact that subprojects will " +
"appropriately define a release task themselves if they have any tasks " +
"which should be performed from these CI jobs"
} }
task wrapper(type: Wrapper) { task wrapper(type: Wrapper) {
gradleVersion = '4.4' gradleVersion = '4.4'
distributionType = 'ALL' distributionType = 'ALL'

View File

@ -63,6 +63,14 @@ dependencies {
} }
if ( project.isSnapshot ) {
// only run the ci build tasks for SNAPSHOT versions
task ciBuild( dependsOn: [clean, test] )
}
else {
task release( dependsOn: [clean, test] )
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// grouping tasks - declaration, see below for task dependency definitions // grouping tasks - declaration, see below for task dependency definitions
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -8,8 +8,13 @@
apply from: rootProject.file( 'gradle/java-module.gradle' ) apply from: rootProject.file( 'gradle/java-module.gradle' )
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
apply plugin: 'maven-publish-auth' apply plugin: 'maven-publish-auth'
apply from: rootProject.file( 'gradle/publishing-repos.gradle' )
apply from: rootProject.file( 'gradle/publishing-pom.gradle' ) apply from: rootProject.file( 'gradle/publishing-pom.gradle' )
apply from: rootProject.file( 'gradle/publishing-repos.gradle' )
task ciBuild( dependsOn: [clean, test, publish] )
task release( dependsOn: [clean, test, publish] )
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -63,6 +68,7 @@ jar {
} }
} }
task sourcesJar(type: Jar) { task sourcesJar(type: Jar) {
from project.sourceSets.main.allSource from project.sourceSets.main.allSource
manifest = project.tasks.jar.manifest manifest = project.tasks.jar.manifest
@ -143,9 +149,3 @@ model {
task generatePomFile( dependsOn: 'generatePomFileForPublishedArtifactsPublication' ) task generatePomFile( dependsOn: 'generatePomFileForPublishedArtifactsPublication' )
task release( dependsOn: publish ) {
doFirst {
println "Starting release for $project.name:$project.version"
}
}

View File

@ -210,3 +210,11 @@ processTestResources {
} }
if ( project.isSnapshot ) {
// only run the ci build tasks for SNAPSHOT versions
task ciBuild( dependsOn: [clean, test] )
}
else {
task release( dependsOn: [clean, test] )
}