Permalink
Switch branches/tags
Find file
Fetching contributors…
Cannot retrieve contributors at this time
209 lines (172 sloc) 5.94 KB
buildscript {
repositories {
mavenCentral()
}
}
plugins {
id 'java'
id 'scala'
id 'maven'
id 'signing'
id 'jacoco'
id 'com.palantir.git-version' version '0.5.1'
id 'com.github.johnrengelman.shadow' version '1.2.3'
id 'com.github.maiflai.scalatest' version '0.15'
}
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.0.3-rc3"
compile "org.apache.commons:commons-compress:1.4.1"
compile "org.tukaani:xz:1.5"
compile "gov.nih.nlm.ncbi:ngs-java:1.2.4"
testCompile "org.scala-lang:scala-library:2.12.1"
testCompile "org.scalatest:scalatest_2.12:3.0.1"
testRuntime 'org.pegdown:pegdown:1.4.2' // Necessary for generating HTML reports with ScalaTest
testCompile "org.testng:testng:6.9.9"
testCompile "com.google.jimfs:jimfs:1.1"
}
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"
if (System.env.CI == "false") exclude "sra"
if (!OperatingSystem.current().isUnix()) exclude "unix"
}
} dependsOn findScalaAndJavaTypes
task testSRA(type: Test) {
description = "Run the SRA tests"
jvmArgs += '-Dsamjdk.sra_libraries_download=true'
tags {
exclude "slow"
exclude "broken"
}
}
task wrapper(type: Wrapper) {
description = "Regenerate the gradle wrapper"
gradleVersion = '3.2.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")
}
}