-
Notifications
You must be signed in to change notification settings - Fork 39
/
build.gradle
303 lines (264 loc) · 8.8 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
295
296
297
298
299
300
301
302
303
plugins {
id 'java'
id 'application'
id 'jacoco'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'org.owasp.dependencycheck' version '8.2.1'
}
def getVersionName() {
def errOut = new ByteArrayOutputStream()
try {
def stdOut = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags'
standardOutput = stdOut
errorOutput = errOut
}
// strip of leading "v"
return stdOut.toString().trim().substring(1)
} catch (ignore) {
logger.info('Error running git describe (' + errOut.toString().trim() + '), defaulting to 0.0.0')
return '0.0.0'
}
}
project.group = 'org.pharmgkb'
project.version = getVersionName()
ext {
moduleName = 'org.pharmgkb.pharmcat'
description = 'The Pharmacogenomic Clinical Annotation Tool'
url = 'https://github.com/PharmGKB/PharmCAT.git'
scm = 'scm:git@github.com:PharmGKB/PharmCAT.git'
orgName = 'PharmGKB'
orgUrl = 'https://www.pharmgkb.org'
mainClassName = "org.pharmgkb.pharmcat.PharmCAT"
archiveBaseName = "pharmcat"
}
def dataDir = System.env.PHARMCAT_DATA_DIR == null ? 'build' : System.env.PHARMCAT_DATA_DIR
repositories {
mavenCentral()
}
dependencies {
implementation(
[group: 'ch.qos.logback', name: 'logback-classic', version: '1.5.6'],
[group: 'commons-cli', name: 'commons-cli', version: '1.7.0'],
[group: 'commons-codec', name: 'commons-codec', version: '1.16.1'],
[group: 'commons-io', name: 'commons-io', version: '2.16.1'],
[group: 'com.github.jknack', name: 'handlebars', version: '4.4.0'],
[group: 'com.google.code.gson', name: 'gson', version: '2.10.1'],
[group: 'com.google.guava', name: 'guava', version: '33.1.0-jre'],
[group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1'],
// used by poi; adding because transitive dependency has a security alert
[group: 'org.apache.commons', name: 'commons-compress', version: '1.26.1'],
[group: 'org.apache.commons', name: 'commons-lang3', version: '3.14.0'],
[group: 'org.apache.commons', name: 'commons-text', version: '1.12.0'],
[group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.14'],
[group: 'org.apache.logging.log4j', name: 'log4j-to-slf4j', version: '2.23.1'],
[group: 'org.apache.poi', name: 'poi-ooxml', version: '5.2.5'],
[group: 'org.checkerframework', name: 'checker-qual', version: '3.39.0'],
[group: 'org.pharmgkb', name: 'pgkb-common', version: '0.7.3'],
[group: 'org.pharmgkb', name: 'vcf-parser', version: '0.3.1'],
[group: 'org.slf4j', name: 'slf4j-api', version: '2.0.13'],
)
testImplementation(
[group: 'com.github.stefanbirkner', name: 'system-lambda', version: '1.2.1'],
[group: 'org.hamcrest', name: 'hamcrest', version: '2.2'],
[group: 'org.jsoup', name: 'jsoup', version: '1.16.2'],
[group: 'org.junit.jupiter', name: 'junit-jupiter', version: '5.10.3'],
[group: 'org.junit.platform', name: 'junit-platform-launcher', version: '1.10.3'],
)
}
tasks.register('cleanTestOutput', Delete) {
delete "${rootDir}/out/reports"
delete "${rootDir}/out/pharmcat*"
}
clean.dependsOn(tasks.cleanTestOutput)
test.dependsOn(tasks.cleanTestOutput)
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
application {
mainClass = project.ext.mainClassName
}
tasks.withType(Test).configureEach {
minHeapSize = "512m"
maxHeapSize = "1024m"
useJUnitPlatform()
testLogging {
// set options for log level LIFECYCLE
events 'failed', 'standard_error'
exceptionFormat 'full'
showStackTraces true
}
// always generate reports after tests are run
finalizedBy jacocoTestReport
}
tasks.register('testOnJava21', Test) {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(21)
}
}
jacocoTestReport {
// tests must be run before generating the report
dependsOn test
reports {
xml.required = true // codecov depends on xml format report
html.required = true
}
}
jar {
inputs.property('moduleName', project.ext.moduleName)
manifest {
attributes 'Automatic-Module-Name': project.ext.moduleName
attributes 'Implementation-Title': project.name
attributes 'Implementation-Version': project.version
attributes 'Main-Class': project.ext.mainClassName
}
archiveBaseName = project.ext.archiveBaseName
}
shadowJar {
manifest {
attributes 'Implementation-Title': project.name
attributes 'Implementation-Version': project.version
}
archiveBaseName = project.ext.archiveBaseName
}
tasks.withType(Javadoc).configureEach {
// disable the crazy super-strict doclint tool in Java 8
options.addStringOption('Xdoclint:none', '-quiet')
}
tasks.register('javadocJar', Jar) {
dependsOn javadoc
archiveClassifier.set('javadoc')
from 'build/docs/javadoc'
}
tasks.register('sourcesJar', Jar) {
archiveClassifier.set('sources')
from sourceSets.main.allSource
}
tasks.register('updateData', JavaExec) {
dependsOn 'classes'
mainClass = 'org.pharmgkb.pharmcat.util.DataManager'
classpath = sourceSets.main.runtimeClasspath
def argList = [
'-a', file('src/main/resources/org/pharmgkb/pharmcat/definition/alleles'),
'-p', file('src/main/resources/org/pharmgkb/pharmcat/phenotype'),
'-m', file('src/main/resources/org/pharmgkb/pharmcat/reporter'),
'-g', file('src/main/resources/org/pharmgkb/pharmcat/reporter'),
'-doc', file('docs'),
]
args argList
}
task updateExample {
dependsOn 'classes'
doLast {
// update data
javaexec {
mainClass = 'org.pharmgkb.pharmcat.util.SampleDataUpdater'
classpath = sourceSets.main.runtimeClasspath
args = [
"${projectDir}"
]
}
// update first example
javaexec {
mainClass = 'org.pharmgkb.pharmcat.PharmCAT'
classpath = sourceSets.main.runtimeClasspath
args = [
'-vcf', file('docs/examples/pharmcat.example.vcf'),
'-po', file('docs/examples/pharmcat.example.outsideCall.tsv'),
'-reporterJson', '-matcherHtml'
]
}
// update second example
javaexec {
mainClass = 'org.pharmgkb.pharmcat.PharmCAT'
classpath = sourceSets.main.runtimeClasspath
args = [
'-vcf', file('docs/examples/pharmcat.example2.vcf'),
'-reporterJson', '-matcherHtml'
]
}
}
}
tasks.register('testAutogeneratedVcfs', JavaExec) {
dependsOn 'classes'
mainClass = 'org.pharmgkb.pharmcat.haplotype.AutogeneratedVcfTester'
classpath = sourceSets.main.runtimeClasspath
jvmArgs = ['-Xmx8G']
def argList = [
'-vcf', new File(dataDir as File, 'testVcf'),
'-o', new File(dataDir as File, 'autogeneratedTestResults')
]
args argList
}
tasks.register('testAutogeneratedVcfsMissing', JavaExec) {
dependsOn 'classes'
mainClass = 'org.pharmgkb.pharmcat.haplotype.AutogeneratedVcfTester'
classpath = sourceSets.main.runtimeClasspath
jvmArgs = ['-Xmx8G']
def argList = [
'-vcf', new File(dataDir as File, 'testVcf'),
'-o', new File(dataDir as File, 'autogeneratedTestResults')
]
args argList
}
tasks.register('testAutogeneratedVcfsExactMatchOnly', JavaExec) {
dependsOn 'classes'
mainClass = 'org.pharmgkb.pharmcat.haplotype.AutogeneratedVcfTester'
classpath = sourceSets.main.runtimeClasspath
jvmArgs = ['-Xmx8G']
def argList = [
'-vcf', new File(dataDir as File, 'testVcf'),
'-o', new File(dataDir as File, 'autogeneratedTestResults'),
'-e'
]
args argList
}
tasks.register('testAutogeneratedVcfsExactMatchOnlyMissing', JavaExec) {
dependsOn 'classes'
mainClass = 'org.pharmgkb.pharmcat.haplotype.AutogeneratedVcfTester'
classpath = sourceSets.main.runtimeClasspath
jvmArgs = ['-Xmx8G']
def argList = [
'-vcf', new File(dataDir as File, 'testVcf'),
'-o', new File(dataDir as File, 'autogeneratedTestResults'),
'-e'
]
args argList
}
tasks.register('testAutogeneratedVcfsFuzzyMatch', JavaExec) {
dependsOn 'classes'
mainClass = 'org.pharmgkb.pharmcat.haplotype.AutogeneratedVcfTester'
classpath = sourceSets.main.runtimeClasspath
jvmArgs = ['-Xmx8G']
def argList = [
'-vcf', new File(dataDir as File, 'testVcf'),
'-o', new File(dataDir as File, 'autogeneratedTestResults'),
'-f'
]
args argList
}
tasks.register('testAutogeneratedVcfsFuzzyMatchMissing', JavaExec) {
dependsOn 'classes'
mainClass = 'org.pharmgkb.pharmcat.haplotype.AutogeneratedVcfTester'
classpath = sourceSets.main.runtimeClasspath
jvmArgs = ['-Xmx8G']
def argList = [
'-vcf', new File(dataDir as File, 'testVcf'),
'-o', new File(dataDir as File, 'autogeneratedTestResults'),
'-f'
]
args argList
}
artifacts {
archives jar
archives javadocJar
archives sourcesJar
}