-
Notifications
You must be signed in to change notification settings - Fork 243
/
build.gradle
252 lines (206 loc) · 6.96 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
buildscript {
repositories {
mavenCentral()
}
}
plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
id 'jacoco'
id 'com.palantir.git-version' version '0.11.0'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'com.github.spotbugs' version "5.0.13"
}
repositories {
mavenCentral()
}
jacocoTestReport {
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
reports {
xml.required = true // codecov depends on xml format report
html.required = true
}
}
dependencies {
implementation 'commons-logging:commons-logging:1.3.0'
implementation "org.xerial.snappy:snappy-java:1.1.10.5"
implementation 'org.apache.commons:commons-compress:1.26.0'
implementation 'org.tukaani:xz:1.9'
implementation "org.json:json:20231013"
implementation 'org.openjdk.nashorn:nashorn-core:15.4'
api "gov.nih.nlm.ncbi:ngs-java:2.9.0"
api "org.apache.commons:commons-jexl:2.1.1"
testImplementation 'org.testng:testng:7.8.0'
testImplementation 'com.google.jimfs:jimfs:1.3.0'
testImplementation "com.google.guava:guava:33.0.0-jre"
testImplementation 'org.apache.commons:commons-lang3:3.14.0'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
withJavadocJar()
withSourcesJar()
}
final isRelease = Boolean.getBoolean("release")
final gitVersion = gitVersion().replaceAll(".dirty", "")
version = isRelease ? gitVersion : gitVersion + "-SNAPSHOT"
logger.info("build for version:" + version)
group = 'com.github.samtools'
defaultTasks 'jar'
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
tasks.withType(Javadoc).configureEach {
options.addStringOption('encoding', 'UTF-8')
options.addStringOption('Xdoclint:none', '-quiet')
}
jar {
manifest {
attributes 'Implementation-Title': 'HTSJDK',
'Implementation-Vendor': 'Samtools Organization',
'Implementation-Version': archiveVersion
}
}
import org.gradle.internal.os.OperatingSystem;
tasks.withType(Test).configureEach { task ->
task.outputs.upToDateWhen { false } // tests will always rerun
// Always run serially because there are some very badly behaved tests in HTSJDK that
// will cause errors and even deadlocks if run multi-threaded
task.maxParallelForks = 1
// set heap size for the test JVM(s)
task.minHeapSize = "1G"
task.maxHeapSize = "2G"
task.jvmArgs '-Djava.awt.headless=true' //this prevents awt from displaying a java icon while the tests are running
int count = 0
// listen to events in the test execution lifecycle
beforeTest { descriptor ->
count++
if (count % 200 == 0) {
logger.lifecycle("Finished " + Integer.toString(count++) + " tests")
}
}
testLogging {
testLogging {
events "skipped", "failed"
exceptionFormat = "full"
}
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
println "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)"
}
}
}
}
tasks.register('testWithDefaultReference', Test) {
description = "Run tests with a default reference File"
jvmArgs += '-Dsamjdk.reference_fasta=src/test/resources/htsjdk/samtools/cram/ce.fa'
useTestNG {
includeGroups "defaultReference"
}
}
tasks.register('testWithOptimisticVCF4_4', Test) {
description = "Run tests with optimistic VCF 4.4 reading"
jvmArgs += '-Dsamjdk.optimistic_vcf_4_4=true'
useTestNG {
includeGroups "optimistic_vcf_4_4"
}
}
test {
description = "Runs the unit tests other than the SRA tests"
useTestNG {
if (OperatingSystem.current().isUnix()) {
excludeGroups "slow", "broken", "defaultReference", "optimistic_vcf_4_4", "ftp", "http", "sra", "ena"
} else {
excludeGroups "slow", "broken", "defaultReference", "optimistic_vcf_4_4", "ftp", "http", "sra", "ena", "unix"
}
}
} dependsOn testWithDefaultReference, testWithOptimisticVCF4_4
tasks.register('testFTP', Test) {
description = "Runs the tests that require connection to a remote ftp server"
useTestNG {
includeGroups "ftp"
excludeGroups "slow", "broken"
}
}
tasks.register('testExternalApis', Test) {
description = "Run the SRA, ENA, and HTTP tests (tests that interact with external APIs)"
jvmArgs += '-Dsamjdk.sra_libraries_download=true'
useTestNG {
includeGroups "sra", "http", "ena"
excludeGroups "slow", "broken"
}
}
if(project == rootProject) {
wrapper {
gradleVersion = '8.5'
}
}
spotbugs {
reportLevel = 'high'
excludeFilter = file('gradle/spotbugs-exclude.xml')
}
spotbugsMain {
reports {
xml.enabled = false
html.enabled = true
}
}
spotbugsTest {
reports {
xml.enabled = false
html.enabled = true
}
}
publishing {
publications {
htsjdk(MavenPublication) {
from components.java
pom {
name = 'HTSJDK'
packaging = 'jar'
description = 'A Java API for high-throughput sequencing data (HTS) formats'
url = 'https://samtools.github.io/htsjdk/'
developers {
developer {
id = 'htsjdk'
name = 'Htsjdk Team'
url = 'https://github.com/samtools/htsjdk'
}
}
scm {
url = '[email protected]:samtools/htsjdk.git'
connection = 'scm:git:[email protected]:samtools/htsjdk.git'
}
licenses {
license {
name = 'MIT License'
url = 'http://opensource.org/licenses/MIT'
distribution = 'repo'
}
}
}
}
}
repositories {
maven {
credentials {
username = isRelease ? project.findProperty("sonatypeUsername") : System.env.ARTIFACTORY_USERNAME
password = isRelease ? project.findProperty("sonatypePassword") : System.env.ARTIFACTORY_PASSWORD
}
def release = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshot = "https://broadinstitute.jfrog.io/broadinstitute/libs-snapshot-local/"
url = isRelease ? release : snapshot
}
}
}
/**
* Sign non-snapshot releases with our secret key. This should never need to be invoked directly.
*/
signing {
required { isRelease && gradle.taskGraph.hasTask("publishHtsjdkPublicationToMavenRepository") }
sign publishing.publications.htsjdk
}
tasks.register('install') { dependsOn publishToMavenLocal }