HHH-15765 Get rid of the credentials plugin
This commit is contained in:
parent
c71d1b3bef
commit
6bba6d073b
23
build.gradle
23
build.gradle
|
@ -26,7 +26,6 @@ plugins {
|
|||
id 'biz.aQute.bnd' version '6.3.1' apply false
|
||||
|
||||
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
|
||||
id 'nu.studer.credentials' version '3.0'
|
||||
|
||||
id 'idea'
|
||||
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.0'
|
||||
|
@ -61,28 +60,18 @@ task publish {
|
|||
}
|
||||
|
||||
ext {
|
||||
// look for command-line overrides of the username/password pairs for publishing
|
||||
if ( project.hasProperty( 'hibernatePublishUsername' ) ) {
|
||||
if ( ! project.hasProperty( 'hibernatePublishPassword' ) ) {
|
||||
throw new GradleException( "Should specify both `hibernatePublishUsername` and `hibernatePublishPassword` as project properties" );
|
||||
}
|
||||
credentials.hibernatePublishUsername = project.property( 'hibernatePublishUsername' )
|
||||
credentials.hibernatePublishPassword = project.property( 'hibernatePublishPassword' )
|
||||
}
|
||||
else if ( System.properties.hibernatePublishUsername != null ) {
|
||||
if ( System.properties.hibernatePublishPassword == null ) {
|
||||
throw new GradleException( "Should specify both `hibernatePublishUsername` and `hibernatePublishPassword` as system properties" );
|
||||
}
|
||||
credentials.hibernatePublishUsername = System.properties.hibernatePublishUsername
|
||||
credentials.hibernatePublishPassword = System.properties.hibernatePublishPassword
|
||||
}
|
||||
}
|
||||
|
||||
nexusPublishing {
|
||||
repositories {
|
||||
sonatype {
|
||||
username = credentials.forKey( 'hibernatePublishUsername' )
|
||||
password = credentials.forKey( 'hibernatePublishPassword' )
|
||||
username = project.property( 'hibernatePublishUsername' )
|
||||
password = project.property( 'hibernatePublishPassword' )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -103,11 +92,11 @@ gradle.taskGraph.addTaskExecutionGraphListener(
|
|||
if ( graph.hasTask( taskToLookFor ) ) {
|
||||
// trying to publish - make sure the needed credentials are available
|
||||
|
||||
if ( credentials.forKey( 'hibernatePublishUsername' ) == null ) {
|
||||
throw new GradleException( "Publishing credentials not specified" );
|
||||
if ( project.property( 'hibernatePublishUsername' ) == null ) {
|
||||
throw new RuntimeException( "`-PhibernatePublishUsername=...` not found" )
|
||||
}
|
||||
if ( credentials.forKey( 'hibernatePublishPassword' ) == null ) {
|
||||
throw new GradleException( "Publishing credentials not specified" );
|
||||
if ( project.property( 'hibernatePublishPassword' ) == null ) {
|
||||
throw new RuntimeException( "`-PhibernatePublishPassword=...` not found" )
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -40,8 +40,8 @@ pipeline {
|
|||
sh '''./gradlew clean publish \
|
||||
-PhibernatePublishUsername=$hibernatePublishUsername \
|
||||
-PhibernatePublishPassword=$hibernatePublishPassword \
|
||||
-PhibernatePluginPortalUsername=$hibernatePluginPortalUsername \
|
||||
-PhibernatePluginPortalPassword=$hibernatePluginPortalPassword \
|
||||
-Pgradle.publish.key=$hibernatePluginPortalUsername \
|
||||
-Pgradle.publish.secret=$hibernatePluginPortalPassword \
|
||||
--no-scan \
|
||||
-DsigningPassword=$SIGNING_PASS \
|
||||
-DsigningKeyFile=$SIGNING_KEYRING \
|
||||
|
|
|
@ -154,14 +154,12 @@ gradle.taskGraph.whenReady { tg ->
|
|||
}
|
||||
else {
|
||||
// use the values from the credentials provider, if any
|
||||
if ( credentials.forKey( 'hibernatePluginPortalUsername' ) == null ) {
|
||||
throw new RuntimeException( "`hibernatePluginPortalUsername` not found" )
|
||||
if ( project.property( 'gradle.publish.key' ) == null ) {
|
||||
throw new RuntimeException( "`-Pgradle.publish.key=...` not found" )
|
||||
}
|
||||
if ( credentials.forKey( 'hibernatePluginPortalPassword' ) == null ) {
|
||||
throw new RuntimeException( "`hibernatePluginPortalPassword` not found" )
|
||||
if ( project.property( 'gradle.publish.secret' ) == null ) {
|
||||
throw new RuntimeException( "`-Pgradle.publish.secret=...` not found" )
|
||||
}
|
||||
System.setProperty( 'gradle.publish.key', credentials.forKey( 'hibernatePluginPortalUsername' ) )
|
||||
System.setProperty( 'gradle.publish.secret', credentials.forKey( 'hibernatePluginPortalPassword') )
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue