[med-svn] [picard-tools] 04/08: Adapt build system to gradle
Vincent Danjean
vdanjean at debian.org
Thu Jul 7 10:00:00 UTC 2016
This is an automated email from the git hooks/post-receive script.
vdanjean pushed a commit to branch master
in repository picard-tools.
commit f1f947c6ad35da912d14840c48fd56cb59059881
Author: Vincent Danjean <vdanjean at debian.org>
Date: Thu Jul 7 09:51:05 2016 +0200
Adapt build system to gradle
---
debian/changelog | 6 +
debian/control | 7 +-
debian/libpicard-java-doc.javadoc | 2 +-
debian/libpicard-java.jlibs | 2 +-
debian/maven.rules | 19 +++
debian/patches/10-build.xml | 304 --------------------------------------
debian/patches/10-build.xml.patch | 97 ++++++++++++
debian/patches/series | 2 +-
debian/rules | 23 +--
9 files changed, 133 insertions(+), 329 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 898ad93..0c63b21 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+picard-tools (2.5.0-gradle+dfsg-1) UNRELEASED; urgency=medium
+
+ * Switch to gradle build system
+
+ -- Vincent Danjean <vdanjean at debian.org> Thu, 07 Jul 2016 09:29:36 +0200
+
picard-tools (2.1.1+dfsg-1) unstable; urgency=medium
* New upstream version
diff --git a/debian/control b/debian/control
index 968caa9..57a5899 100644
--- a/debian/control
+++ b/debian/control
@@ -10,8 +10,9 @@ Build-Depends: ant,
default-jdk (>= 2:1.8),
debhelper (>= 9),
javahelper,
+ gradle-debian-helper,
maven-repo-helper,
- libhtsjdk-java (>= 2.1.1),
+ libhtsjdk-java (>= 2.5.0),
libguava-java,
testng,
# required for tests:
@@ -22,7 +23,7 @@ Build-Depends: ant,
default-jdk-doc,
libhtsjdk-java-doc,
libguava-java-doc
-Standards-Version: 3.9.7
+Standards-Version: 3.9.8
Vcs-Browser: https://anonscm.debian.org/cgit/debian-med/picard-tools.git
Vcs-Git: https://anonscm.debian.org/git/debian-med/picard-tools.git
Homepage: http://broadinstitute.github.io/picard/
@@ -81,7 +82,7 @@ Architecture: all
Section: java
Depends: ${misc:Depends},
${java:Depends},
- libhtsjdk-java (>= 2.1.1)
+ libhtsjdk-java (>= 2.5.0)
Recommends: ${java:Recommends},
r-base-core
Suggests: picard-tools
diff --git a/debian/libpicard-java-doc.javadoc b/debian/libpicard-java-doc.javadoc
index 11bb89a..1ed2ec3 100644
--- a/debian/libpicard-java-doc.javadoc
+++ b/debian/libpicard-java-doc.javadoc
@@ -1 +1 @@
-javadoc/picard /usr/share/doc/libpicard-java/api/
+build/docs/javadoc /usr/share/doc/libpicard-java/api/
diff --git a/debian/libpicard-java.jlibs b/debian/libpicard-java.jlibs
index 491cfdc..6ccfbab 100644
--- a/debian/libpicard-java.jlibs
+++ b/debian/libpicard-java.jlibs
@@ -1 +1 @@
-dist/picard.jar
+build/libs/picard-*.jar
diff --git a/debian/maven.rules b/debian/maven.rules
new file mode 100644
index 0000000..c505baa
--- /dev/null
+++ b/debian/maven.rules
@@ -0,0 +1,19 @@
+# Maven rules - transform Maven dependencies and plugins
+# Format of this file is:
+# [group] [artifact] [type] [version] [classifier] [scope]
+# where each element can be either
+# - the exact string, for example org.apache for the group, or 3.1
+# for the version. In this case, the element is simply matched
+# and left as it is
+# - * (the star character, alone). In this case, anything will
+# match and be left as it is. For example, using * on the
+# position of the artifact field will match any artifact id
+# - a regular expression of the form s/match/replace/
+# in this case, elements that match are transformed using
+# the regex rule.
+# All elements much match before a rule can be applied
+# Example rule: match jar with groupid= junit, artifactid= junit
+# and version starting with 3., replacing the version with 3.x
+# junit junit jar s/3\\..*/3.x/
+
+org.testng testng jar s/6.*/6.x/ * *
diff --git a/debian/patches/10-build.xml b/debian/patches/10-build.xml
deleted file mode 100644
index 23c6a64..0000000
--- a/debian/patches/10-build.xml
+++ /dev/null
@@ -1,304 +0,0 @@
-Description: Modifies the upstream build system.
- This patch changes the path to the javac compiler, enables the use
- of the system java libraries, remove in-place htsjdk clone and compile,
- and get htsjdk version from system jar.
-Origin: vendor
-Forwarded: no
---- a/build.xml
-+++ b/build.xml
-@@ -42,17 +42,16 @@
- <property name="htsjdk_git_url" value="git at github.com:samtools/htsjdk.git"/>
- <!-- TODO: get this from the build.xml in htsjdk -->
- <property name="htsjdk-classes" value="htsjdk/classes"/>
-+ <property name="htsjdk-jar" value="/usr/share/java/htsjdk.jar"/>
-
- <property name="javac.target" value="1.8"/>
- <property name="javac.debug" value="true"/>
-
- <!-- Get GIT hash, if available, otherwise leave it blank. -->
-- <exec executable="git" outputproperty="repository.revision" failifexecutionfails="true" errorproperty="">
-- <arg value="log"/>
-- <arg value="-1"/>
-- <arg value="--pretty=format:%H_%at"/>
-- </exec>
-- <property name="repository.revision" value=""/>
-+ <!-- For Debian, do not use GIT hash (it would be the one from the
-+ packaging repo), but use the "dfsg" string as sources are
-+ repacked -->
-+ <property name="repository.revision" value="dfsg"/>
- <property name="picard-version" value="2.1.1"/>
- <property name="command-line-html-dir" value="${dist}/html"/>
- <property name="testng.verbosity" value="2"/>
-@@ -67,11 +66,6 @@
- <os family="unix"/>
- </condition>
-
-- <!-- Import JaCoCo Ant tasks -->
-- <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
-- <classpath path="lib/ant/jacocoant.jar" />
-- </taskdef>
--
- <target name="set_excluded_test_groups_unix" if="isUnix">
- <property name="excludedTestGroups" value="slow, broken"/>
- </target>
-@@ -83,23 +77,17 @@
- <!-- INIT -->
- <target name="init">
- <path id="classpath">
-- <fileset dir="${htsjdk_lib_dir}">
-- <include name="*.jar"/>
-- <include name="**/*.jar"/>
-- </fileset>
-- <!-- for the specific HTSJDK library JARs -->
-- <fileset dir="${htsjdk}/lib">
-- <include name="*.jar"/>
-- <include name="**/*.jar"/>
-- </fileset>
-- <fileset dir="${lib}">
-- <include name="**/*.jar"/>
-- </fileset>
-+ <!-- for the HTSJDK library JAR -->
-+ <pathelement path="/usr/share/java/htsjdk.jar"/>
-+ <!-- other system required installed JARs -->
-+ <pathelement path="/usr/share/java/guava.jar"/>
-+ <pathelement path="/usr/share/java/testng.jar"/>
- </path>
- <path id="metrics.classpath">
-+ <pathelement path="/usr/share/java/htsjdk.jar"/>
-+ <pathelement path="/usr/share/java/guava.jar"/>
- <pathelement path="${classpath}"/>
- <pathelement location="${classes}"/>
-- <pathelement location="${htsjdk}/classes"/>
- </path>
-
- </target>
-@@ -113,23 +101,13 @@
- <delete dir="javadoc"/>
- </target>
-
-- <target name="clean" description="Clean local build products and also nested project" depends="clean-local, clean-htsjdk"/>
-+ <target name="clean" description="Clean local build products and also nested project" depends="clean-local"/>
-
- <!-- HTS-JDK -->
- <target name="set-htsjdk-version">
- <!-- set the htsjdk version -->
-- <ant antfile="build.xml" dir="${htsjdk}" target="write-version-property" inheritall="false"/>
-- <loadfile property="htsjdk-version" srcFile="${htsjdk}/htsjdk.version.properties">
-- <filterchain>
-- <linecontains>
-- <contains value="htsjdk-version="/>
-- </linecontains>
-- <tokenfilter>
-- <replacestring from="htsjdk-version=" to=""/>
-- </tokenfilter>
-- <striplinebreaks/>
-- </filterchain>
-- </loadfile>
-+ <loadmf jar="${htsjdk-jar}" prefix="htsjdk-mf."/>
-+ <property name="htsjdk-version" value="${htsjdk-mf.Implementation-Version}"/>
- </target>
-
- <target name="clone-htsjdk" description="Clone HTS-JDK sources from Sourceforge">
-@@ -171,13 +149,13 @@
- description="Compile files without cleaning">
- </target>
-
-- <target name="compile-src" depends="compile-htsjdk, compile-picard" description="Compile files without cleaning"/>
-+ <target name="compile-src" depends="compile-picard" description="Compile files without cleaning"/>
-
- <target name="compile-picard" depends="init" description="Compile picard files without cleaning">
- <compile-src includes="picard/**/*.*" />
- </target>
-
-- <target name="compile-tests" depends="compile-htsjdk-tests, compile-picard-tests" description="Compile test files without cleaning"/>
-+ <target name="compile-tests" depends="compile-picard-tests" description="Compile test files without cleaning"/>
-
- <target name="compile-picard-tests" depends="init" description="Compile picard test files without cleaning">
- <compile-tests includes="picard/**/*.*"/>
-@@ -196,9 +174,11 @@
- </target>
-
- <!-- TEST -->
-- <target name="test" depends="compile, set_excluded_test_groups" description="Run unit tests">
-- <taskdef resource="testngtasks" classpathref="classpath"/>
-- <jacoco:coverage destfile="jacoco.data" xmlns:jacoco="antlib:org.jacoco.ant">
-+ <macrodef name="run-test">
-+ <attribute name="excludedTestGroups" default=""/>
-+ <attribute name="includedTestGroups" default=""/>
-+ <sequential>
-+ <taskdef resource="testngtasks" classpathref="classpath"/>
- <testng suitename="picard-tests" classpathref="classpath" outputdir="${test.output}"
- failureproperty="tests.failed" excludedgroups="${excludedTestGroups}" workingDir="${basedir}"
- verbose="${testng.verbosity}">
-@@ -206,6 +186,7 @@
- <pathelement path="${classes}"/>
- <pathelement path="${classes.test}"/>
- <pathelement path="${scripts}"/>
-+ <pathelement path="/usr/share/java/jcommander.jar"/>
- </classpath>
- <classfileset dir="${classes.test}">
- <include name="**/Test*.class"/>
-@@ -213,8 +194,6 @@
- </classfileset>
- <jvmarg value="-Xmx2G"/>
- </testng>
-- </jacoco:coverage>
--
- <junitreport todir="${dist}/test">
- <fileset dir="${test.output}">
- <include name="*.xml"/>
-@@ -223,23 +202,11 @@
- </junitreport>
- <copy file="etc/test/testng.css" todir="${dist}/test" overwrite="true"/>
- <fail if="tests.failed" message="There were failed unit tests"/>
-- </target>
-+ </sequential>
-+ </macrodef>
-
-- <target name="test-coverage-report" depends="test" description="Runs tests and creates an HTML code coverage report">
-- <jacoco:report xmlns:jacoco="antlib:org.jacoco.ant">
-- <executiondata>
-- <file file="jacoco.data"/>
-- </executiondata>
-- <structure name="Picard">
-- <classfiles>
-- <fileset dir="classes"/>
-- </classfiles>
-- <sourcefiles encoding="UTF-8">
-- <fileset dir="src"/>
-- </sourcefiles>
-- </structure>
-- <html destdir="report"/>
-- </jacoco:report>
-+ <target name="test" depends="compile, set_excluded_test_groups" description="Run unit tests">
-+ <run-test excludedTestGroups="${excludedTestGroups}"/>
- </target>
-
- <target name="single-test"
-@@ -260,6 +227,7 @@
- <pathelement path="${classes}"/>
- <pathelement path="${classes.test}"/>
- <pathelement path="${scripts}"/>
-+ <pathelement path="/usr/share/java/jcommander.jar"/>
- </classpath>
- <classfileset dir="${classes.test}">
- <include name="**/${name}.class"/>
-@@ -284,7 +252,7 @@
- </unzip>
- </target>
-
-- <target name="picard-jar" depends="compile, process-external-jars"
-+ <target name="picard-jar" depends="compile, process-external-jars, set-htsjdk-version"
- description="Builds the main executable picard.jar">
- <mkdir dir="${dist}"/>
- <mkdir dir="${dist.tmp}"/>
-@@ -292,15 +260,11 @@
- <fileset dir="${lib}">
- <exclude name="**/jacocoant.jar"/> <!-- must exclude this jar from packing into picard - this is only used for testing -->
- </fileset>
-- <fileset dir="${htsjdk_lib_dir}">
-- <include name="*.jar"/>
-- </fileset>
- </unjar>
-
- <jar destfile="${dist}/picard.jar" compress="no">
- <fileset dir="${classes}" includes="picard/**/*.*, META-INF/**/*"/>
- <fileset dir="${src.scripts}" includes="**/*.R"/>
-- <fileset dir="${htsjdk-classes}" includes ="${htsjdk}/*/**/*.*"/>
- <fileset dir="${dist.tmp}" includes="**/*"/>
- <fileset dir="${jar_opt}" includes="**/*"/>
-
-@@ -348,44 +312,17 @@
- <fileset dir="${lib}">
- <include name="**/*.jar"/>
- </fileset>
-- <fileset dir="${htsjdk}/dist">
-- <include name="**/*.jar"/>
-- </fileset>
-- <fileset dir="${htsjdk}/lib">
-- <include name="**/*.jar"/>
-- </fileset>
-+ <pathelement path="/usr/share/java/htsjdk.jar"/>
-+ <pathelement path="/usr/share/java/guava.jar"/>
-+ <pathelement path="/usr/share/java/testng.jar"/>
- </classpath>
-- <link href="http://java.sun.com/j2se/1.6.0/docs/api/"/>
-+ <link href="/usr/share/doc/default-jdk-doc/api/"/>
-+ <link href="/usr/share/doc/libhtsjdk-java/api/"/>
-+ <link href="/usr/share/doc/libguava-java/api/"/>
- <fileset dir="${src}" defaultexcludes="yes">
- <include name="**/*.java"/>
- </fileset>
- </javadoc>
-- <javadoc
-- destdir="javadoc/htsjdk"
-- packagenames="htsjdk*"
-- windowtitle="HTSJDK API Documentation"
-- doctitle="<h1>HTSJDK API Documentation</h1>"
-- author="true"
-- protected="true"
-- use="true"
-- version="true"
-- additionalparam="-Xdoclint:none -notimestamp"
-- failonerror="true"
-- excludepackagenames="picard*">
-- <classpath>
-- <pathelement location="${java.home}/../lib/tools.jar"/>
-- <fileset dir="${lib}">
-- <include name="**/*.jar"/>
-- </fileset>
-- <fileset dir="${htsjdk}/lib">
-- <include name="**/*.jar"/>
-- </fileset>
-- </classpath>
-- <link href="http://java.sun.com/j2se/1.6.0/docs/api/"/>
-- <fileset dir="${htsjdk_src}" defaultexcludes="yes">
-- <include name="**/*.java"/>
-- </fileset>
-- </javadoc>
- <mkdir dir="${command-line-html-dir}"/>
- <javadoc doclet="picard.util.MetricsDoclet"
- docletpathref="metrics.classpath"
-@@ -396,13 +333,12 @@
- <fileset dir="${lib}">
- <include name="**/*.jar"/>
- </fileset>
-- <fileset dir="${htsjdk}/dist">
-- <include name="**/*.jar"/>
-- </fileset>
-+ <pathelement path="/usr/share/java/htsjdk.jar"/>
-+ <pathelement path="/usr/share/java/guava.jar"/>
-+ <pathelement path="/usr/share/java/testng.jar"/>
- </classpath>
- <fileset dir=".">
- <include name="${src}/**/*.java"/>
-- <include name="${htsjdk_src}/**/*.java"/>
- </fileset>
- <arg line="-f ${command-line-html-dir}/picard-metric-definitions.html"/>
- </javadoc>
-@@ -617,4 +553,25 @@
- </javac>
- </sequential>
- </macrodef>
-+
-+ <!--
-+ From http://mail-archives.apache.org/mod_mbox/ant-user/200812.mbox/%3C9EE86F1965E19E499C80DE52AC807B5502A477D1@z011021.bk.fin.local%3E
-+ Loads entries from a manifest file.
-+ @jar The jar from where to read
-+ @prefix A prefix to prepend
-+ -->
-+ <macrodef name="loadmf">
-+ <attribute name="jar"/>
-+ <attribute name="prefix" default=""/>
-+ <sequential>
-+ <loadproperties>
-+ <!-- Load the manifest entries -->
-+ <zipentry zipfile="@{jar}" name="META-INF/MANIFEST.MF"/>
-+ <!-- Add the prefix -->
-+ <filterchain>
-+ <prefixlines prefix="@{prefix}"/>
-+ </filterchain>
-+ </loadproperties>
-+ </sequential>
-+ </macrodef>
- </project>
diff --git a/debian/patches/10-build.xml.patch b/debian/patches/10-build.xml.patch
new file mode 100644
index 0000000..631c5b6
--- /dev/null
+++ b/debian/patches/10-build.xml.patch
@@ -0,0 +1,97 @@
+Description: Modifies the upstream build system.
+Author: Vincent Danjean <Vincent.Danjean at ens-lyon.org>
+Forwarded: not-needed
+Last-Updated: 2016-07-07
+--- a/build.gradle
++++ b/build.gradle
+@@ -1,5 +1,4 @@
+ import javax.tools.ToolProvider
+-import org.ajoberstar.grgit.*
+
+ buildscript {
+ repositories {
+@@ -11,13 +10,7 @@
+ id "java"
+ id 'maven'
+ id 'signing'
+- id 'jacoco'
+ id 'application'
+- id 'com.palantir.git-version' version '0.5.1'
+- id 'com.github.johnrengelman.shadow' version '1.2.3'
+- id "com.github.kt3k.coveralls" version '2.6.3'
+- id 'org.ajoberstar.grgit' version '1.4.2'
+- id 'org.ajoberstar.github-pages' version '1.4.2'
+ }
+
+ mainClassName = "picard.cmdline.PicardCommandLine"
+@@ -27,22 +20,6 @@
+ mavenCentral()
+ }
+
+-jacocoTestReport {
+- dependsOn test
+- group = "Reporting"
+- description = "Generate Jacoco coverage reports after running tests."
+- additionalSourceDirs = files(sourceSets.main.allJava.srcDirs)
+-
+- reports {
+- xml.enabled = true // coveralls plugin depends on xml format report
+- html.enabled = true
+- }
+-}
+-
+-jacoco {
+- toolVersion = "0.7.5.201505241946"
+-}
+-
+ dependencies {
+ compile 'com.google.guava:guava:15.0'
+ compile ('com.github.samtools:htsjdk:2.5.0')
+@@ -54,9 +31,17 @@
+ sourceCompatibility = 1.8
+ targetCompatibility = 1.8
+
++def getDebianVersion() {
++ def dpkgStdOut = new ByteArrayOutputStream()
++ exec {
++ commandLine "dpkg-parsechangelog", "-S", "Version"
++ standardOutput = dpkgStdOut
++ }
++ return dpkgStdOut.toString().trim().replaceFirst(/(-gradle)?([+]dfsg[.0-9]*)?-[^-]+$/, "")
++}
+ final isRelease = Boolean.getBoolean("release")
+-final gitVersion = gitVersion().replaceAll(".dirty", "")
+-version = isRelease ? gitVersion : gitVersion + "-SNAPSHOT"
++final debianVersion = getDebianVersion()
++version = debianVersion
+
+ logger.info("build for version:" + version)
+ group = 'com.github.broadinstitute'
+@@ -308,19 +293,3 @@
+ from 'build/docs/javadoc'
+ into "$htmlDir/javadoc"
+ }
+-
+-task updateGhPages(dependsOn: ['copyJavadoc', 'documentAll']){
+- outputs.dir htmlDir
+-}
+-
+-updateGhPages.finalizedBy publishGhPages
+-
+-githubPages {
+- repoUri = 'git at github.com:broadinstitute/picard.git'
+- targetBranch = 'gh-pages'
+- deleteExistingFiles = false
+- pages {
+- from htmlDir
+- into '.'
+- }
+-}
+--- /dev/null
++++ b/gradle.properties
+@@ -0,0 +1 @@
++rootName=picard
+--- /dev/null
++++ b/settings.gradle
+@@ -0,0 +1 @@
++rootProject.name = rootName
diff --git a/debian/patches/series b/debian/patches/series
index a81bb03..f94487d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1 @@
-10-build.xml
+10-build.xml.patch
diff --git a/debian/rules b/debian/rules
index 5f1a085..27283a1 100755
--- a/debian/rules
+++ b/debian/rules
@@ -7,31 +7,16 @@ export ANT_HOME=/usr/share/ant
export JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::")
%:
- dh $@ --with javahelper
-
-override_dh_auto_configure:
- [ -d lib ] || mkdir lib # This empty directory is lost in the packages's Git clone.
- dh_auto_configure
+ dh $@ --buildsystem=gradle --with javahelper,jh_maven_repo_helper
override_dh_auto_build:
- dh_auto_build -- \
- -Dant.build.javac.source=1.8 \
- -Dant.build.javac.target=1.8 \
- -Djavac.target=1.8 \
- -Ddebug=true \
- picard-jar javadoc
+ dh_auto_build -- jar javadoc
override_dh_auto_test:
# Tests do not work with locales with a different decimal separator
# (for example ',')
env LC_ALL=C && \
- dh_auto_build -- \
- -Dant.build.javac.source=1.8 \
- -Dant.build.javac.target=1.8 \
- -Djavac.target=1.8 \
- -Ddebug=true \
- test
+ dh_auto_build -- test
override_jh_installlibs:
- jh_installlibs --version-strip='[+]dfsg\.[0-9]*'
-
+ jh_installlibs --version-strip='(-gradle)?[+]dfsg[.0-9]*'
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/picard-tools.git
More information about the debian-med-commit
mailing list