| 1 |
buildscript { |
| 2 |
repositories { |
| 3 |
jcenter() |
| 4 |
} |
| 5 |
} |
| 6 |
|
| 7 |
plugins { |
| 8 |
id 'java' |
| 9 |
id 'maven' |
| 10 |
id 'signing' |
| 11 |
id 'com.palantir.git-version' version '0.5.1' //version helper |
| 12 |
} |
| 13 |
|
| 14 |
repositories { |
| 15 |
mavenCentral() |
| 16 |
} |
| 17 |
|
| 18 |
dependencies { |
| 19 |
testCompile 'org.testng:testng:6.9.6' |
| 20 |
} |
| 21 |
|
| 22 |
final isRelease = Boolean.getBoolean("release") |
| 23 |
version = (isRelease ? gitVersion() : gitVersion() + "-SNAPSHOT").replaceAll(".dirty", "") |
| 24 |
group = "org.broadinstitute" |
| 25 |
String cpath = "src/main/c" |
| 26 |
String libname = "libbwa" |
| 27 |
|
| 28 |
task buildBwaLib(type: Exec){ |
| 29 |
workingDir "$cpath" |
| 30 |
outputs.files "$cpath/libbwa*" |
| 31 |
outputs.dir "$cpath/bwa" |
| 32 |
commandLine "make" |
| 33 |
String home = System.properties."java.home" |
| 34 |
//strip the trailing jre |
| 35 |
String corrected = home.endsWith("jre") ? home.substring(0, home.length() - 4) : home |
| 36 |
environment JAVA_HOME : corrected |
| 37 |
doFirst { println "using $home -> $corrected as JAVA_HOME" } |
| 38 |
} |
| 39 |
|
| 40 |
clean { |
| 41 |
delete "$cpath/bwa" |
| 42 |
delete "$cpath/$libname*" |
| 43 |
delete fileTree("$cpath") {include "$libname*", "*.o"} |
| 44 |
} |
| 45 |
|
| 46 |
processResources { |
| 47 |
dependsOn buildBwaLib |
| 48 |
from cpath |
| 49 |
include "$libname*" |
| 50 |
} |
| 51 |
|
| 52 |
test { |
| 53 |
useTestNG() |
| 54 |
testLogging { |
| 55 |
testLogging { |
| 56 |
events "skipped", "failed" |
| 57 |
exceptionFormat = "full" |
| 58 |
} |
| 59 |
afterSuite { desc, result -> |
| 60 |
if (!desc.parent) { // will match the outermost suite |
| 61 |
println "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)" |
| 62 |
} |
| 63 |
} |
| 64 |
} |
| 65 |
} |
| 66 |
|
| 67 |
javadoc { |
| 68 |
options.addStringOption('Xdoclint:none', '-quiet') |
| 69 |
} |
| 70 |
|
| 71 |
task javadocJar(type: Jar, dependsOn: javadoc) { |
| 72 |
classifier = 'javadoc' |
| 73 |
from 'build/docs/javadoc' |
| 74 |
} |
| 75 |
|
| 76 |
task sourcesJar(type: Jar) { |
| 77 |
from sourceSets.main.allSource |
| 78 |
classifier = 'sources' |
| 79 |
} |
| 80 |
|
| 81 |
/** |
| 82 |
*This specifies what artifacts will be built and uploaded when performing a maven upload. |
| 83 |
*/ |
| 84 |
artifacts { |
| 85 |
archives jar |
| 86 |
archives javadocJar |
| 87 |
archives sourcesJar |
| 88 |
} |
| 89 |
|
| 90 |
/** |
| 91 |
* Sign non-snapshot releases with our secret key. This should never need to be invoked directly. |
| 92 |
*/ |
| 93 |
signing { |
| 94 |
required { isRelease && gradle.taskGraph.hasTask("uploadArchives") } |
| 95 |
sign configurations.archives |
| 96 |
} |
| 97 |
|
| 98 |
def assertLibExists(lib){ |
| 99 |
if ( ! file(lib).exists()){ |
| 100 |
throw new GradleException("Could not perform a maven release because $lib is missing. You must include both OSX and Linux binaries to release. " + |
| 101 |
"You can run scripts/build_both_dylib_and_so.sh to build both if you are on a Broad Institute connected mac.") |
| 102 |
} |
| 103 |
} |
| 104 |
|
| 105 |
/** |
| 106 |
* Upload a release to sonatype. You must be an authorized uploader and have your sonatype |
| 107 |
* username and password information in your gradle properties file. See the readme for more info. |
| 108 |
* |
| 109 |
* For releasing to your local maven repo, use gradle install |
| 110 |
*/ |
| 111 |
uploadArchives { |
| 112 |
doFirst { |
| 113 |
println "Attempting to upload version:$version" |
| 114 |
if (isRelease){ |
| 115 |
assertLibExists("$cpath/${libname}.Linux.so") |
| 116 |
assertLibExists("$cpath/${libname}.Darwin.dylib") |
| 117 |
} |
| 118 |
} |
| 119 |
repositories { |
| 120 |
mavenDeployer { |
| 121 |
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } |
| 122 |
|
| 123 |
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { |
| 124 |
authentication(userName: project.findProperty("sonatypeUsername"), password: project.findProperty("sonatypePassword")) |
| 125 |
} |
| 126 |
|
| 127 |
snapshotRepository(url: "https://broadinstitute.jfrog.io/broadinstitute/libs-snapshot-local") { |
| 128 |
authentication(userName: System.env.ARTIFACTORY_USERNAME, password: System.env.ARTIFACTORY_PASSWORD) |
| 129 |
} |
| 130 |
|
| 131 |
pom.project { |
| 132 |
name 'gatk-bwamem-jni' |
| 133 |
packaging 'jar' |
| 134 |
description 'java bindings for the bwa-mem assembler' |
| 135 |
url 'http://github.com/broadinstitute/gatk-bwamem-jni' |
| 136 |
|
| 137 |
scm { |
| 138 |
url 'scm:[email protected]:broadinstitute/gatk-bwamem-jni.git' |
| 139 |
connection 'scm:[email protected]:broadinstitute/gatk-bwamem-jni.git' |
| 140 |
developerConnection 'scm:[email protected]:broadinstitute/gatk-bwamem-jni.git' |
| 141 |
} |
| 142 |
|
| 143 |
developers { |
| 144 |
developer { |
| 145 |
id = "gatkdev" |
| 146 |
name = "GATK Development Team" |
| 147 |
email = "[email protected]" |
| 148 |
} |
| 149 |
} |
| 150 |
|
| 151 |
licenses { |
| 152 |
license { |
| 153 |
name 'BSD 3-Clause' |
| 154 |
url 'https://github.com/broadinstitute/gatk-bwamem-jni/blob/master/LICENSE.TXT' |
| 155 |
distribution 'repo' |
| 156 |
} |
| 157 |
} |
| 158 |
} |
| 159 |
} |
| 160 |
} |
| 161 |
} |
| 162 |
|