forked from hyperledger-web3j/web3j
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
227 lines (188 loc) · 6.14 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
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.5.3'
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.4'
}
}
plugins {
id "com.jfrog.bintray" version "1.7.3"
}
apply plugin: 'java'
// Required for JFrog Artifactory repository
apply plugin: 'jacoco'
apply plugin: 'maven-publish'
// Required for Maven Nexus repository
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'idea'
apply plugin: 'io.codearte.nexus-staging'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'application'
group 'org.web3j'
version '1.0.6'
sourceCompatibility = 1.8
// We don't want any compiler warnings
compileJava {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
compileTestJava {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
jacoco {
toolVersion = '0.7.7.201606060606' // See http://www.eclemma.org/jacoco/.
}
jacocoTestReport {
reports {
xml.enabled true
}
afterEvaluate {
classDirectories = files(classDirectories.files.collect {
fileTree(dir: it,
exclude: ['org/web3j/abi/datatypes/generated/**'])
})
}
}
ext {
ossrhUsername = project.hasProperty('ossrhUsername') ? project.property('ossrhUsername') : ''
ossrhPassword = project.hasProperty('ossrhPassword') ? project.property('ossrhPassword') : ''
}
repositories {
mavenCentral()
jcenter()
}
// See https://www.petrikainulainen.net/programming/gradle/getting-started-with-gradle-integration-testing/
// exclude with: gradle clean build -x integrationTest
sourceSets {
integrationTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/integration-test/java')
}
resources.srcDir file('src/integration-test/resources')
}
}
configurations {
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
}
dependencies {
compile 'org.apache.httpcomponents:httpclient:4.5.2',
'com.fasterxml.jackson.core:jackson-databind:2.8.1',
'org.bouncycastle:bcprov-jdk15on:1.54',
'com.lambdaworks:scrypt:1.4.0',
'com.squareup:javapoet:1.7.0'
testCompile 'junit:junit:4.11',
'org.mockito:mockito-core:1.10.19'
}
task integrationTest(type: Test) {
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = sourceSets.integrationTest.runtimeClasspath
outputs.upToDateWhen { false } // always run integration tests regardless of if up to date
// view status of integration tests
testLogging {
events "passed", "skipped", "failed"
}
}
check.dependsOn integrationTest
integrationTest.mustRunAfter test
tasks.withType(Test) {
reports.html.destination = file("${reporting.baseDir}/${name}")
}
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'
}
}
}
}
bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
publications = ['mavenJava']
publish = true
pkg {
repo = 'maven'
name = 'org.web3j'
desc = 'web3j is a lightweight Java library for integration with Ethereum clients'
userOrg = 'web3j'
licenses = ['Apache-2.0']
issueTrackerUrl = 'https://github.com/web3j/web3j/issues'
vcsUrl = 'https://github.com/web3j/web3j.git'
websiteUrl = 'http://web3j.org'
publicDownloadNumbers = true
}
}
artifacts {
archives sourcesJar, javadocJar
}
signing {
required { gradle.taskGraph.hasTask('uploadArchives') } // only execute as part of this task
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/') {
authentication(
userName: ossrhUsername,
password: ossrhPassword
)
}
pom.project {
name 'web3j'
packaging 'jar'
description 'web3j is a lightweight Java library for integration with Ethereum clients'
url 'http://web3j.org'
scm {
connection 'scm:git:https://github.com/web3j/web3j.git'
url 'https://github.com/web3j/web3j.git'
}
licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id 'conor10'
name 'Conor Svensson'
email '[email protected]'
}
}
}
}
}
}
// Build command line library release with target distShadowZip
mainClassName = 'org.web3j.console.Runner'
applicationName = 'web3j'
task release {
// remove once integration tests are running as part of the build
check.dependsOn.remove(integrationTest)
dependsOn 'clean'
dependsOn 'build'
dependsOn 'uploadArchives'
dependsOn 'closeAndPromoteRepository'
dependsOn 'bintrayUpload'
tasks.findByName('build').mustRunAfter 'clean'
tasks.findByName('uploadArchives').mustRunAfter 'build'
tasks.findByName('closeAndPromoteRepository').mustRunAfter 'uploadArchives'
tasks.findByName('bintrayUpload').mustRunAfter 'build'
}