forked from samtools/htsjdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
219 lines (181 loc) · 6.14 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
buildscript {
repositories {
mavenCentral()
}
}
plugins {
id 'java'
id 'scala'
id 'maven'
id 'signing'
id 'jacoco'
id 'com.palantir.git-version' version '0.11.0'
id 'com.github.johnrengelman.shadow' version '2.0.4'
id 'com.github.maiflai.scalatest' version '0.22'
}
repositories {
mavenCentral()
}
jacocoTestReport {
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
additionalSourceDirs = files(sourceSets.main.allJava.srcDirs)
reports {
xml.enabled = true // codecov depends on xml format report
html.enabled = true
}
}
dependencies {
compile "org.apache.commons:commons-jexl:2.1.1"
compile "commons-logging:commons-logging:1.1.1"
compile "org.xerial.snappy:snappy-java:1.1.4"
compile "org.apache.commons:commons-compress:1.4.1"
compile "org.tukaani:xz:1.5"
compile "gov.nih.nlm.ncbi:ngs-java:2.9.0"
testCompile "org.scala-lang:scala-library:2.12.6"
testCompile "org.scalatest:scalatest_2.12:3.0.5"
testRuntime 'org.pegdown:pegdown:1.6.0' // Necessary for generating HTML reports with ScalaTest
testCompile "org.testng:testng:6.14.3"
testCompile "com.google.jimfs:jimfs:1.1"
testCompile "com.google.guava:guava:26.0-jre"
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
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'
jar {
manifest {
attributes 'Implementation-Title': 'HTSJDK',
'Implementation-Vendor' : 'Samtools Organization',
'Implementation-Version': version
}
}
import org.gradle.internal.os.OperatingSystem;
tasks.withType(Test) { 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
}
task findScalaAndJavaTypes(type: Exec) {
description = "Check that Scala files only exist in the scala test dir and that java files do not reside in the scala test dir."
commandLine './scripts/checkScalaAndJavaFiles.sh'
}
test {
description = "Runs the unit tests other than the SRA tests"
testLogging {
events "failed", "skipped"
}
if (System.env.CI == "true") {
jvmArgs += '-Dsamjdk.sra_libraries_download=true'
}
tags {
exclude "slow"
exclude "broken"
exclude "ftp"
if (System.env.CI == "false") exclude "sra"
if (!OperatingSystem.current().isUnix()) exclude "unix"
}
} dependsOn findScalaAndJavaTypes
task testFTP(type: Test) {
description = "Runs the tests that require connection to a remote ftp server"
tags {
include "ftp"
exclude "slow"
exclude "broken"
}
}
task testSRA(type: Test) {
description = "Run the SRA tests"
jvmArgs += '-Dsamjdk.sra_libraries_download=true'
tags {
exclude "slow"
exclude "broken"
}
}
wrapper {
gradleVersion = '4.8.1'
}
// This is a hack to disable the java 8 default javadoc lint until we fix the html formatting
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from 'build/docs/javadoc'
}
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
/**
*This specifies what artifacts will be built and uploaded when performing a maven upload.
*/
artifacts {
archives jar
archives javadocJar
archives sourcesJar
}
/**
* Sign non-snapshot releases with our secret key. This should never need to be invoked directly.
*/
signing {
required { isRelease && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
/**
* Upload a release to sonatype. You must be an authorized uploader and have your sonatype
* username and password information in your gradle properties file. See the readme for more info.
*
* For releasing to your local maven repo, use gradle install
*/
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: project.findProperty("sonatypeUsername"), password: project.findProperty("sonatypePassword"))
}
snapshotRepository(url: "https://broadinstitute.jfrog.io/broadinstitute/libs-snapshot-local/") {
authentication(userName: System.env.ARTIFACTORY_USERNAME, password: System.env.ARTIFACTORY_PASSWORD)
}
pom.project {
name 'HTSJDK'
packaging 'jar'
description 'A Java API for high-throughput sequencing data (HTS) formats'
url 'http://samtools.github.io/htsjdk/'
developers {
developer {
id 'picard'
name 'Picard Team'
url 'http://broadinstitute.github.io/picard'
}
}
scm {
url 'git@github.com:samtools/htsjdk.git'
connection 'scm:git:git@github.com:samtools/htsjdk.git'
}
licenses {
license {
name 'MIT License'
url 'http://opensource.org/licenses/MIT'
distribution 'repo'
}
}
}
}
}
doFirst{
System.out.println("Uploading version $version")
}
}