HHH-18912 - Fix ORM release process
This commit is contained in:
parent
9eb6cdd786
commit
60ff229ca1
47
build.gradle
47
build.gradle
|
@ -39,6 +39,7 @@ plugins {
|
||||||
|
|
||||||
apply from: file( 'gradle/module.gradle' )
|
apply from: file( 'gradle/module.gradle' )
|
||||||
|
|
||||||
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
// Release Task
|
// Release Task
|
||||||
|
|
||||||
|
@ -61,19 +62,23 @@ task publish {
|
||||||
"themselves if they have any publish-related activities to perform"
|
"themselves if they have any publish-related activities to perform"
|
||||||
}
|
}
|
||||||
|
|
||||||
ext {
|
|
||||||
if ( project.hasProperty( 'hibernatePublishUsername' ) ) {
|
|
||||||
if ( ! project.hasProperty( 'hibernatePublishPassword' ) ) {
|
def ossrhUsername = extractPropertyOrSetting( "OSSRH_USER" )
|
||||||
throw new GradleException( "Should specify both `hibernatePublishUsername` and `hibernatePublishPassword` as project properties" );
|
def ossrhPassword = extractPropertyOrSetting( "OSSRH_PASSWORD" )
|
||||||
}
|
|
||||||
|
String extractPropertyOrSetting(String name) {
|
||||||
|
if ( project.hasProperty( name) ) {
|
||||||
|
return project.property( name )
|
||||||
}
|
}
|
||||||
|
return System.getProperty( name )
|
||||||
}
|
}
|
||||||
|
|
||||||
nexusPublishing {
|
nexusPublishing {
|
||||||
repositories {
|
repositories {
|
||||||
sonatype {
|
sonatype {
|
||||||
username = project.hasProperty( 'hibernatePublishUsername' ) ? project.property( 'hibernatePublishUsername' ) : null
|
username = ossrhUsername
|
||||||
password = project.hasProperty( 'hibernatePublishPassword' ) ? project.property( 'hibernatePublishPassword' ) : null
|
password = ossrhPassword
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,26 +87,15 @@ gradle.taskGraph.addTaskExecutionGraphListener(
|
||||||
new TaskExecutionGraphListener() {
|
new TaskExecutionGraphListener() {
|
||||||
@Override
|
@Override
|
||||||
void graphPopulated(TaskExecutionGraph graph) {
|
void graphPopulated(TaskExecutionGraph graph) {
|
||||||
String[] tasksToLookFor = [
|
for ( final def task in graph.allTasks ) {
|
||||||
'publish',
|
if ( task instanceof PublishToMavenRepository ) {
|
||||||
'publishToSonatype',
|
if ( ossrhUsername == null ) {
|
||||||
'publishAllPublicationsToSonatype',
|
throw new RuntimeException( "OSSRH username not specified, but publishing was requested" )
|
||||||
'publishPublishedArtifactsPublicationToSonatypeRepository',
|
|
||||||
'publishRelocationArtifactsPublicationToSonatypeRepository',
|
|
||||||
]
|
|
||||||
|
|
||||||
for ( String taskToLookFor : tasksToLookFor ) {
|
|
||||||
if ( graph.hasTask( taskToLookFor ) ) {
|
|
||||||
// trying to publish - make sure the needed credentials are available
|
|
||||||
|
|
||||||
if ( project.property( 'hibernatePublishUsername' ) == null ) {
|
|
||||||
throw new RuntimeException( "`-PhibernatePublishUsername=...` not found" )
|
|
||||||
}
|
}
|
||||||
if ( project.property( 'hibernatePublishPassword' ) == null ) {
|
if ( ossrhPassword == null ) {
|
||||||
throw new RuntimeException( "`-PhibernatePublishPassword=...` not found" )
|
throw new RuntimeException( "OSSRH password not specified, but publishing was requested" )
|
||||||
}
|
}
|
||||||
|
break
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,6 +133,3 @@ idea {
|
||||||
name = "hibernate-orm"
|
name = "hibernate-orm"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue