Skip to content

Commit ac9a90c

Browse files
committed
1 parent 7185732 commit ac9a90c

File tree

1 file changed

+6
-40
lines changed

1 file changed

+6
-40
lines changed

build.gradle

Lines changed: 6 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,20 @@ apply from: file( 'gradle/module.gradle' )
4242
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4343
// Release Task
4444

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

5050
doFirst {
5151
def javaVersionsInUse = jdkVersions.allVersions
52-
if ( javaVersionsInUse != [JavaLanguageVersion.of( 11 )].toSet() ) {
53-
throw new IllegalStateException( "Please use JDK 11 to perform the release. Currently using: ${javaVersionsInUse}" )
52+
if (javaVersionsInUse != [JavaLanguageVersion.of(11)].toSet()) {
53+
throw new IllegalStateException("Please use JDK 11 to perform the release. Currently using: ${javaVersionsInUse}")
5454
}
5555
}
5656
}
5757

58-
task publish {
58+
tasks.register('publish') {
5959
description = "The task performed when we want to just publish maven artifacts. Relies on " +
6060
"the fact that subprojects will appropriately define a release task " +
6161
"themselves if they have any publish-related activities to perform"
@@ -71,48 +71,14 @@ ext {
7171

7272
nexusPublishing {
7373
repositories {
74-
sonatype {
75-
username = project.hasProperty( 'hibernatePublishUsername' ) ? project.property( 'hibernatePublishUsername' ) : null
76-
password = project.hasProperty( 'hibernatePublishPassword' ) ? project.property( 'hibernatePublishPassword' ) : null
77-
}
74+
sonatype
7875
}
7976
}
8077

81-
gradle.taskGraph.addTaskExecutionGraphListener(
82-
new TaskExecutionGraphListener() {
83-
@Override
84-
void graphPopulated(TaskExecutionGraph graph) {
85-
String[] tasksToLookFor = [
86-
'publish',
87-
'publishToSonatype',
88-
'publishAllPublicationsToSonatype',
89-
'publishPublishedArtifactsPublicationToSonatypeRepository',
90-
'publishRelocationArtifactsPublicationToSonatypeRepository',
91-
]
92-
93-
for ( String taskToLookFor : tasksToLookFor ) {
94-
if ( graph.hasTask( taskToLookFor ) ) {
95-
// trying to publish - make sure the needed credentials are available
96-
97-
if ( project.property( 'hibernatePublishUsername' ) == null ) {
98-
throw new RuntimeException( "`-PhibernatePublishUsername=...` not found" )
99-
}
100-
if ( project.property( 'hibernatePublishPassword' ) == null ) {
101-
throw new RuntimeException( "`-PhibernatePublishPassword=...` not found" )
102-
}
103-
104-
break;
105-
}
106-
}
107-
}
108-
}
109-
)
110-
111-
11278
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11379
// CI Build Task
11480

115-
task ciBuild {
81+
tasks.register('ciBuild') {
11682
description = "The task performed when one of the 'main' jobs are triggered on the " +
11783
"CI server. Just as above, relies on the fact that subprojects will " +
11884
"appropriately define a release task themselves if they have any tasks " +

0 commit comments

Comments
 (0)