From 2c9166bece8f2d6f6b26ed5913b7ef7398118a5a Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Fri, 13 Dec 2024 13:16:46 -0600 Subject: [PATCH] HHH-18912 - ORM release process https://hibernate.atlassian.net/browse/HHH-18912 --- build.gradle | 57 +++-------------------------- gradle/published-java-module.gradle | 4 +- 2 files changed, 8 insertions(+), 53 deletions(-) diff --git a/build.gradle b/build.gradle index b2d10c0ca8fa..1bd9d6115783 100644 --- a/build.gradle +++ b/build.gradle @@ -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 " + diff --git a/gradle/published-java-module.gradle b/gradle/published-java-module.gradle index 7226569a64c5..5c64b3b6d6c9 100644 --- a/gradle/published-java-module.gradle +++ b/gradle/published-java-module.gradle @@ -131,7 +131,7 @@ static String resolveSigningPassphrase() { // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Release / publishing tasks -task ciBuild { +tasks.register('ciBuild') { dependsOn test, tasks.publishToSonatype } @@ -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}"