421 lines
17 KiB
XML
421 lines
17 KiB
XML
<project name="Sting" default="dist" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
|
|
<description>Compile and distribute the Sting toolkit</description>
|
|
|
|
<property name="build.sysclasspath" value="first" />
|
|
|
|
<property name="source.dir" value="java/src" />
|
|
<property name="build.dir" value="build" />
|
|
<property name="dist.dir" value="dist" />
|
|
<property name="resource.file" value="StingText.properties" />
|
|
|
|
<property name="single" value="*Test" />
|
|
<property name="singleintegration" value="*IntegrationTest" />
|
|
|
|
<!-- do we want to halt on failure of a junit test? default to yes (Bamboo uses 'no') -->
|
|
<property name="halt" value="yes" />
|
|
|
|
<!-- should our junit test output go to a file or the screen?
|
|
false means it goes to the screen (default) true to file -->
|
|
<property name="usefile" value="false" />
|
|
|
|
<!-- should our junit tests use XML? default is no -->
|
|
<property name="testOutput" value="brief" />
|
|
|
|
<!-- If running the 'package' task, this property controls the name of the xml file to package -->
|
|
<property name="executable" value="GenomeAnalysisTK" />
|
|
|
|
<!-- Set target based on STING_BUILD_TYPE environment variable -->
|
|
<property environment="env"/>
|
|
<property name="target" value="${env.STING_BUILD_TYPE}" />
|
|
|
|
<dirset id="source.files" dir="${source.dir}">
|
|
<patternset>
|
|
<include name="org/broadinstitute/sting/**"/>
|
|
<exclude name="**/playground/**" unless="include.playground" />
|
|
<exclude name="**/oneoffprojects/**" unless="include.oneoffs" />
|
|
</patternset>
|
|
</dirset>
|
|
|
|
<patternset id="dependency.mask" includes="*.jar">
|
|
<exclude name="junit*.jar" />
|
|
<exclude name="bcel*.jar" />
|
|
</patternset>
|
|
|
|
<path id="runtime.dependencies">
|
|
<fileset dir="lib">
|
|
<patternset refid="dependency.mask" />
|
|
</fileset>
|
|
</path>
|
|
|
|
<path id="classpath">
|
|
<path refid="runtime.dependencies" />
|
|
<pathelement location="build" />
|
|
</path>
|
|
|
|
<!-- ivy properties -->
|
|
<property name="ivy.install.version" value="2.0.0"/>
|
|
<property name="ivy.home" value="${user.home}/.ant"/>
|
|
<property name="ivy.jar.dir" value="${ivy.home}/lib"/>
|
|
<property name="ivy.jar.file" value="ivy-${ivy.install.version}.jar"/>
|
|
<property name="ivy.settings.dir" value="settings"/>
|
|
<property file="${ivy.settings.dir}/ivysettings.properties"/>
|
|
<property name="ivy.conf" value="default"/>
|
|
<target name="resolve" depends="init"
|
|
description="locate and download library dependencies">
|
|
<mkdir dir="${ivy.jar.dir}"/>
|
|
<get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/${ivy.jar.file}"
|
|
dest="${ivy.jar.dir}/${ivy.jar.file}"
|
|
usetimestamp="true"/>
|
|
<taskdef resource="org/apache/ivy/ant/antlib.xml"
|
|
uri="antlib:org.apache.ivy.ant"
|
|
classpath="${ivy.jar.dir}/${ivy.jar.file}"/>
|
|
<ivy:settings file="${ivy.settings.dir}/ivysettings.xml"/>
|
|
<ivy:retrieve file="ivy.xml" conf="${ivy.conf}" />
|
|
</target>
|
|
|
|
<!-- define some key locations that might change based on how the build is run -->
|
|
<target name="init">
|
|
<!-- define build version and timestamp -->
|
|
<exec executable="svnversion" outputproperty="build.version" failonerror="true">
|
|
<arg value="--no-newline"/>
|
|
</exec>
|
|
<tstamp>
|
|
<format property="build.timestamp" pattern="yyyy/MM/dd HH:mm:ss"/>
|
|
</tstamp>
|
|
|
|
<echo message="Compiling module: ${target}"/>
|
|
<echo message="source revision : ${build.version}"/>
|
|
<echo message="build time : ${build.timestamp}" />
|
|
|
|
<condition property="include.oneoffs">
|
|
<equals arg1="${target}" arg2="oneoffs" casesensitive="false" />
|
|
</condition>
|
|
|
|
<condition property="include.playground">
|
|
<or>
|
|
<equals arg1="${target}" arg2="playground" casesensitive="false"/>
|
|
<equals arg1="${target}" arg2="oneoffs" casesensitive="false" />
|
|
</or>
|
|
</condition>
|
|
|
|
<!-- Create the build directory structure used by compile -->
|
|
<mkdir dir="build"/>
|
|
</target>
|
|
|
|
<target name="compile" depends="init,resolve"
|
|
description="compile the source">
|
|
<!-- Compile the java code from ${src} into build -->
|
|
<javac srcdir="${source.dir}" destdir="build" debug="true" debuglevel="lines,vars,source" classpathref="runtime.dependencies">
|
|
<exclude name="**/playground/**" unless="include.playground"/>
|
|
<exclude name="**/oneoffprojects/**" unless="include.oneoffs"/>
|
|
</javac>
|
|
</target>
|
|
|
|
<target name="extracthelp" depends="init,compile"
|
|
description="Extract help key/value pair file from the JavaDoc tags."
|
|
unless="disable.help">
|
|
<javadoc doclet="org.broadinstitute.sting.utils.help.ResourceBundleExtractorDoclet"
|
|
docletpathref="classpath"
|
|
classpathref="runtime.dependencies"
|
|
additionalparam="-build-timestamp "${build.timestamp}" -version-suffix .${build.version} -out ${build.dir}/${resource.file}">
|
|
<packageset refid="source.files"/>
|
|
</javadoc>
|
|
</target>
|
|
|
|
<target name="dist" depends="compile,extracthelp"
|
|
description="generate the distribution">
|
|
<mkdir dir="${dist.dir}"/>
|
|
<delete>
|
|
<fileset dir="${dist.dir}" includes="*.jar" />
|
|
</delete>
|
|
|
|
<copy todir="${dist.dir}">
|
|
<fileset dir="lib" includes="*.jar"/>
|
|
</copy>
|
|
|
|
<jar jarfile="${dist.dir}/StingUtils.jar">
|
|
<fileset dir="build" includes="**/utils/**/*.class"/>
|
|
</jar>
|
|
|
|
<jar jarfile="${dist.dir}/GenomeAnalysisTK.jar">
|
|
<fileset dir="build">
|
|
<include name="${resource.file}" />
|
|
<include name="**/gatk/**/*.class" />
|
|
<include name="**/alignment/**/*.class"/>
|
|
<include name="**/oneoffprojects/**/*.class" />
|
|
</fileset>
|
|
<manifest>
|
|
<attribute name="Main-Class" value="org.broadinstitute.sting.gatk.CommandLineGATK"/>
|
|
</manifest>
|
|
</jar>
|
|
|
|
<jar jarfile="${dist.dir}/Aligner.jar">
|
|
<fileset dir="build" includes="**/alignment/**/*.class" />
|
|
</jar>
|
|
|
|
<jar jarfile="${dist.dir}/AnalyzeCovariates.jar" whenmanifestonly="skip">
|
|
<fileset dir="build">
|
|
<include name="**/analyzecovariates/**/*.class" />
|
|
<include name="**/gatk/walkers/recalibration/*.class" />
|
|
</fileset>
|
|
<manifest>
|
|
<attribute name="Main-Class" value="org.broadinstitute.sting.analyzecovariates.AnalyzeCovariates" />
|
|
</manifest>
|
|
</jar>
|
|
|
|
<jar jarfile="${dist.dir}/CGUtilities.jar" whenmanifestonly="skip">
|
|
<fileset dir="build">
|
|
<include name="**/*.class" />
|
|
</fileset>
|
|
<manifest>
|
|
<attribute name="Main-Class" value="org.broadinstitute.sting.playground.tools.CGUtilities" />
|
|
</manifest>
|
|
</jar>
|
|
|
|
<jar jarfile="${dist.dir}/VCFTool.jar" whenmanifestonly="skip">
|
|
<fileset dir="build">
|
|
<include name="**/*.class"/>
|
|
</fileset>
|
|
<manifest>
|
|
<attribute name="Main-Class" value="org.broadinstitute.sting.playground.tools.vcf.VCFTool" />
|
|
</manifest>
|
|
</jar>
|
|
|
|
<pathconvert property="jar.classpath" pathsep=" ">
|
|
<flattenmapper/>
|
|
<fileset dir="${dist.dir}" includes="*.jar"/>
|
|
<filelist files="GATKScala.jar"/>
|
|
</pathconvert>
|
|
|
|
<jar jarfile="${dist.dir}/VCFTool.jar" update="true" >
|
|
<manifest>
|
|
<attribute name="Class-Path" value="${jar.classpath}" />
|
|
</manifest>
|
|
</jar>
|
|
|
|
<jar jarfile="${dist.dir}/StingUtils.jar" update="true">
|
|
<manifest>
|
|
<attribute name="Class-Path" value="${jar.classpath}"/>
|
|
</manifest>
|
|
</jar>
|
|
|
|
<jar jarfile="${dist.dir}/GenomeAnalysisTK.jar" update="true">
|
|
<manifest>
|
|
<attribute name="Class-Path" value="${jar.classpath}"/>
|
|
</manifest>
|
|
</jar>
|
|
|
|
<jar jarfile="${dist.dir}/AnalyzeCovariates.jar" update="true" whenmanifestonly="skip">
|
|
<manifest>
|
|
<attribute name="Class-Path" value="${jar.classpath}" />
|
|
</manifest>
|
|
</jar>
|
|
|
|
<jar jarfile="${dist.dir}/CGUtilities.jar" update="true" whenmanifestonly="skip">
|
|
<manifest>
|
|
<attribute name="Class-Path" value="${jar.classpath}" />
|
|
</manifest>
|
|
</jar>
|
|
</target>
|
|
|
|
<target name="core" description="force a build of the Sting core code">
|
|
<antcall target="dist" inheritAll="true">
|
|
<param name="target" value="core" />
|
|
</antcall>
|
|
</target>
|
|
|
|
<target name="playground" description="force a build of the Sting experimental code">
|
|
<antcall target="dist" inheritAll="true">
|
|
<param name="target" value="playground" />
|
|
</antcall>
|
|
</target>
|
|
|
|
<target name="oneoffs" description="force a build of the Sting experimental code and one-offs">
|
|
<antcall target="dist" inheritAll="true">
|
|
<param name="target" value="oneoffs" />
|
|
</antcall>
|
|
</target>
|
|
|
|
<target name="test.compile" depends="oneoffs">
|
|
<echo message="Sting: Compiling test cases!"/>
|
|
<mkdir dir="${test.classes}"/>
|
|
<javac destdir="${test.classes}" debug="true" optimize="on">
|
|
<src path="${test.sources}"/>
|
|
<classpath>
|
|
<path refid="runtime.dependencies" />
|
|
<pathelement location="build"/>
|
|
<pathelement location="lib/junit-4.4.jar"/>
|
|
</classpath>
|
|
</javac>
|
|
</target>
|
|
|
|
<!-- new scala target -->
|
|
|
|
<target name="scala" description="build the scala directory">
|
|
<antcall target="resolve">
|
|
<param name="ivy.conf" value="scala"/>
|
|
</antcall>
|
|
<antcall target="dist"/>
|
|
<property name="scala.src" value="scala/src" />
|
|
<property name="scala.classes" value="scala/classes" />
|
|
<pathconvert property="scalajar.classpath" pathsep=";">
|
|
<flattenmapper/>
|
|
<fileset dir="${basedir}" includes="dist/*.jar"/>
|
|
</pathconvert>
|
|
|
|
<path id="scala.classpath">
|
|
<pathelement location="lib/scala-compiler-2.7.7.jar"/>
|
|
<pathelement location="lib/scala-library-2.7.7.jar"/>
|
|
<fileset dir="${dist.dir}">
|
|
<patternset id="scalaStuff">
|
|
<include name="*.jar"/>
|
|
</patternset>
|
|
</fileset>
|
|
</path>
|
|
<taskdef resource="scala/tools/ant/antlib.xml">
|
|
<classpath refid="scala.classpath"/>
|
|
</taskdef>
|
|
<mkdir dir="${scala.classes}"/>
|
|
<echo>Building Scala...</echo>
|
|
<scalac srcdir="${scala.src}" destdir="${scala.classes}" classpathref="scala.classpath" force="changed">
|
|
<include name="**/*.scala"/>
|
|
</scalac>
|
|
|
|
<jar jarfile="${dist.dir}/GATKScala.jar">
|
|
<fileset dir="${scala.classes}">
|
|
<include name="**/*.class"/>
|
|
</fileset>
|
|
</jar>
|
|
</target>
|
|
|
|
|
|
<!-- where to put reports and tests-->
|
|
<property name="report" value="${build.dir}/report"/>
|
|
<property name="test.classes" value="${build.dir}/testclasses"/>
|
|
<property name="test.output" value="${dist.dir}/test"/>
|
|
<property name="test.sources" value="java/test"/>
|
|
<!-- provide a ceiling on the memory that unit/integration tests can consume. -->
|
|
<property name="test.maxmemory" value="2g"/>
|
|
|
|
<!-- TEST -->
|
|
<target name="test" depends="test.compile,agent" description="Run unit tests">
|
|
<mkdir dir="${report}"/>
|
|
<echo message="Sting: Running test cases!"/>
|
|
<junit printsummary="yes" showoutput="yes" maxmemory="${test.maxmemory}" clonevm="yes" haltonfailure="${halt}" failureProperty="test.failure">
|
|
<jvmarg value="-javaagent:${build.dir}/TestAgent.jar"/>
|
|
<formatter type="${testOutput}" usefile="${usefile}" />
|
|
<classpath>
|
|
<path refid="runtime.dependencies"/>
|
|
<pathelement location="build"/>
|
|
<pathelement location="${test.classes}"/>
|
|
<pathelement location="lib/junit-4.4.jar"/>
|
|
</classpath>
|
|
|
|
<batchtest fork="yes" todir="${report}">
|
|
<fileset dir="${test.classes}">
|
|
<include name="**/${single}.class"/>
|
|
<exclude name="**/BaseTest.class"/>
|
|
<exclude name="**/*IntegrationTest.class"/>
|
|
</fileset>
|
|
</batchtest>
|
|
</junit>
|
|
<fail message="test failed" if="test.failure" />
|
|
</target>
|
|
<!-- Our long tests, tests that are more software integration and test -->
|
|
<target name="integrationtest" depends="test.compile"
|
|
description="Run the long integration unit tests">
|
|
<mkdir dir="${report}"/>
|
|
<echo message="Sting: Running integration test cases!"/>
|
|
<junit printsummary="yes" showoutput="yes" maxmemory="${test.maxmemory}" clonevm="yes" haltonfailure="${halt}" failureProperty="test.failure">
|
|
<formatter type="${testOutput}" usefile="${usefile}" />
|
|
<classpath>
|
|
<path refid="runtime.dependencies"/>
|
|
<pathelement location="${dist.dir}/GenomeAnalysisTK.jar"/>
|
|
<pathelement location="${test.classes}"/>
|
|
<pathelement location="lib/junit-4.4.jar"/>
|
|
</classpath>
|
|
|
|
<batchtest fork="yes" todir="${report}">
|
|
<fileset dir="${test.classes}">
|
|
<include name="**/${singleintegration}.class"/>
|
|
</fileset>
|
|
</batchtest>
|
|
</junit>
|
|
<fail message="test failed" if="test.failure" />
|
|
</target>
|
|
|
|
<!-- this builds the instrumentation library we're going to use for test cases -->
|
|
<target name="agent" description="build the agent">
|
|
<echo message="Sting: Creating test agent!"/>
|
|
<jar jarfile="${build.dir}/TestAgent.jar">
|
|
<fileset dir="build">
|
|
<include name="**/TrivialInstrumenter.class" />
|
|
</fileset>
|
|
|
|
<manifest>
|
|
<attribute name="Class-Path" value="${jar.classpath}"/>
|
|
<attribute name="Premain-Class" value="org.broadinstitute.sting.TrivialInstrumenter"/>
|
|
</manifest>
|
|
</jar>
|
|
</target>
|
|
|
|
<target name="javadoc" depends="init,resolve" description="generates javadoc">
|
|
<mkdir dir="javadoc"/>
|
|
<javadoc destdir="javadoc"
|
|
classpathref="runtime.dependencies">
|
|
<packageset refid="source.files"/>
|
|
</javadoc>
|
|
</target>
|
|
|
|
<!-- Unzip all classes from their current locations and assemble them in a staging directory -->
|
|
<target name="stage" description="stage files for distribution">
|
|
<mkdir dir="staging"/>
|
|
<unjar dest="staging" overwrite="false">
|
|
<fileset dir="${dist.dir}">
|
|
<patternset refid="dependency.mask" />
|
|
</fileset>
|
|
</unjar>
|
|
</target>
|
|
|
|
<!-- Build a package consisting of all supporting files -->
|
|
<target name="package" depends="dist,stage" description="bundle up an executable for distribution">
|
|
<mkdir dir="${dist.dir}/packages" />
|
|
<xslt in="packages/${executable}.xml" out="${dist.dir}/packages/Build${executable}.xml" style="packages/CreatePackager.xsl" />
|
|
<ant antfile="${dist.dir}/packages/Build${executable}.xml" />
|
|
</target>
|
|
|
|
<!-- Build a subset of picard with only those classes we need by completely abusing the packaging system -->
|
|
<!-- TODO: Reuse as much as possible of the 'stage' and 'package' targets -->
|
|
<target name="build-picard-private" depends="resolve">
|
|
<!-- Build out a classpath -->
|
|
<pathconvert property="required.picard.jars" pathsep=":">
|
|
<fileset dir="${basedir}">
|
|
<include name="staging" />
|
|
<include name="lib/picard-*.*.*.jar" />
|
|
<include name="lib/sam-*.jar" />
|
|
</fileset>
|
|
</pathconvert>
|
|
<echo message="required.picard.jars=${required.picard.jars}" />
|
|
|
|
<!-- Stage picard-private -->
|
|
<delete dir="staging" />
|
|
<mkdir dir="staging" />
|
|
<unjar src="${picard.dist.dir}/picard-private.jar" dest="staging" overwrite="true" />
|
|
|
|
<!-- Use the packaging system to extract parts of picard-private we need -->
|
|
<mkdir dir="${dist.dir}/packages" />
|
|
<xslt in="packages/PicardPrivate.xml" out="${dist.dir}/packages/BuildPicardPrivate.xml" style="packages/CreatePackager.xsl" />
|
|
<ant antfile="${dist.dir}/packages/BuildPicardPrivate.xml">
|
|
<property name="additional.jars" value="${required.picard.jars}" />
|
|
</ant>
|
|
</target>
|
|
|
|
<target name="clean" description="clean up">
|
|
<delete dir="out"/>
|
|
<delete dir="build"/>
|
|
<delete dir="lib"/>
|
|
<delete dir="staging"/>
|
|
<delete dir="${dist.dir}"/>
|
|
</target>
|
|
</project>
|