-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
294 lines (244 loc) · 9.05 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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
buildscript {
ext.asmVersion = '9.3'
ext.bouncycastleVersion = '1.70'
ext.grpcProtobufVersion = '1.49.0'
ext.jacksonVersion = '2.13.4.2'
ext.javaWebSocketVersion = '1.5.3'
ext.jnaVersion = '5.12.1'
ext.neofsApiJavaVersion = '2.14.0-SNAPSHOT' // Replace with non-snapshot version once officially released.
ext.neofsSharedLibVersion = '0.0.10'
ext.okhttpVersion = '4.10.0'
ext.protobufJavaUtilVersion = '3.21.9'
ext.rxjavaVersion = '2.2.21'
ext.slf4jVersion = '1.7.36'
// test dependencies
ext.awaitility = '4.2.0'
ext.equalsverifierVersion = '3.10.1'
ext.hamcrestVersion = '1.3'
ext.junitVersion = '4.13.2'
ext.junitBenchmarkVersion = '0.7.2'
ext.jetbrainsAnnotationsVersion = '23.0.0'
ext.jupiterVersion = '5.9.0'
ext.logbackVersion = '1.2.11'
ext.mockitoVersion = '3.6.0'
ext.testcontainersVersion = '1.17.6'
ext.wiremockVersion = '2.35.0'
repositories {
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id 'org.unbroken-dome.test-sets' version '3.0.1' apply false
id 'io.github.gradle-nexus.publish-plugin' version '1.0.0' apply true
id 'com.gradle.plugin-publish' version '0.12.0' apply false
id 'jacoco' apply true
}
description 'neow3j Project'
ext {
publishSonaTypeUsername = project.hasProperty('nexusUsername') ? project.property('nexusUsername') : ''
publishSonaTypePassword = project.hasProperty('nexusPassword') ? project.property('nexusPassword') : ''
publishGitHubUsername = project.hasProperty('githubUsername') ? project.property('githubUsername') : ''
publishGitHubPassword = project.hasProperty('githubPassword') ? project.property('githubPassword') : ''
}
nexusPublishing {
repositories {
sonatype {
nexusUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
snapshotRepositoryUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/")
username = publishSonaTypeUsername
password = publishSonaTypePassword
}
github {
nexusUrl = uri("https://maven.pkg.github.com/neow3j/neow3j/")
snapshotRepositoryUrl = uri("https://maven.pkg.github.com/neow3j/neow3j/")
username = publishGitHubUsername
password = publishGitHubPassword
}
}
}
allprojects { thisproject ->
apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'idea'
apply plugin: 'signing'
//apply plugin: 'checkstyle'
group 'io.neow3j'
version '3.19.4'
archivesBaseName = "${thisproject.name}"
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
if (project.hasProperty('snapshot')) {
version = version + '-SNAPSHOT'
}
repositories {
mavenLocal()
mavenCentral()
}
// We don't want any compiler warnings
compileJava {
options.encoding = 'UTF-8'
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
compileTestJava {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
javadoc {
options.encoding = 'UTF-8'
}
jacoco {
toolVersion = '0.8.6' // See http://www.eclemma.org/jacoco/.
}
jacocoTestReport {
reports {
xml.enabled true
html.enabled true
}
}
tasks.withType(Test) {
reports.html.destination = file("${reporting.baseDir}/${name}")
}
// checkstyle {
// toolVersion = "7.7"
// configFile = file("${rootProject.projectDir}/config/checkstyle/checkstyle.xml")
// }
}
subprojects {
apply plugin: 'java'
apply plugin: 'org.unbroken-dome.test-sets'
if (project.name.startsWith('gradle-plugin')) {
apply plugin: 'java-gradle-plugin'
apply plugin: 'com.gradle.plugin-publish'
}
dependencies {
testImplementation "org.junit.jupiter:junit-jupiter:$jupiterVersion",
"org.mockito:mockito-core:$mockitoVersion",
"org.hamcrest:hamcrest-all:$hamcrestVersion"
}
test {
useJUnitPlatform()
}
task javadocsJar(type: Jar) {
archiveClassifier = 'javadoc'
from javadoc
}
task sourcesJar(type: Jar) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
task testsJar(type: Jar) {
archiveClassifier = 'tests'
from sourceSets.test.output
}
javadoc { options.encoding = 'UTF-8' }
artifacts { archives sourcesJar, javadocsJar, testsJar }
// We just avoid to publish the root project and the test-properties project.
// The gradle-plugin module is fine and desirable to publish to JFrog/SonaType.
// In addition the gradle-plugin module should be published to the Gradle Plugin
// global repository. See "gradle-plugin/README.md" for Gradle Plugin
// release procedures.
if (project.name != rootProject.name) {
apply plugin: 'maven-publish'
publishing {
publications {
mavenJava(MavenPublication) {
artifactId "${project.name}"
from components.java
artifact sourcesJar
artifact javadocsJar
artifact testsJar
pom {
name = 'neow3j'
description.set(project.provider({ project.description }))
url = 'https://neow3j.io'
scm {
url = 'https://github.com/neow3j/neow3j'
connection = 'scm:https://github.com/neow3j/neow3j.git'
developerConnection = 'scm:https://github.com/neow3j/neow3j.git'
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'gsmachado'
name = 'Guilherme Sperb Machado'
email = 'guil@axlabs.com'
}
developer {
id = 'csmuller'
name = 'Claude Müller'
email = 'claude@axlabs.com'
}
developer {
id = 'mialbu'
name = 'Michael Bucher'
email = 'michael@axlabs.com'
}
}
}
}
}
}
signing {
// only execute as part of this task
required {
gradle.taskGraph.hasTask('publish')
}
sign publishing.publications.mavenJava
}
task release {
dependsOn 'build'
dependsOn 'publish'
tasks.findByName('publish').mustRunAfter 'build'
}
task bundleJar(type: Jar) {
dependsOn publishToMavenLocal
manifest.from jar.manifest
archiveClassifier = 'all'
from(javadocsJar, sourcesJar, javadocsJar, testsJar, jar)
from("${buildDir}/libs") {
include '*.jar.asc'
}
from("${buildDir}/publications/mavenJava") {
include 'pom-default.xml.asc'
include 'pom-default.xml'
rename 'pom-default.xml.asc', "${project.name}-${project.version}.pom.asc"
rename 'pom-default.xml', "${project.name}-${project.version}.pom"
}
}
}
}
task allJars {
// Adds as dependency all tasks in sub-projects that
// has the type "Jar". This includes, for example, the
// integration tests.
dependsOn subprojects.collect { it.tasks.withType(Jar) }
}
task jacocoRootTestReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
dependsOn = subprojects.test
getAdditionalSourceDirs().from(subprojects.sourceSets.main.allSource.srcDirs)
getSourceDirectories().from(subprojects.sourceSets.main.allSource.srcDirs)
getClassDirectories().from(subprojects.sourceSets.main.output)
getExecutionData().from(files(subprojects.jacocoTestReport.executionData).filter { f -> f.exists() })
reports {
xml.enabled = true
html.enabled = true
}
afterEvaluate {
classDirectories.setFrom(files(getClassDirectories().files.collect {
fileTree(
dir: it,
// here we specify which path/modules should be
// excluded from the jacoco reports
exclude: [
'**/io/neow3j/devpack/**',
'**/io/neow3j/test/**',
]
)
}))
}
}