Skip to content

Commit 2c9166b

Browse files
committed
1 parent 2360a28 commit 2c9166b

File tree

2 files changed

+8
-53
lines changed

2 files changed

+8
-53
lines changed

build.gradle

Lines changed: 6 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -43,81 +43,36 @@ apply from: file( 'gradle/module.gradle' )
4343
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4444
// Release Task
4545

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

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

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

65-
66-
67-
def ossrhUsername = extractPropertyOrSetting( "OSSRH_USER" )
68-
def ossrhPassword = extractPropertyOrSetting( "OSSRH_PASSWORD" )
69-
70-
String extractPropertyOrSetting(String name) {
71-
if ( project.hasProperty( name) ) {
72-
return project.property( name )
73-
}
74-
75-
def sysProp = System.getProperty( name )
76-
if ( sysProp != null ) {
77-
return sysProp
78-
}
79-
80-
def envProp = System.getenv( name )
81-
if ( envProp != null ) {
82-
return envProp
83-
}
84-
85-
return null
86-
}
87-
8865
nexusPublishing {
8966
repositories {
90-
sonatype {
91-
username = ossrhUsername
92-
password = ossrhPassword
93-
}
67+
sonatype
9468
}
9569
}
9670

97-
gradle.taskGraph.addTaskExecutionGraphListener(
98-
new TaskExecutionGraphListener() {
99-
@Override
100-
void graphPopulated(TaskExecutionGraph graph) {
101-
for ( final def task in graph.allTasks ) {
102-
if ( task instanceof PublishToMavenRepository ) {
103-
if ( ossrhUsername == null ) {
104-
throw new RuntimeException( "OSSRH username not specified, but publishing was requested" )
105-
}
106-
if ( ossrhPassword == null ) {
107-
throw new RuntimeException( "OSSRH password not specified, but publishing was requested" )
108-
}
109-
break
110-
}
111-
}
112-
}
113-
}
114-
)
115-
11671

11772
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11873
// CI Build Task
11974

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

gradle/published-java-module.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ static String resolveSigningPassphrase() {
131131
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
132132
// Release / publishing tasks
133133

134-
task ciBuild {
134+
tasks.register('ciBuild') {
135135
dependsOn test, tasks.publishToSonatype
136136
}
137137

@@ -147,7 +147,7 @@ tasks.publishToSonatype.mustRunAfter test
147147
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
148148
// Ancillary tasks
149149

150-
task showPublications {
150+
tasks.register('showPublications') {
151151
doFirst {
152152
project.publishing.publications.each { publication ->
153153
println "Publication (${publication.name}): ${publication.groupId}:${publication.artifactId}:${publication.version}"

0 commit comments

Comments
 (0)