@@ -174,19 +174,6 @@ configurations.all {
174174 all* . exclude group : ' junit' , module : ' junit'
175175}
176176
177-
178- jacocoTestReport {
179- dependsOn test
180- group = " Reporting"
181- description = " Generate Jacoco coverage reports after running tests."
182- additionalSourceDirs = files(sourceSets. main. allJava. srcDirs)
183-
184- reports {
185- xml. enabled = true
186- html. enabled = true
187- }
188- }
189-
190177// NOTE: we ignore contracts for now
191178compileJava {
192179 options. compilerArgs = [' -proc:none' , ' -Xlint:all' , ' -Werror' , ' -Xdiags:verbose' ]
@@ -379,7 +366,6 @@ version = (isRelease ? gitVersion() : gitVersion() + "-SNAPSHOT").replaceAll(".d
379366logger. info(" build for version:" + version)
380367group = ' org.broadinstitute'
381368
382-
383369tasks. withType(Jar ) {
384370 manifest {
385371 attributes ' Implementation-Title' : ' The Genome Analysis Toolkit (GATK)' ,
@@ -390,7 +376,33 @@ tasks.withType(Jar) {
390376 }
391377}
392378
393- test {
379+ task wrapper (type : Wrapper ) {
380+ gradleVersion = ' 3.1'
381+ }
382+
383+ tasks. withType(ShadowJar ) {
384+ from(project. sourceSets. main. output)
385+ baseName = project. name + ' -package'
386+ mergeServiceFiles()
387+ relocate ' com.google.common' , ' org.broadinstitute.hellbender.relocated.com.google.common'
388+ zip64 true
389+ exclude ' log4j.properties' // from adam jar as it clashes with hellbender's log4j2.xml
390+ exclude ' **/*.SF' // these are Manifest signature files and
391+ exclude ' **/*.RSA' // keys which may accidentally be imported from other signed projects and then fail at runtime
392+
393+ // Suggested by the akka devs to make sure that we do not get the spark configuration error.
394+ // http://doc.akka.io/docs/akka/snapshot/general/configuration.html#When_using_JarJar__OneJar__Assembly_or_any_jar-bundler
395+ transform(com.github.jengelman.gradle.plugins.shadow.transformers.AppendingTransformer ) {
396+ resource = ' reference.conf'
397+ }
398+ }
399+
400+ // ============================================================================================================================
401+ // WARNING
402+ // ============================================================================================================================
403+ // This is duplicated code with the build script in scripts/docker/dockertest.gradle. If you alter the tests in any way
404+ // please make sure to alter this test method there as well.
405+ tasks. withType(Test ) {
394406 outputs. upToDateWhen { false } // tests will never be "up to date" so you can always rerun them
395407 String TEST_VERBOSITY = " $System . env . TEST_VERBOSITY "
396408
@@ -401,7 +413,11 @@ test {
401413 * anything else : run the non-cloud tests
402414 */
403415 String TEST_TYPE = " $System . env . TEST_TYPE "
404-
416+ // ============================================================================================================================
417+ // WARNING
418+ // ============================================================================================================================
419+ // This is duplicated code with the build script in scripts/docker/dockertest.gradle. If you alter the tests in any way
420+ // please make sure to alter this test method there as well.
405421 useTestNG {
406422 if (TEST_TYPE == " cloud" ) {
407423 // run only the cloud tests
@@ -473,28 +489,11 @@ test {
473489 }
474490 }
475491 }
476- }
477-
478-
479- task wrapper (type : Wrapper ) {
480- gradleVersion = ' 3.1'
481- }
482-
483- tasks. withType(ShadowJar ) {
484- from(project. sourceSets. main. output)
485- baseName = project. name + ' -package'
486- mergeServiceFiles()
487- relocate ' com.google.common' , ' org.broadinstitute.hellbender.relocated.com.google.common'
488- zip64 true
489- exclude ' log4j.properties' // from adam jar as it clashes with hellbender's log4j2.xml
490- exclude ' **/*.SF' // these are Manifest signature files and
491- exclude ' **/*.RSA' // keys which may accidentally be imported from other signed projects and then fail at runtime
492-
493- // Suggested by the akka devs to make sure that we do not get the spark configuration error.
494- // http://doc.akka.io/docs/akka/snapshot/general/configuration.html#When_using_JarJar__OneJar__Assembly_or_any_jar-bundler
495- transform(com.github.jengelman.gradle.plugins.shadow.transformers.AppendingTransformer ) {
496- resource = ' reference.conf'
497- }
492+ // ============================================================================================================================
493+ // WARNING
494+ // ============================================================================================================================
495+ // This is duplicated code with the build script in scripts/docker/dockertest.gradle. If you alter the tests in any way
496+ // please make sure to alter this test method there as well.
498497}
499498
500499shadowJar {
@@ -524,7 +523,27 @@ task sparkJar(type: ShadowJar) {
524523 }
525524}
526525
527- task bundle (type : Zip ) {
526+ // A jar that only contains the test classes and resources (to be extracted for testing)
527+ task shadowTestClassJar (type : ShadowJar ){
528+ group = " Shadow"
529+ from sourceSets. test. output
530+ description = " Create a jar that packages the compiled test classes"
531+ classifier = " test"
532+ }
533+
534+ // A minimal jar that only contains the extra dependencies needed for running the tests
535+ task shadowTestJar (type : ShadowJar ){
536+ group = " Shadow"
537+ description = " A minimal jar that only contains the extra dependencies needed for running the tests that arent packaged in the main shadow jar"
538+ from {
539+ (project. configurations. testRuntime - project. configurations. runtime ). collect {
540+ it. isDirectory() ? it : it. getName(). endsWith(" .jar" ) ? zipTree(it) : it
541+ }
542+ }
543+ classifier = " testDependencies"
544+ }
545+
546+ task collectBundleIntoDir (type : Copy ) {
528547 dependsOn shadowJar, sparkJar, ' condaEnvironmentDefinition' , ' gatkTabComplete' , ' gatkDoc'
529548
530549 doFirst {
@@ -534,10 +553,6 @@ task bundle(type: Zip) {
534553 assert file(" src/main/resources/org/broadinstitute/hellbender/utils/config/GATKConfig.properties" ). exists()
535554 }
536555
537- baseName = project. name + " -" + project. version
538- destinationDir file(" $buildDir " )
539- archiveName baseName + " .zip"
540-
541556 from(shadowJar. archivePath)
542557 from(sparkJar. archivePath)
543558 from(" gatk" )
@@ -552,13 +567,40 @@ task bundle(type: Zip) {
552567 from(" $buildDir /$pythonPackageArchiveName " )
553568 from(" $buildDir /$gatkCondaYML " )
554569 from(" $buildDir /$gatkCondaIntelYML " )
570+ from(" scripts/sv" , { into(" scripts/sv" ) })
571+ from(" scripts/cnv_wdl/" , { into(" scripts/cnv_wdl" ) })
572+ from(" scripts/mutect2_wdl/" , { into(" scripts/mutect2_wdl" ) })
573+ into " $buildDir /bundle-files-collected"
574+ }
575+
576+ task bundle (type : Zip ) {
577+ dependsOn collectBundleIntoDir
578+
579+ baseName = project. name + " -" + project. version
580+ destinationDir file(" $buildDir " )
581+ archiveName baseName + " .zip"
582+
583+ from(" $buildDir /bundle-files-collected" )
555584 into(baseName)
556585
557586 doLast {
558587 logger. lifecycle(" Created GATK distribution in ${ destinationDir} /${ archiveName} " )
559588 }
560589}
561590
591+ jacocoTestReport {
592+ dependsOn test
593+
594+ group = " Reporting"
595+ description = " Generate Jacoco coverage reports after running tests."
596+ additionalSourceDirs = files(sourceSets. main. allJava. srcDirs)
597+
598+ reports {
599+ xml. enabled = true
600+ html. enabled = true
601+ }
602+ }
603+
562604task condaStandardEnvironmentDefinition (type : Copy ) {
563605 from " scripts"
564606 into buildDir
0 commit comments