plugins { id 'java' id 'maven' } repositories { mavenCentral() } dependencies { testCompile 'org.testng:testng:6.9.6' } group = "org.broadinstitute" String cpath = "src/main/c" String libname = "libbwa" task buildBwaLib(type: Exec){ workingDir "$cpath" outputs.files "$cpath/libbwa*" outputs.dir "$cpath/bwa" commandLine "make" String home = System.properties."java.home" //strip the trailing jre String corrected = home.endsWith("jre") ? home.substring(0, home.length() - 4) : home environment JAVA_HOME : corrected doFirst { println "using $home -> $corrected as JAVA_HOME" } } clean { delete "$cpath/bwa" delete "$cpath/$libname*" delete fileTree("$cpath") {include "$libname*", "*.o"} } processResources { dependsOn buildBwaLib // from cpath // include "$libname*" } test { useTestNG() 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)" } } } } 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' }