-
Notifications
You must be signed in to change notification settings - Fork 26
/
build.gradle
228 lines (201 loc) · 8.15 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
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins {
id 'java-library'
id 'io.freefair.lombok' version "${lombokPluginVersion}"
id 'jacoco'
id 'signing'
id 'maven-publish'
id('io.github.gradle-nexus.publish-plugin') version '1.1.0'
}
apply plugin: 'java'
group = 'network.casper'
// Version number update for release
version='2.5.10'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots' }
}
dependencies {
implementation "dev.oak3:sbs4j:${sbs4jVersion}"
implementation "io.github.oak:jsonrpc4j:${jsonrpc4jVersion}"
implementation "org.bouncycastle:bcpkix-jdk15on:${bouncyCastleVersion}"
implementation "org.web3j:core:${web3jVersion}"
implementation "com.fasterxml.jackson.core:jackson-core:${jacksonVersion}"
implementation "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}"
implementation "com.fasterxml.jackson.core:jackson-annotations:${jacksonVersion}"
implementation "org.javatuples:javatuples:${javaTuplesVersion}"
implementation "joda-time:joda-time:${jodaTimeVersion}"
implementation "org.apache.cxf:cxf-rt-rs-client:${cxfRtRsSseVersion}"
implementation "org.apache.cxf:cxf-rt-rs-sse:${cxfRtRsSseVersion}"
// log4j and slf4j
compileOnly "org.slf4j:slf4j-api:${slf4jApiVersion}"
testImplementation "commons-io:commons-io:${commonsIoVersion}"
testImplementation "org.apache.logging.log4j:log4j-api:${log4jVersion}"
testImplementation "org.apache.logging.log4j:log4j-core:${log4jVersion}"
testImplementation "org.apache.logging.log4j:log4j-slf4j-impl:${log4jVersion}"
testImplementation "com.jayway.jsonpath:json-path-assert:${jsonPathAssertVersion}"
testImplementation "com.squareup.okhttp3:mockwebserver:${mockwebserverVersion}"
// Use JUnit Jupiter for testing.
testImplementation "org.junit.jupiter:junit-jupiter:${jupiterVersion}"
// Used to compare json strings while testing
testImplementation "org.skyscreamer:jsonassert:${jsonassertVersion}"
// Use for local testing of NCTL
// testImplementation files('assets')
}
java {
withJavadocJar()
withSourcesJar()
}
task casperJar(type: Jar) {
archiveBaseName = 'casper-java-sdk'
archiveVersion = "${version}"
from { configurations.compileClasspath.findAll { it.isDirectory() ? it : zipTree(it) } }
with jar
}
javadoc {
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
nexusPublishing {
repositories {
sonatype { //only for users registered in Sonatype after 24 Feb 2021
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username.set(System.getenv('MAVEN_USERNAME'))
password.set(System.getenv('MAVEN_PASSWORD'))
}
}
}
test {
finalizedBy jacocoTestReport
useJUnitPlatform()
testLogging {
//showStandardStreams true
// set options for log level LIFECYCLE
events TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED
//TestLogEvent.STANDARD_OUT
exceptionFormat TestExceptionFormat.FULL
showExceptions true
showCauses true
//showStackTraces true
// set options for log level DEBUG and INFO
debug {
events TestLogEvent.STARTED,
TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_ERROR
TestLogEvent.STANDARD_OUT
exceptionFormat TestExceptionFormat.FULL
}
//info.events = debug.events
//info.exceptionFormat = debug.exceptionFormat
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} passed, ${result.failedTestCount} failed, ${result.skippedTestCount} skipped)"
def startItem = '| ', endItem = ' |'
def repeatLength = startItem.length() + output.length() + endItem.length()
println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength))
}
}
}
}
jacocoTestReport {
dependsOn test
afterEvaluate {
getClassDirectories().setFrom(classDirectories.files.collect {
fileTree(dir: it, exclude: '**/exception/**')
})
}
}
publishing {
repositories {
maven {
name = 'OSSRH'
def releasesRepoUrl = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
def snapshotsRepoUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = System.getenv('MAVEN_USERNAME')
password = System.getenv('MAVEN_PASSWORD')
}
}
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/casper-network/casper-java-sdk"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
publications {
mavenJava(MavenPublication) {
artifactId = 'casper-java-sdk'
from components.java
pom {
name = 'Casper Java SDK'
packaging = 'jar'
description = 'SDK to streamline the 3rd party Java client integration processes. Such 3rd parties include exchanges & app developers.'
url = 'https://github.com/casper-network/casper-java-sdk'
scm {
connection = 'scm:git:https://github.com/casper-network/casper-java-sdk.git'
developerConnection = '[email protected]:casper-network/casper-java-sdk.git'
url = 'https://github.com/casper-network/casper-java-sdk'
}
issueManagement {
system = 'GitHub'
url = 'https://github.com/casper-network/casper-java-sdk/issues'
}
ciManagement {
system = 'Github Actions'
url = 'https://github.com/casper-network/casper-java-sdk/actions'
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'oak'
name = 'Alexandre Carvalho'
email = '[email protected]'
}
developer {
id = 'ab3rtz'
name = 'Andre Bertolace'
email = '[email protected]'
}
developer {
id = 'meywood'
name = 'Ian Mills'
email = '[email protected]'
}
developer {
id = 'stormeye'
name = 'Carl Norburn'
email = '[email protected]'
}
}
}
}
}
jar {
archiveClassifier = ''
}
// Reference at https://docs.gradle.org/current/userguide/signing_plugin.html#sec:in-memory-keys
signing {
def signingKey = System.getenv('GPG_SIGNING_KEY') ?: findProperty('GPG_SIGNING_KEY')
def signingKeyPassword = System.getenv('GPG_SIGNING_KEY_PASSWORD') ?: findProperty('GPG_SIGNING_KEY_PASSWORD')
useInMemoryPgpKeys(signingKey, signingKeyPassword)
sign publishing.publications.mavenJava
}
}