@@ -11,53 +11,35 @@ buildscript {
11
11
12
12
// test dependencies
13
13
ext. equalsverifierVersion = ' 3.1.10'
14
- ext. junitVersion = ' 5.+ '
14
+ ext. junitVersion = ' 5.5.2 '
15
15
ext. junitBenchmarkVersion = ' 0.7.2'
16
16
ext. logbackVersion = ' 1.2.3'
17
- ext. mockitoVersion = ' 3.1.0'
18
17
ext. mockitoJunitVersion = " 3.1.0"
19
18
20
19
repositories { mavenCentral() }
21
-
22
- dependencies {
23
- classpath ' io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.5.3'
24
- classpath ' com.github.jengelman.gradle.plugins:shadow:1.2.4'
25
- }
26
20
}
27
21
28
22
plugins {
29
- id " com.jfrog.bintray" version " 1.8.4"
30
- id ' com.diffplug.gradle.spotless' version ' 3.23.1'
31
-
32
- // Required for JFrog Artifactory repository
33
- id ' jacoco'
34
- id ' maven-publish'
35
-
36
- // Required for Maven Nexus repository
37
- id ' maven'
38
- id ' signing'
23
+ id ' java'
39
24
id ' idea'
25
+ id ' jacoco'
26
+ id " com.diffplug.gradle.spotless" version " 3.25.0"
27
+ id ' io.codearte.nexus-staging' version ' 0.21.1'
40
28
}
41
29
42
- apply plugin : ' java'
43
- apply plugin : ' idea'
44
- // should only be applied to the root project, see
45
- // https://github.com/Codearte/gradle-nexus-staging-plugin#multi-project-build
46
- apply plugin : ' io.codearte.nexus-staging'
47
- apply plugin : ' jacoco'
48
- apply plugin : ' maven-publish'
49
30
50
31
description ' web3j base project'
51
32
52
33
allprojects {
34
+ apply plugin : ' java'
35
+ apply plugin : ' idea'
36
+ apply plugin : ' jacoco'
37
+ apply plugin : ' com.diffplug.gradle.spotless'
53
38
54
39
sourceCompatibility = 1.8
55
40
targetCompatibility = 1.8
56
41
57
- apply plugin : ' java'
58
- apply plugin : ' jacoco'
59
42
60
- apply plugin : ' com.diffplug.gradle.spotless'
61
43
spotless {
62
44
java {
63
45
// This path needs to be relative to each project
@@ -84,17 +66,15 @@ allprojects {
84
66
85
67
repositories { mavenCentral() }
86
68
87
- // We don't want any compiler warnings
88
69
compileJava {
89
70
options. compilerArgs << " -Xlint:unchecked" << " -Xlint:deprecation"
90
71
}
91
72
compileTestJava {
92
73
options. compilerArgs << " -Xlint:unchecked" << " -Xlint:deprecation"
93
74
}
94
75
95
- javadoc { options. encoding = ' UTF-8' }
96
-
97
- jacoco { toolVersion = ' 0.8.4' // See http://www.eclemma.org/jacoco/.
76
+ jacoco {
77
+ toolVersion = ' 0.8.4' // See http://www.eclemma.org/jacoco/.
98
78
}
99
79
100
80
jacocoTestReport {
@@ -104,10 +84,6 @@ allprojects {
104
84
tasks. withType(Test ) {
105
85
reports. html. destination = file(" ${ reporting.baseDir} /${ name} " )
106
86
}
107
- }
108
-
109
- subprojects {
110
- apply plugin : ' java'
111
87
112
88
dependencies {
113
89
testCompile " org.junit.jupiter:junit-jupiter:$junitVersion "
@@ -116,96 +92,55 @@ subprojects {
116
92
}
117
93
118
94
configure(subprojects. findAll { it. name != ' integration-tests' }) {
119
- // Required for Maven Nexus repository
120
95
apply plugin : ' maven'
121
96
apply plugin : ' signing'
122
97
123
- // Required for JFrog Artifactory repository
124
- apply plugin : ' maven-publish'
125
- apply plugin : ' com.jfrog.bintray'
98
+ ext {
99
+ ossrhUsername = project. hasProperty(' ossrhUsername' ) ? project. property(' ossrhUsername' ) : System . getenv(' OSSRH_USERNAME' )
100
+ ossrhPassword = project. hasProperty(' ossrhPassword' ) ? project. property(' ossrhPassword' ) : System . getenv(' OSSRH_PASSWORD' )
101
+ signingKey = project. hasProperty(' signingKey' ) ? project. property(' signingKey' ) : new File (" $rootDir /web3j.asc" ). getText(' UTF-8' )
102
+ signingPassword = project. hasProperty(' signingPassword' ) ? project. property(' signingPassword' ) : System . getenv(' GPG_PASSPHRASE' )
103
+ }
126
104
127
105
task javadocJar(type : Jar ) {
128
- classifier = ' javadoc'
106
+ archiveClassifier = ' javadoc'
129
107
from javadoc
130
108
}
131
109
132
110
task sourcesJar(type : Jar ) {
133
- classifier = ' sources'
111
+ archiveClassifier = ' sources'
134
112
from sourceSets. main. allSource
135
113
}
136
114
137
115
task testJar(type : Jar ) {
138
- classifier = ' tests'
116
+ archiveClassifier = ' tests'
139
117
from sourceSets. test. output
140
118
}
141
119
120
+ javadoc { options. encoding = ' UTF-8' }
121
+
142
122
artifacts { archives sourcesJar, javadocJar, testJar }
143
123
144
- ext {
145
- ossrhUsername = project. hasProperty(' ossrhUsername' ) ? project. property(' ossrhUsername' ) : System . getenv(' OSSRH_USERNAME' )
146
- ossrhPassword = project. hasProperty(' ossrhPassword' ) ? project. property(' ossrhPassword' ) : System . getenv(' OSSRH_PASSWORD' )
147
- ossrhRepoUrl = project. hasProperty(' ossrhRepoUrl' ) ? project. property(' ossrhRepoUrl' ) : System . getenv(' OSSRH_REPO_URL' )
148
- bintrayUser = project. hasProperty(' bintrayUser' ) ? project. property(' bintrayUser' ) : System . getenv(' BINTRAY_USER' )
149
- bintrayKey = project. hasProperty(' bintrayApiKey' ) ? project. property(' bintrayApiKey' ) : System . getenv(' BINTRAY_API_KEY' )
150
- bintrayGpgPassphrase = project. hasProperty(' bintrayGpgPassphrase' ) ? project. property(' bintrayGpgPassphrase' ) : System . getenv(' BINTRAY_GPG_PASSPHRASE' )
151
- isSnapshotVersion = project. version. endsWith(" -SNAPSHOT" )
152
- manualRelease = project. hasProperty(' manualRelease' ) ? project. property(' manualRelease' ). toBoolean() : false
124
+ signing {
125
+ sign configurations. archives
126
+ def signingKey = findProperty(" signingKey" )
127
+ def signingPassword = findProperty(" signingPassword" )
128
+ useInMemoryPgpKeys(signingKey, signingPassword)
153
129
}
154
130
155
- publishing {
156
- publications {
157
- mavenJava(MavenPublication ) {
158
- from components. java
159
-
160
- artifact sourcesJar { classifier ' sources' }
161
-
162
- artifact testJar { classifier ' tests' }
163
-
164
- artifact javadocJar { classifier ' javadoc' }
165
-
166
- pom {
167
- name = project. name
168
- description = project. description
169
- url = " https://github.com/web3j/web3j"
170
- licenses {
171
- license {
172
- name = " The Apache License, Version 2.0"
173
- url = " http://www.apache.org/licenses/LICENSE-2.0.txt"
174
- distribution = " repo"
175
- }
176
- }
177
- developers {
178
- developer {
179
- id = " conor10"
180
- name = " Conor Svensson"
181
-
182
- }
183
- }
184
- scm {
185
- connection = " scm:git:https://github.com/web3j/web3j.git"
186
- developerConnection = " scm:git://github.com/web3j/web3j.git"
187
- url = " https://github.com/web3j/web3j.git"
188
- }
189
- }
190
- }
191
- }
192
- }
131
+ archivesBaseName = project. name
193
132
194
133
uploadArchives {
195
134
repositories {
196
135
mavenDeployer {
136
+ beforeDeployment { MavenDeployment deployment -> signing. signPom(deployment) }
197
137
198
- onlyIf {
199
- // Only run if this is a manual release triggered by a user, or an automated release for snapshots.
200
- // We don't need to run this for automated releases.
201
- isSnapshotVersion && ossrhUsername != ' ' && ossrhPassword != ' ' && ossrhRepoUrl != ' '
138
+ repository(url : " https://oss.sonatype.org/service/local/staging/deploy/maven2/" ) {
139
+ authentication(userName : ossrhUsername, password : ossrhPassword)
202
140
}
203
141
204
- repository(url : ossrhRepoUrl) {
205
- authentication(
206
- userName : ossrhUsername,
207
- password : ossrhPassword
208
- )
142
+ snapshotRepository(url : " https://oss.sonatype.org/content/repositories/snapshots/" ) {
143
+ authentication(userName : ossrhUsername, password : ossrhPassword)
209
144
}
210
145
211
146
pom. project {
@@ -224,7 +159,6 @@ configure(subprojects.findAll { it.name != 'integration-tests' }) {
224
159
license {
225
160
name ' The Apache License, Version 2.0'
226
161
url ' http://www.apache.org/licenses/LICENSE-2.0.txt'
227
- distribution ' repo'
228
162
}
229
163
}
230
164
@@ -240,64 +174,6 @@ configure(subprojects.findAll { it.name != 'integration-tests' }) {
240
174
}
241
175
}
242
176
243
- bintray {
244
- user = bintrayUser
245
- key = bintrayKey
246
- publications = [' mavenJava' ]
247
- publish = true
248
- pkg {
249
- repo = ' maven'
250
- name = ' org.web3j'
251
- desc = project. description
252
- userOrg = ' web3j'
253
- licenses = [' Apache-2.0' ]
254
- issueTrackerUrl = ' https://github.com/web3j/web3j/issues'
255
- vcsUrl = ' https://github.com/web3j/web3j.git'
256
- websiteUrl = ' https://web3j.io'
257
- publicDownloadNumbers = true
258
-
259
- version {
260
- gpg {
261
- sign = true
262
- passphrase = bintrayGpgPassphrase
263
- }
264
- mavenCentralSync {
265
- sync = true
266
- user = ossrhUsername
267
- password = ossrhPassword
268
- close = ' 1'
269
- }
270
- }
271
- }
272
- }
273
-
274
- task release {
275
- dependsOn ' build'
276
-
277
- if (isSnapshotVersion) {
278
- logger. info(" - ossrhUsername={}" , ossrhUsername)
279
- logger. info(" - ossrhPassword={}" , ossrhPassword ? " provided" : " not_provided" )
280
- logger. info(" - ossrhRepoUrl={}" , ossrhRepoUrl)
281
- } else {
282
- logger. info(" About to perform {} full release ..." , manualRelease ? " a manual" : " an automated" )
283
- logger. info(" - ossrhUsername={}" , ossrhUsername)
284
- logger. info(" - ossrhPassword={}" , ossrhPassword ? " provided" : " not_provided" )
285
- logger. info(" - ossrhRepoUrl={}" , ossrhRepoUrl)
286
- logger. info(" - bintrayUser={}" , bintrayUser)
287
- logger. info(" - bintrayKey={}" , bintrayKey ? " provided" : " not_provided" )
288
- logger. info(" - bintrayGpgPassphrase={}" , bintrayGpgPassphrase ? " provided" : " not_provided" )
289
- }
290
-
291
- // Snapshots go to nexus, non-snapshots go to bintray.
292
- if (isSnapshotVersion) {
293
- dependsOn ' uploadArchives'
294
- tasks. findByName(' uploadArchives' ). mustRunAfter ' build'
295
- } else {
296
- dependsOn ' bintrayUpload'
297
- tasks. findByName(' bintrayUpload' ). mustRunAfter ' build'
298
- }
299
- }
300
-
301
177
task jacocoRootTestReport(type : org.gradle.testing.jacoco.tasks.JacocoReport ) {
302
178
dependsOn = subprojects. test
303
179
getSourceDirectories(). from(subprojects. sourceSets. main. allSource. srcDirs)
@@ -306,8 +182,6 @@ configure(subprojects.findAll { it.name != 'integration-tests' }) {
306
182
getExecutionData(). from(subprojects. jacocoTestReport. executionData)
307
183
reports { xml. enabled = true }
308
184
309
- onlyIf = { true }
310
-
311
185
doFirst {
312
186
executionData = files(executionData. findAll { it. exists() })
313
187
}
0 commit comments