Description: patching build.gradle to perform a build with Debian packages
Author: Olivier Sallou <osallou@debian.org>
Forwarded: not-needed
Last-Update: 2022-05-25

--- a/build.gradle
+++ b/build.gradle
@@ -4,8 +4,7 @@ plugins {
     id "java"
     id 'maven'
     id 'signing'
-    id 'jacoco'
-    id 'com.palantir.git-version' version '0.5.1' //version helper
+    // id 'jacoco'
 }
 
 sourceCompatibility = 1.8
@@ -14,7 +13,17 @@ targetCompatibility = 1.8
 group = 'org.broadinstitute'
 
 final isRelease = Boolean.getBoolean("release")
-version = (isRelease ? gitVersion() : gitVersion() + "-SNAPSHOT").replaceAll(".dirty", "")
+def getDebianVersion() {
+    def dpkgStdOut = new ByteArrayOutputStream()
+    exec {
+        commandLine "dpkg-parsechangelog", "-S", "Version"
+        standardOutput = dpkgStdOut
+    }
+    return dpkgStdOut.toString().trim().replaceFirst(/(-gradle)?([+]dfsg[.0-9]*)?-[^-]+$/, "")
+}
+
+version = getDebianVersion()
+//version = (isRelease ? gitVersion() : gitVersion() + "-SNAPSHOT").replaceAll(".dirty", "")
 
 repositories {
     mavenCentral()
@@ -25,6 +34,7 @@ repositories {
     mavenLocal()
 }
 
+/*
 jacocoTestReport {
     dependsOn test
     group = "Reporting"
@@ -36,12 +46,13 @@ jacocoTestReport {
         html.enabled = true
     }
 }
+*/
 
 compileJava {
-    options.compilerArgs = ['-proc:none', '-Xlint:all','-Werror','-Xdiags:verbose']
+    options.compilerArgs = ['-proc:none', '-Xlint:all','-Xdiags:verbose']
 }
 compileTestJava {
-    options.compilerArgs = ['-proc:none', '-Xlint:all','-Werror','-Xdiags:verbose']
+    options.compilerArgs = ['-proc:none', '-Xlint:all','-Xdiags:verbose']
 }
 dependencies {
     compile 'net.sf.jopt-simple:jopt-simple:5.0.3'
@@ -52,13 +63,13 @@ dependencies {
     // Get the jdk files we need to run javaDoc. We need to use these during compile, testCompile,
     // test execution, and gatkDoc generation, but we don't want them as part of the runtime
     // classpath and we don't want to redistribute them in the uber jar.
-    final javadocJDKFiles = files(((URLClassLoader) ToolProvider.getSystemToolClassLoader()).getURLs())
-    compileOnly(javadocJDKFiles)
-    testCompile(javadocJDKFiles)
+    //final javadocJDKFiles = files(((URLClassLoader) ToolProvider.getSystemToolClassLoader()).getURLs())
+    //compileOnly(javadocJDKFiles)
+    //testCompile(javadocJDKFiles)
     compile 'org.freemarker:freemarker:2.3.30'
     compile 'com.google.code.gson:gson:2.2.2'
 
-    testCompile 'org.testng:testng:6.9.6'
+    testCompile 'org.testng:testng:debian'
     testCompile 'org.mockito:mockito-core:2.10.0'
 }
 
