-
Notifications
You must be signed in to change notification settings - Fork 88
/
build.gradle
258 lines (224 loc) · 9.02 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.5.3'
}
}
plugins {
id "com.gradle.plugin-publish" version "0.10.0"
id 'com.jfrog.bintray' version '1.8.4'
id 'java-gradle-plugin'
id 'java'
// Required for JFrog Artifactory repository
id 'jacoco'
id 'maven-publish'
// Required for Maven Nexus repository
id 'maven'
id 'signing'
id 'idea'
}
description = 'web3j Spring Boot Starter'
sourceCompatibility = 1.8
targetCompatibility = 1.8
ext {
web3jVersion = '4.0.3'
springBootVersion = '2.0.6.RELEASE'
ossrhUsername = project.hasProperty('ossrhUsername') ? project.property('ossrhUsername') : System.getenv('OSSRH_USERNAME')
ossrhPassword = project.hasProperty('ossrhPassword') ? project.property('ossrhPassword') : System.getenv('OSSRH_PASSWORD')
ossrhRepoUrl = project.hasProperty('ossrhRepoUrl') ? project.property('ossrhRepoUrl') : System.getenv('OSSRH_REPO_URL')
bintrayUser = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
bintrayKey = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
bintrayGpgPassphrase = project.hasProperty('bintrayGpgPassphrase') ? project.property('bintrayGpgPassphrase') : System.getenv('BINTRAY_GPG_PASSPHRASE')
isSnapshotVersion = project.version.endsWith("-SNAPSHOT")
manualRelease = project.hasProperty('manualRelease') ? project.property('manualRelease').toBoolean() : false
}
repositories {
mavenCentral()
}
dependencies {
compile "org.springframework.boot:spring-boot-autoconfigure:$springBootVersion",
"org.springframework.boot:spring-boot-actuator:$springBootVersion",
"org.springframework.boot:spring-boot-actuator-autoconfigure:$springBootVersion",
"org.springframework.boot:spring-boot-configuration-processor:$springBootVersion",
"org.web3j:core:$web3jVersion"
compile("org.springframework.boot:spring-boot-starter:$springBootVersion") {
exclude module: 'commons-logging'
}
testCompile 'junit:junit:4.12',
"org.springframework.boot:spring-boot-starter-test:$springBootVersion",
"org.springframework.boot:spring-boot-test:$springBootVersion"
}
configurations {
// We need to exclude these as they clash with gradle-4.10+
testRuntimeClasspath.exclude module: 'spring-boot-starter-logging'
testRuntimeClasspath.exclude module: "logback-classic"
testCompileClasspath.exclude module: 'spring-boot-starter-logging'
testCompileClasspath.exclude module: "logback-classic"
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar {
classifier 'sources'
}
pom {
name = project.name
description = project.description
url = "https://github.com/web3j/web3j-spring-boot-starter"
licenses {
license {
name = "The Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
distribution = "repo"
}
}
developers {
developer {
id = "conor10"
name = "Conor Svensson"
email = "[email protected]"
}
}
scm {
url = "https://github.com/web3j/web3j-spring-boot-starter"
connection = "scm:https://github.com/web3j/web3j-spring-boot-starter.git"
developerConnection = "scm:git://github.com/web3j/web3j-spring-boot-starter.git"
}
}
}
}
}
bintray {
user = bintrayUser
key = bintrayKey
publications = ['mavenJava']
publish = true
pkg {
repo = 'maven'
name = project.name
desc = project.description
userOrg = 'web3j'
licenses = ['Apache-2.0']
issueTrackerUrl = 'https://github.com/web3j/web3j-spring-boot-starter/issues'
vcsUrl = 'https://github.com/web3j/web3j-spring-boot-starter.git'
websiteUrl = 'https://web3j.io'
publicDownloadNumbers = true
version {
gpg {
sign = true
passphrase = bintrayGpgPassphrase
}
mavenCentralSync {
sync = true
user = ossrhUsername
password = ossrhPassword
close = '1'
}
}
}
}
artifacts {
archives sourcesJar, javadocJar
}
signing {
required { gradle.taskGraph.hasTask('uploadArchives') } // only execute as part of this task
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
onlyIf {
// Only run if this is a manual release triggered by a user, or an automated release for snapshots.
// We don't need to run this for automated releases.
isSnapshotVersion && ossrhUsername != '' && ossrhPassword != '' && ossrhRepoUrl != ''
}
repository(url: ossrhRepoUrl) {
authentication(
userName: ossrhUsername,
password: ossrhPassword
)
}
pom.project {
name 'web3j Spring Boot Starter'
packaging 'jar'
description project.description
url 'https://web3j.io'
scm {
url 'https://github.com/web3j/web3j-spring-boot-starter'
connection 'scm:https://github.com/web3j/web3j-spring-boot-starter.git'
developerConnection 'scm:git://github.com/web3j/web3j-spring-boot-starter.git'
}
licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'conor10'
name 'Conor Svensson'
email '[email protected]'
}
developer {
id 'ganchix'
name 'Rafael Ríos Moya'
email '[email protected]'
}
}
}
}
}
}
task release {
dependsOn 'build'
dependsOn 'uploadArchives'
doLast {
// Validates the user inputs before a release can be performed.
if (isSnapshotVersion) {
// Only need OSSRH details.
logger.lifecycle("About to perform {} snapshot release ...", manualRelease ? "a manual" : "an automated")
if (!ossrhUsername || !ossrhPassword || !ossrhRepoUrl) {
throw new InvalidUserDataException("Required parameters missing: 'ossrhUsername', 'ossrhPassword', 'ossrhRepoUrl'")
}
logger.lifecycle(" - ossrhUsername={}", ossrhUsername)
logger.lifecycle(" - ossrhPassword={}", ossrhPassword ? "provided" : "not_provided")
logger.lifecycle(" - ossrhRepoUrl={}", ossrhRepoUrl)
} else {
// Release => Need OSSRH and bintray.
if (!ossrhUsername || !ossrhPassword || !ossrhRepoUrl) {
throw new InvalidUserDataException("Required parameters missing: 'ossrhUsername', 'ossrhPassword', 'ossrhRepoUrl'")
}
if (!bintrayUser || !bintrayKey || !bintrayGpgPassphrase) {
throw new InvalidUserDataException("Required parameters missing: 'bintrayUser', 'bintrayKey', 'bintrayGpgPassphrase'")
}
logger.lifecycle("About to perform {} full release ...", manualRelease ? "a manual" : "an automated")
logger.lifecycle(" - ossrhUsername={}", ossrhUsername)
logger.lifecycle(" - ossrhPassword={}", ossrhPassword ? "provided" : "not_provided")
logger.lifecycle(" - ossrhRepoUrl={}", ossrhRepoUrl)
logger.lifecycle(" - bintrayUser={}", bintrayUser)
logger.lifecycle(" - bintrayKey={}", bintrayKey ? "provided" : "not_provided")
logger.lifecycle(" - bintrayGpgPassphrase={}", bintrayGpgPassphrase ? "provided" : "not_provided")
}
}
// Snapshots go to nexus, non-snapshots go to bintray.
if (isSnapshotVersion) {
dependsOn 'uploadArchives'
tasks.findByName('uploadArchives').mustRunAfter 'build'
} else {
dependsOn 'bintrayUpload'
tasks.findByName('bintrayUpload').mustRunAfter 'build'
}
}