-
Notifications
You must be signed in to change notification settings - Fork 26
/
build.gradle
192 lines (160 loc) · 5.32 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
import java.util.jar.JarEntry
import java.util.jar.JarFile
import java.util.jar.JarOutputStream
plugins {
id 'application'
id "jacoco"
id "org.sonarqube" version "5.1.0.4882"
}
def config = new ConfigSlurper().parse(new File("$projectDir/src/main/resources/version.properties").toURI().toURL())
group = 'co.rsk'
version = config.modifier?.trim() ? config.modifier + "-" + config.versionNumber : config.versionNumber
test {
useJUnitPlatform()
beforeTest { descriptor ->
logger.lifecycle("Running test: ${descriptor}")
}
jvmArgs '-Xss32m', '-Xmx3G'
testLogging {
events "failed"
exceptionFormat "short"
}
systemProperty "file.encoding", "UTF-8"
finalizedBy jacocoTestReport
}
jacocoTestReport {
reports {
xml.required = true
}
}
repositories {
mavenCentral()
maven {
url "https://deps.rsklabs.io"
}
}
sourceCompatibility = 17
mainClassName = 'co.rsk.federate.FederateRunner'
applicationDefaultJvmArgs = ["-server", "-Xss32m", "-Xms3g", "-XX:+UseCompressedOops", "-XX:-OmitStackTraceInFastThrow"]
tasks.withType(JavaCompile){
options.warnings = false
options.encoding = 'UTF-8'
options.compilerArgs << '-XDignore.symbol.file' // << "-Xlint:unchecked" << "-Xlint:deprecation"
}
tasks.withType(AbstractArchiveTask) {
preserveFileTimestamps = false
reproducibleFileOrder = true
dirMode = 0775
fileMode = 0664
}
ext {
bitcoinjcoreVersion = '0.15.6-rsk-3'
bitcoinjVersion = '0.14.4-rsk-16-SNAPSHOT'
commonsLang3Version = '3.12.0'
commonsIoVersion = '2.11.0'
slf4jVersion = '1.7.36'
javaxAnnotationApiVersion = '1.3.2'
jacksonDatabindVersion = '2.15.4'
typesafeVersion = '1.4.2'
logbackVersion = '1.2.11'
junitVersion = '5.10.3'
junitSuiteVersion = '1.10.3'
mockitoInlineVer = '5.2.0'
mockitoJupiterVer = '5.12.0'
rskjcoreVersion = '6.5.0-SNAPSHOT'
}
dependencies {
implementation "co.rsk:rskj-core:${rskjcoreVersion}"
implementation "org.bitcoinj:core:${bitcoinjcoreVersion}"
implementation "co.rsk.bitcoinj:bitcoinj-thin:${bitcoinjVersion}"
implementation "org.apache.commons:commons-lang3:${commonsLang3Version}"
implementation "commons-io:commons-io:${commonsIoVersion}"
implementation "org.slf4j:slf4j-api:${slf4jVersion}"
implementation "javax.annotation:javax.annotation-api:${javaxAnnotationApiVersion}"
implementation "com.fasterxml.jackson.core:jackson-databind:${jacksonDatabindVersion}"
implementation "com.typesafe:config:${typesafeVersion}"
runtimeOnly "org.slf4j:log4j-over-slf4j:${slf4jVersion}"
runtimeOnly "ch.qos.logback:logback-core:${logbackVersion}"
runtimeOnly "ch.qos.logback:logback-classic:${logbackVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-params:${junitVersion}"
testImplementation "org.junit.platform:junit-platform-suite:${junitSuiteVersion}"
testImplementation "org.mockito:mockito-inline:${mockitoInlineVer}"
testImplementation "org.mockito:mockito-junit-jupiter:${mockitoJupiterVer}"
}
javadoc {
options.author = true
options.header = "FedNode"
options.addStringOption('Xdoclint:none', '-quiet')
options.encoding = "UTF-8"
}
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar) {
archiveClassifier = 'javadoc'
from javadoc
}
def generatedResources = "$buildDir/generated-resources"
sourceSets {
main {
resources {
srcDirs += generatedResources
}
}
}
task generateResources {
doLast {
mkdir generatedResources
def generated = new File(generatedResources, 'build-info.properties')
def commitHash = gitCommitHash()
def currentBranch = gitCurrentBranch()
generated.text = """
build.hash=$commitHash
build.branch=$currentBranch
"""
}
}
jar {
from sourceSets.main.output.classesDirs
from sourceSets.main.output.resourcesDir
from generatedResources
}
task fatJar(type: Jar, dependsOn: jar) {
archiveClassifier = "all"
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes 'Main-Class': "$mainClassName"
}
exclude "META-INF/*.SF", "META-INF/*.DSA", "META-INF/*.RSA"
exclude "module-info.class"
for (def jar in configurations.runtimeClasspath.findAll { it.name.endsWith('jar') }.collect { zipTree(it) }) {
from(jar) {
eachFile { details -> amendPathIfNeeded(details) }
}
}
with jar
}
artifacts {
archives sourcesJar
archives javadocJar
archives fatJar
}
static def gitCurrentBranch() {
def process = "git rev-parse --abbrev-ref HEAD".execute()
return process.text.trim()
}
static def gitCommitHash() {
def process = "git rev-parse --short HEAD".execute()
return process.text.trim()
}
static def amendPathIfNeeded(details) {
def uPath = details.path.toUpperCase()
if (uPath.startsWith("META-INF/LICENSE") || uPath.startsWith("META-INF/NOTICE")) {
def originalFile = details.file as File
def jarName = originalFile.parentFile.parentFile.name.split(".jar")[0]
def newPath = originalFile.parentFile.name + "/" + jarName + "_" + originalFile.name
details.path = newPath
}
}