14
14
* limitations under the License.
15
15
*/
16
16
17
+ import nebula.plugin.release.git.opinion.Strategies
17
18
plugins {
18
19
id " com.diffplug.spotless"
20
+ id ' nebula.release'
19
21
}
22
+
23
+ // Configure release mechanism.
24
+ // Nebula plugin will not configure if .git doesn't exist, let's allow building on it by stubbing it
25
+ // out. This supports building from the zip archive downloaded from GitHub.
26
+ def releaseTask
27
+ if (file(' .git' ). exists()) {
28
+ release {
29
+ defaultVersionStrategy = Strategies . getSNAPSHOT()
30
+ }
31
+ nebulaRelease {
32
+ addReleaseBranchPattern(/ v\d +\.\d +\. x/ )
33
+ }
34
+
35
+ releaseTask = tasks. named(" release" )
36
+ releaseTask. configure {
37
+ mustRunAfter(" snapshotSetup" , " finalSetup" )
38
+ }
39
+ } else {
40
+ releaseTask = tasks. register(' release' )
41
+ }
42
+
43
+ ext. isReleaseVersion = ! version. toString(). endsWith(" -SNAPSHOT" )
44
+
20
45
subprojects {
21
46
apply plugin : ' jacoco'
22
47
apply plugin : ' java-library'
23
48
apply plugin : ' maven'
49
+ apply plugin : ' maven-publish'
24
50
apply plugin : ' signing'
25
51
apply plugin : ' com.diffplug.spotless'
26
-
52
+ apply plugin : ' nebula.nebula-release '
27
53
group = " com.google.cloud.opentelemetry"
28
- version = " 0.13.1 -SNAPSHOT" // CURRENT_VERSION
54
+ version = " 0.14.0 -SNAPSHOT" // CURRENT_VERSION
29
55
30
56
sourceCompatibility = JavaVersion . VERSION_1_8
31
57
targetCompatibility = JavaVersion . VERSION_1_8
@@ -39,8 +65,10 @@ subprojects {
39
65
40
66
// Set up java codestyle checking and correction.
41
67
plugins. withId(" java" ) {
42
- plugins. apply(' checkstyle' )
43
68
plugins. apply(' com.diffplug.spotless' )
69
+
70
+ // Configure our default module name for maven publishing
71
+ archivesBaseName = " ${ project.name} "
44
72
}
45
73
46
74
// Include license check and auto-format support.
@@ -117,60 +145,83 @@ subprojects {
117
145
archives javadocJar, sourcesJar
118
146
}
119
147
120
- signing {
121
- required false
122
- // Allow using the GPG agent on linux instead of passwords in a .properties file.
123
- if (rootProject. hasProperty(' signingUseGpgCmd' )) {
124
- useGpgCmd()
148
+ javadoc {
149
+ if (JavaVersion . current(). isJava9Compatible()) {
150
+ options. addBooleanOption(' html5' , true )
125
151
}
126
- sign configurations. archives
127
152
}
128
153
129
- uploadArchives {
130
- repositories {
131
- mavenDeployer {
132
- beforeDeployment { MavenDeployment deployment -> signing. signPom(deployment) }
154
+ java {
155
+ withJavadocJar()
156
+ withSourcesJar()
157
+ }
158
+
159
+ releaseTask. configure {
160
+ finalizedBy(tasks. named(' publish' ))
161
+ }
133
162
134
- def configureAuth = {
135
- if (rootProject. hasProperty(' ossrhUsername' ) && rootProject. hasProperty(' ossrhPassword' )) {
136
- authentication(userName : rootProject. ossrhUsername, password : rootProject. ossrhPassword)
137
- }
163
+ publishing {
164
+ publications {
165
+ maven(MavenPublication ) {
166
+ from components. java
167
+ groupId = ' com.google.cloud.opentelemetry'
168
+ afterEvaluate {
169
+ artifactId = archivesBaseName
138
170
}
139
-
140
- repository(url : " https://oss.sonatype.org/service/local/staging/deploy/maven2/" , configureAuth)
141
-
142
- snapshotRepository(url : " https://oss.sonatype.org/content/repositories/snapshots/" , configureAuth)
143
-
144
- pom. project {
145
- name ' OpenTelemetry Operations Java'
146
- description ' OpenTelemetry exporters to Google Cloud Trace and Google Cloud Monitoring'
147
- packaging ' jar'
148
- url ' https://github.com/GoogleCloudPlatform/opentelemetry-operations-java'
149
-
150
- scm {
151
- connection ' scm:git:https://github.com/GoogleCloudPlatform/opentelemetry-operations-java'
152
- developerConnection ' scm:git:https://github.com/GoogleCloudPlatform/opentelemetry-operations-java'
153
- url ' https://github.com/GoogleCloudPlatform/opentelemetry-operations-java'
154
- }
155
-
171
+ versionMapping {
172
+ allVariants {
173
+ fromResolutionResult()
174
+ }
175
+ }
176
+ pom {
177
+ name = ' OpenTelemetry Operations Java'
178
+ url = ' https://github.com/GoogleCloudPlatform/opentelemetry-operations-java'
156
179
licenses {
157
180
license {
158
- name ' The Apache License, Version 2.0'
159
- url ' http://www.apache.org/licenses/LICENSE-2.0.txt'
181
+ name = ' The Apache License, Version 2.0'
182
+ url = ' http://www.apache.org/licenses/LICENSE-2.0.txt'
160
183
}
161
184
}
162
-
163
185
developers {
164
186
developer {
165
- id ' com.google.cloud.opentelemetry'
166
- name ' OpenTelemetry Operations Contributors'
167
-
187
+ id = ' com.google.cloud.opentelemetry'
188
+ name = ' OpenTelemetry Operations Contributors'
189
+
168
190
organization = ' Google Inc'
169
- organizationUrl ' https://cloud.google.com/products/operations'
191
+ organizationUrl = ' https://cloud.google.com/products/operations'
170
192
}
171
193
}
194
+ scm {
195
+ connection = ' scm:git:https://github.com/GoogleCloudPlatform/opentelemetry-operations-java'
196
+ developerConnection = ' scm:git:https://github.com/GoogleCloudPlatform/opentelemetry-operations-java'
197
+ url = ' https://github.com/GoogleCloudPlatform/opentelemetry-operations-java'
198
+ }
199
+ afterEvaluate {
200
+ // description is not available until evaluated.
201
+ description = project. description
202
+ }
172
203
}
173
204
}
174
205
}
206
+ repositories {
207
+ maven {
208
+ def ossrhRelease = " https://oss.sonatype.org/service/local/staging/deploy/maven2/"
209
+ def ossrhSnapshot = " https://oss.sonatype.org/content/repositories/snapshots/"
210
+ url = isReleaseVersion ? ossrhRelease : ossrhSnapshot
211
+ credentials {
212
+ username = rootProject. hasProperty(' ossrhUsername' ) ? rootProject. ossrhUsername : " Unknown user"
213
+ password = rootProject. hasProperty(' ossrhPassword' ) ? rootProject. ossrhPassword : " Unknown password"
214
+ }
215
+ }
216
+ }
217
+ }
218
+
219
+ signing {
220
+ required false
221
+ // Allow using the GPG agent on linux instead of passwords in a .properties file.
222
+ if (rootProject. hasProperty(' signingUseGpgCmd' )) {
223
+ useGpgCmd()
224
+ }
225
+ sign publishing. publications. maven
175
226
}
176
227
}
0 commit comments