6
6
7
7
plugins {
8
8
id ' maven-publish'
9
- id ' jacoco'
10
9
id ' signing'
10
+ id ' org.jreleaser' version ' 1.18.0'
11
+ id ' jacoco'
11
12
id ' pmd'
12
13
}
13
14
@@ -137,7 +138,7 @@ jacocoTestCoverageVerification {
137
138
test. finalizedBy(jacocoTestReport)
138
139
test. finalizedBy(jacocoTestCoverageVerification)
139
140
140
- task licenseCheck {
141
+ tasks . register( ' licenseCheck' ) {
141
142
group = " license"
142
143
description = " Checks the License part of each source file"
143
144
@@ -146,34 +147,37 @@ task licenseCheck {
146
147
def missing = new LinkedList<File > ()
147
148
sourceSets. forEach {
148
149
sourceSet ->
149
- sourceSet. allSource. findAll { ! it. path. contains(" build" ) && ! (it. path. contains(" test" ) && it. path. contains(" resources" ))}. each {
150
+ sourceSet. allSource. findAll {
151
+ ! it. path. contains(" build" ) &&
152
+ ! (it. path. contains(" test" ) && it. path. contains(" resources" ))
153
+ }. each {
150
154
file ->
151
- if (! file. name. contains(" json" )){
152
- BufferedReader r = new BufferedReader (new FileReader (file))
153
- def line, hasSPDX = false , hasTraditional = false
154
- while ((line = r. readLine()) != null ) {
155
- if (line. contains(" SPDX-License-Identifier" )) {
156
- hasSPDX = true
157
- break
155
+ if (! file. name. contains(" json" )) {
156
+ BufferedReader r = new BufferedReader (new FileReader (file))
157
+ def line, hasSPDX = false , hasTraditional = false
158
+ while ((line = r. readLine()) != null ) {
159
+ if (line. contains(" SPDX-License-Identifier" )) {
160
+ hasSPDX = true
161
+ break
162
+ }
163
+ if (line. contains(" http://www.apache.org/licenses/LICENSE-2.0" )) {
164
+ hasTraditional = true
165
+ break
166
+ }
158
167
}
159
- if (line. contains(" http://www.apache.org/licenses/LICENSE-2.0" )) {
160
- hasTraditional = true
161
- break
162
- }
163
- }
164
- if (! hasSPDX) {
165
- if (hasTraditional) {
166
- noSPDX. add(file)
167
- } else {
168
- missing. add(file)
168
+ if (! hasSPDX) {
169
+ if (hasTraditional) {
170
+ noSPDX. add(file)
171
+ } else {
172
+ missing. add(file)
173
+ }
169
174
}
170
175
}
171
- }
172
176
}
173
177
}
174
178
175
179
if (noSPDX. isEmpty()) {
176
- println " All remaining files have Apache 2.0 headers"
180
+ println " All remaining files have Apache 2.0 headers. "
177
181
} else {
178
182
println " We are standardizing with the SPDX style license headers."
179
183
println " The following files contain the traditional license headers which are still valid:"
@@ -212,17 +216,13 @@ javadoc {
212
216
213
217
classpath = sourceSets. main. runtimeClasspath
214
218
215
- javadoc. options. addStringOption(' Xdoclint:none' , ' -quiet' )
219
+ options. addStringOption(' Xdoclint:none' , ' -quiet' )
220
+ options. addStringOption(' Xwerror' , ' -quiet' )
216
221
options. overview = " src/main/java/org/hyperledger/fabric/overview.html"
217
- }
218
222
219
- if (JavaVersion . current(). isJava8Compatible()) {
220
- project. tasks. withType(Javadoc ) {
221
- options. addStringOption(' Xdoclint:all' , ' -quiet' )
222
- options. addStringOption(' Xwerror' , ' -quiet' )
223
- }
224
223
}
225
224
225
+ def final stagingDeployUrl = layout. buildDirectory. dir(' staging-deploy' )
226
226
227
227
publishing {
228
228
publications {
@@ -235,10 +235,12 @@ publishing {
235
235
name = ' JavaChaincodeShim'
236
236
packaging = ' jar'
237
237
description = ' Hyperledger Fabric Java Chaincode Shim'
238
- url = ' http ://www. hyperledger.org /'
238
+ url = ' https ://hyperledger.github.io/fabric-chaincode-java /'
239
239
240
240
scm {
241
- url = ' https://github.com/hyperledger/fabric-chaincode-java.git'
241
+ connection = ' scm:git:https://github.com/hyperledger/fabric-chaincode-java.git'
242
+ developerConnection = ' scm:git:ssh://github.com:hyperledger/fabric-chaincode-java.git'
243
+ url = ' https://github.com/hyperledger/fabric-chaincode-java'
242
244
}
243
245
licenses {
244
246
license {
@@ -248,26 +250,16 @@ publishing {
248
250
}
249
251
250
252
developers {
251
- developer {
252
- id = ' gennadylaventman'
253
- name = ' Gennady Laventman'
254
- email = ' gennady@il.ibm.com'
255
- }
256
- developer {
257
- id = ' luiss'
258
- name = ' Luis Sanchez'
259
- email = ' luiss@me.com'
260
- }
261
- developer {
262
- id = ' C0rWin'
263
- name = ' Artem Barger'
264
- email = ' bartem@il.ibm.com'
265
- }
266
253
developer {
267
254
id = ' denyeart'
268
255
name = ' David Enyeart'
269
256
email = ' enyeart@us.ibm.com'
270
257
}
258
+ developer {
259
+ id = ' bestbeforetoday'
260
+ name = ' Mark S. Lewis'
261
+ email = ' Mark.S.Lewis@outlook.com'
262
+ }
271
263
}
272
264
}
273
265
}
@@ -276,17 +268,12 @@ publishing {
276
268
277
269
repositories {
278
270
maven {
279
- name = " release"
280
- url = " https://oss.sonatype.org/service/local/staging/deploy/maven2/"
281
- credentials {
282
- username = project. findProperty(' ossrhUsername' )
283
- password = project. findProperty(' ossrhPassword' )
284
- }
285
-
271
+ name = " Staging"
272
+ url = stagingDeployUrl
286
273
}
287
274
288
275
maven {
289
- name = " GitHubPackages "
276
+ name = " GitHub "
290
277
url = " https://maven.pkg.github.com/hyperledger/fabric-chaincode-java"
291
278
credentials {
292
279
username = System . getenv(" GITHUB_ACTOR" )
@@ -297,25 +284,42 @@ publishing {
297
284
}
298
285
299
286
signing {
300
- println " Signing"
301
- if (project. findProperty(' signing.key' )) {
302
- def signingKey = project. findProperty(' signing.key' )
303
- def signingPassword = project. findProperty(' signing.password' )
304
- useInMemoryPgpKeys(signingKey, signingPassword)
305
-
306
- sign publishing. publications. shim
307
- println " ... signed"
308
- } else {
309
- println " ... no keys to use "
287
+ required = { gradle. taskGraph. hasTask(" :${ project.name} :publishShimPublicationToStagingRepository" ) }
288
+
289
+ def signingKey = findProperty(' signingKey' )
290
+ def signingPassword = findProperty(' signingPassword' )
291
+ useInMemoryPgpKeys(signingKey, signingPassword)
292
+
293
+ sign publishing. publications. shim
294
+ }
295
+
296
+ jreleaser {
297
+ gitRootSearch = true
298
+ deploy {
299
+ maven {
300
+ mavenCentral {
301
+ sonatype {
302
+ active = ' ALWAYS'
303
+ url = ' https://central.sonatype.com/api/v1/publisher'
304
+ sign = false
305
+ stagingRepository(file(stagingDeployUrl). toString())
306
+ }
307
+ }
308
+ }
309
+ }
310
+ release {
311
+ github {
312
+ enabled = false
313
+ }
310
314
}
311
315
}
312
316
313
317
// Need to specify the sourcesJar task BEFORE the java{withSourcesJar()} so that it picks up the duplicatesStratergy
314
318
// otherwise this fails with a duplicates error.
315
319
// (see https://github.com/gradle/gradle/issues/17236)
316
320
317
- task sourcesJar ( type : Jar ) {
318
- duplicatesStrategy = ' include '
321
+ tasks . register( ' sourcesJar ' , Jar ) {
322
+ duplicatesStrategy = DuplicatesStrategy . INCLUDE
319
323
archiveClassifier = ' sources'
320
324
from sourceSets. main. allSource
321
325
}
@@ -332,16 +336,16 @@ build.dependsOn licenseCheck
332
336
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
333
337
import org.gradle.api.tasks.testing.logging.TestLogEvent
334
338
335
- tasks. withType(Test ) {
339
+ tasks. withType(Test ). configureEach {
336
340
337
341
environment " CORE_PEER_LOCALMSPID" , " mymsp"
338
342
339
343
testLogging {
340
344
// set options for log level LIFECYCLE
341
345
events TestLogEvent . FAILED ,
342
- TestLogEvent . PASSED ,
343
- TestLogEvent . SKIPPED ,
344
- TestLogEvent . STANDARD_OUT
346
+ TestLogEvent . PASSED ,
347
+ TestLogEvent . SKIPPED ,
348
+ TestLogEvent . STANDARD_OUT
345
349
exceptionFormat = TestExceptionFormat . FULL
346
350
showExceptions = true
347
351
showCauses = true
@@ -350,22 +354,23 @@ tasks.withType(Test) {
350
354
// set options for log level DEBUG and INFO
351
355
debug {
352
356
events TestLogEvent . STARTED ,
353
- TestLogEvent . FAILED ,
354
- TestLogEvent . PASSED ,
355
- TestLogEvent . SKIPPED ,
356
- TestLogEvent . STANDARD_ERROR ,
357
- TestLogEvent . STANDARD_OUT
357
+ TestLogEvent . FAILED ,
358
+ TestLogEvent . PASSED ,
359
+ TestLogEvent . SKIPPED ,
360
+ TestLogEvent . STANDARD_ERROR ,
361
+ TestLogEvent . STANDARD_OUT
358
362
exceptionFormat = TestExceptionFormat . FULL
359
363
}
360
364
info. events = debug. events
361
365
info. exceptionFormat = debug. exceptionFormat
362
366
363
- afterSuite { desc , result ->
367
+ afterSuite {desc , result ->
364
368
if (! desc. parent) { // will match the outermost suite
365
369
def output = " Results: ${ result.resultType} (${ result.testCount} tests, ${ result.successfulTestCount} successes, ${ result.failedTestCount} failures, ${ result.skippedTestCount} skipped)"
366
370
def startItem = ' | ' , endItem = ' |'
367
371
def repeatLength = startItem. length() + output. length() + endItem. length()
368
- println (' \n ' + (' -' * repeatLength) + ' \n ' + startItem + output + endItem + ' \n ' + (' -' * repeatLength))
372
+ println (' \n ' + (' -' * repeatLength) + ' \n ' + startItem + output + endItem + ' \n ' +
373
+ (' -' * repeatLength))
369
374
}
370
375
}
371
376
}
0 commit comments