-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
196 lines (166 loc) · 4.01 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
plugins {
id 'java-library'
id 'jacoco'
id 'com.diffplug.spotless' version '6.20.0'
id 'maven-publish'
id "io.github.gradle-nexus.publish-plugin" version "1.3.0"
id 'signing'
id "net.ltgt.errorprone" version "3.1.0"
}
group = 'me.grapebaba'
version = '0.1.1'
repositories {
mavenCentral()
}
dependencies {
implementation 'com.squareup.okhttp3:okhttp:4.11.0'
implementation 'com.squareup.okhttp3:okhttp-sse:4.11.0'
api 'org.web3j:core:4.10.2'
implementation 'org.slf4j:slf4j-api:2.0.7'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.2'
implementation 'org.apache.commons:commons-lang3:3.13.0'
errorprone("com.google.errorprone:error_prone_core:2.18.0")
testImplementation platform('org.junit:junit-bom:5.9.1')
testImplementation 'org.junit.jupiter:junit-jupiter'
testImplementation 'org.apache.logging.log4j:log4j-slf4j2-impl:2.20.0'
testImplementation 'io.github.cdimascio:dotenv-java:3.0.0'
}
sourceSets.test.java {
srcDirs += "$projectDir/example"
}
test {
maxParallelForks = 1
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
finalizedBy jacocoTestReport
}
jacocoTestReport {
dependsOn test
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
"net/flashbots/models/**"
])
}))
}
reports {
csv.required = true
}
}
jacocoTestCoverageVerification {
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
"net/flashbots/models/**"
])
}))
}
violationRules {
rule {
limit {
minimum = 0.0
}
}
}
}
check {
dependsOn += jacocoTestCoverageVerification
}
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)
}
javadoc {
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
java {
withJavadocJar()
withSourcesJar()
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
spotless {
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 {
palantirJavaFormat()
formatAnnotations()
importOrder('java|javax', '\\#')
removeUnusedImports()
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom {
name = rootProject.name
description = 'Client library for Flashbots MEV-share Matchmaker.'
url = 'https://github.com/optimism-java/mev-share-java'
licenses {
license {
name = 'MIT License'
}
}
developers {
developer {
id = 'grapebaba'
name = 'Kai Chen'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:git://github.com/optimism-java/' + rootProject.name + '.git'
developerConnection = 'scm:git:ssh://github.com/optimism-java/' + rootProject.name + '.git'
url = 'https://github.com/optimism-java/' + rootProject.name
}
}
}
}
repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/optimism-java/" + 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)
}
nexusPublishing {
repositories {
sonatype()
}
}
tasks.register('printSourceDirs') {
print("$projectDir\n")
print(sourceSets)
}
tasks.register("execute", JavaExec) {
classpath = sourceSets.main.runtimeClasspath
classpath += sourceSets.test.runtimeClasspath
mainClass = mainClassName
}