forked from GrapeBaBa/sui4j
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
272 lines (240 loc) · 7.27 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
plugins {
id 'java-library'
id "checkstyle"
id "jacoco"
id "com.diffplug.spotless" version "6.11.0"
id 'org.unbroken-dome.test-sets' version '4.0.0'
id 'maven-publish'
id "io.github.gradle-nexus.publish-plugin" version "1.1.0"
id 'signing'
}
group 'me.grapebaba'
version '0.4.1'
repositories {
mavenCentral()
}
dependencies {
// https://mvnrepository.com/artifact/com.google.guava/guava
implementation 'com.google.guava:guava:31.1-jre'
// https://mvnrepository.com/artifact/com.google.code.gson/gson
implementation 'com.google.code.gson:gson:2.10'
// https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp
implementation 'com.squareup.okhttp3:okhttp:4.10.0'
// https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
implementation 'org.apache.commons:commons-lang3:3.12.0'
// https://mvnrepository.com/artifact/org.slf4j/slf4j-api
implementation 'org.slf4j:slf4j-api:2.0.5'
// https://mvnrepository.com/artifact/org.bitcoinj/bitcoinj-core
implementation('org.bitcoinj:bitcoinj-core:0.16.1') {
exclude group: 'org.slf4j', module: 'slf4j-api'
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
exclude group: 'com.google.guava', module: 'guava'
exclude group: 'com.google.protobuf', module: 'protobuf-javalite'
exclude group: 'net.jcip', module: 'jcip-annotations'
}
// https://mvnrepository.com/artifact/io.reactivex.rxjava3/rxjava
implementation 'io.reactivex.rxjava3:rxjava:3.1.5'
// https://mvnrepository.com/artifact/com.squareup.okhttp3/mockwebserver
testImplementation 'com.squareup.okhttp3:mockwebserver:4.10.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.0'
// https://mvnrepository.com/artifact/org.junit.platform/junit-platform-suite-api
testImplementation 'org.junit.platform:junit-platform-suite-api:1.9.1'
// https://mvnrepository.com/artifact/org.junit.platform/junit-platform-suite-engine
testRuntimeOnly 'org.junit.platform:junit-platform-suite-engine:1.9.1'
testRuntimeOnly 'org.junit.platform:junit-platform-reporting:1.9.1'
}
test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
finalizedBy jacocoTestReport
}
jacocoTestReport {
dependsOn test
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
"com/novi/**",
"io/sui/bcsgen/**",
"io/sui/models/**",
"io/sui/jsonrpc/JsonRpc20Request.class",
"io/sui/jsonrpc/JsonRpc20Response*.class",
"io/sui/Sui.class"
])
}))
}
reports {
csv.required = true
}
}
jacocoTestCoverageVerification {
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
"com/novi/**",
"io/sui/bcsgen/**",
"io/sui/models/**",
"io/sui/jsonrpc/JsonRpc20Request.class",
"io/sui/jsonrpc/JsonRpc20Response*.class",
"io/sui/Sui.class"
])
}))
}
violationRules {
rule {
limit {
minimum = 0.3
}
}
}
}
checkstyle {
toolVersion = checkstyleVersion
// default checkstyle config -- specific to your team agreement
configFile = project(":").file("config/checkstyle/google_checks.xml")
// Google style (idiosyncratic to Google):
// configFile = project(":").file("config/checkstyle/google_checks.xml")
// SUN style (closest to modern Java styles) -- the basis for this project:
// configFile = project(":").file("config/checkstyle/sun_checks.xml")
ignoreFailures = false
maxWarnings = 0
}
spotless {
// optional: limit format enforcement to just the files changed by this feature branch
ratchetFrom 'origin/main'
format 'misc', {
// define the files to apply `misc` to
target '*.gradle', '*.md', '.gitignore'
// define the steps to apply to those files
trimTrailingWhitespace()
indentWithTabs() // or spaces. Takes an integer argument if you don't like 4
endWithNewline()
}
java {
// Use the default importOrder configuration
// don't need to set target, it is inferred from java
// apply a specific flavor of google-java-format
googleJavaFormat("1.7")
// fix formatting of type annotations
formatAnnotations()
// make sure every file has the following copyright header.
// optionally, Spotless can set copyright years by digging
// through git history (see "license" section below)
licenseHeaderFile project(":").file("config/spotless/java.license")
importOrder()
removeUnusedImports()
targetExclude("src/main/java/com/**/*.java","src/main/java/io/sui/bcsgen/*.java")
}
}
//task docs(type: Javadoc) {
// source = sourceSets.main.allJava
//}
testSets {
integrationTest
}
// Make all tests use JUnit 5
tasks.withType(Test) {
useJUnitPlatform()
}
check {
dependsOn += jacocoTestCoverageVerification
// dependsOn += integrationTest
}
tasks.withType(Test).configureEach {
def outputDir = reports.junitXml.outputLocation
jvmArgumentProviders << ({
[
"-Djunit.platform.reporting.open.xml.enabled=true",
"-Djunit.platform.reporting.output.dir=${outputDir.get().asFile.absolutePath}"
]
} as CommandLineArgumentProvider)
}
java {
withJavadocJar()
withSourcesJar()
}
publishing {
publications {
mavenJava(MavenPublication) {
// artifactId = rootProject.name
from components.java
// versionMapping {
// usage('java-api') {
// fromResolutionOf('runtimeClasspath')
// }
// usage('java-runtime') {
// fromResolutionResult()
// }
// }
pom {
name = rootProject.name
description = 'A java SDK for @MystenLabs/sui blockchain.'
url = 'https://github.com/GrapeBaBa/sui4j'
// properties = [
// myProp: "value",
// "prop.with.dots": "anotherValue"
// ]
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'grapebaba'
name = 'Kai Chen'
email = '281165273grape@gmail.com'
}
}
scm {
connection = 'scm:git:git://github.com/GrapeBaBa/' + rootProject.name + '.git'
developerConnection = 'scm:git:ssh://github.com/GrapeBaBa/' + rootProject.name + '.git'
url = 'https://github.com/GrapeBaBa/' + rootProject.name
}
}
}
}
repositories {
// maven {
// name = "OSSRH"
// // change URLs to point to your repos, e.g. http://my.org/repo
// def releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
// def snapshotsRepoUrl = 'https://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/GrapeBaBa/" + rootProject.name
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
signing {
sign publishing.publications.mavenJava
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
}
javadoc {
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
nexusPublishing {
repositories {
sonatype()
}
}
checkstyleMain
.exclude('io/sui/bcsgen/*.java')
.exclude('com/novi/**/*.java')