Skip to content

Commit

Permalink
HHH-18912 - ORM release process
Browse files Browse the repository at this point in the history
  • Loading branch information
sebersole committed Dec 13, 2024
1 parent 2360a28 commit 2c9166b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 53 deletions.
57 changes: 6 additions & 51 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,81 +43,36 @@ apply from: file( 'gradle/module.gradle' )
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Release Task

task release {
tasks.register('release') {
description = "The task performed when we are performing a release build. Relies on " +
"the fact that subprojects will appropriately define a release task " +
"themselves if they have any release-related activities to perform"

doFirst {
def javaVersionsInUse = jdkVersions.allVersions
if ( javaVersionsInUse != [JavaLanguageVersion.of( 11 )].toSet() ) {
throw new IllegalStateException( "Please use JDK 11 to perform the release. Currently using: ${javaVersionsInUse}" )
if (javaVersionsInUse != [JavaLanguageVersion.of(11)].toSet()) {
throw new IllegalStateException("Please use JDK 11 to perform the release. Currently using: ${javaVersionsInUse}")
}
}
}

task publish {
tasks.register('publish') {
description = "The task performed when we want to just publish maven artifacts. Relies on " +
"the fact that subprojects will appropriately define a release task " +
"themselves if they have any publish-related activities to perform"
}



def ossrhUsername = extractPropertyOrSetting( "OSSRH_USER" )
def ossrhPassword = extractPropertyOrSetting( "OSSRH_PASSWORD" )

String extractPropertyOrSetting(String name) {
if ( project.hasProperty( name) ) {
return project.property( name )
}

def sysProp = System.getProperty( name )
if ( sysProp != null ) {
return sysProp
}

def envProp = System.getenv( name )
if ( envProp != null ) {
return envProp
}

return null
}

nexusPublishing {
repositories {
sonatype {
username = ossrhUsername
password = ossrhPassword
}
sonatype
}
}

gradle.taskGraph.addTaskExecutionGraphListener(
new TaskExecutionGraphListener() {
@Override
void graphPopulated(TaskExecutionGraph graph) {
for ( final def task in graph.allTasks ) {
if ( task instanceof PublishToMavenRepository ) {
if ( ossrhUsername == null ) {
throw new RuntimeException( "OSSRH username not specified, but publishing was requested" )
}
if ( ossrhPassword == null ) {
throw new RuntimeException( "OSSRH password not specified, but publishing was requested" )
}
break
}
}
}
}
)


// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CI Build Task

task ciBuild {
tasks.register('ciBuild') {
description = "The task performed when one of the 'main' jobs are triggered on the " +
"CI server. Just as above, relies on the fact that subprojects will " +
"appropriately define a release task themselves if they have any tasks " +
Expand Down
4 changes: 2 additions & 2 deletions gradle/published-java-module.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ static String resolveSigningPassphrase() {
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Release / publishing tasks

task ciBuild {
tasks.register('ciBuild') {
dependsOn test, tasks.publishToSonatype
}

Expand All @@ -147,7 +147,7 @@ tasks.publishToSonatype.mustRunAfter test
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Ancillary tasks

task showPublications {
tasks.register('showPublications') {
doFirst {
project.publishing.publications.each { publication ->
println "Publication (${publication.name}): ${publication.groupId}:${publication.artifactId}:${publication.version}"
Expand Down

0 comments on commit 2c9166b

Please sign in to comment.