1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533
|
<!--
~ Copyright (c) 2007-2012 The Broad Institute, Inc.
~ SOFTWARE COPYRIGHT NOTICE
~ This software and its documentation are the copyright of the Broad Institute, Inc. All rights are reserved.
~
~ This software is supplied without any warranty or guaranteed support whatsoever. The Broad Institute is not responsible for its use, misuse, or functionality.
~
~ This software is licensed under the terms of the GNU Lesser General Public License (LGPL),
~ Version 2.1 which is available at http://www.opensource.org/licenses/lgpl-2.1.php.
-->
<project name="IGV" default="all" basedir=".">
<import file="build_macros.xml"/>
<property name="jar.name" value="igv.jar"/>
<property name="main-class" value="org.broad.igv.ui.Main"/>
<!-- Source and lib directories -->
<property name="src.dir" value="${basedir}/src/"/>
<property name="igvlib.dir" value="${basedir}/lib/"/>
<property name="lib.dir" value="/usr/share/java/"/>
<property name="testsrc.dir" value="${basedir}/test/src"/>
<property name="testlib.dir" value="${basedir}/test/lib"/>
<!-- Temp directory. Sources are compiled here prior to archiving -->
<property name="tmp.dir" value="${basedir}/tmp/"/>
<property name="testtmp.dir" value="${basedir}/testtmp/"/>
<property name="resource.dir" value="${tmp.dir}resources/"/>
<!-- Distribution directory. Binary distribution is placed here -->
<property name="dist.dir" value="${basedir}/"/>
<property name="jar.path" value="${dist.dir}${jar.name}"/>
<property name="dist.lib.dir" value="${dist.dir}lib/"/>
<property name="download.dir" value="${basedir}"/>
<property name="scripts.dir" value="${basedir}/scripts"/>
<property name="docs.dir" value="${basedir}/docs"/>
<property name="api.docs.dir" value="${docs.dir}/api"/>
<property name="javac.nowarn" value="off"/>
<property name="batik-codec-finame" value="batik-codec__V1.7.jar"/>
<property name="goby-io-finame" value="goby-io-igv__V1.0.jar"/>
<!-- Create class path for manifest -->
<path id="@jars">
<fileset dir="${lib.dir}">
<include name="batik-awt-util.jar"/>
<include name="batik-codec.jar"/>
<include name="batik-css.jar"/>
<include name="batik-dom.jar"/>
<include name="batik-ext.jar"/>
<include name="batik-gui-util.jar"/>
<include name="batik-gvt.jar"/>
<include name="batik-parser.jar"/>
<include name="batik-svg-dom.jar"/>
<include name="batik-svggen.jar"/>
<include name="batik-transcoder"/>
<include name="batik-util.jar" />
<include name="batik-xml.jar" />
<include name="commons-io.jar" />
<include name="commons-logging.jar" />
<include name="commons-math.jar" />
<include name="commons-net.jar" />
<include name="concurrent.jar" />
<include name="guava.jar" />
<include name="httpclient.jar" />
<include name="httpcore.jar" />
<include name="jama.jar" />
<include name="jargs.jar" />
<include name="jcommon.jar" />
<include name="jfreechart.jar" />
<include name="jhdf5.jar" />
<include name="net.sourceforge.jlibeps.jar" />
<include name="junit4.jar" />
<include name="log4j-1.2.jar" />
<include name="sam.jar" />
<include name="htsjdk.jar" />
<include name="swing-layout.jar" />
<include name="xml-apis.jar" />
<include name="xml-apis-ext.jar" />
<include name="AbsoluteLayout.jar" />
<include name="bcprov.jar" />
<include name="jgrapht0.8.jar" />
<include name="cofoja.jar" />
<include name="jide-oss.jar" />
<include name="gson.jar" />
<exclude name="appbundler*.jar"/>
</fileset>
</path>
<!-- Clean all generated artifacts -->
<target name="clean">
<delete dir="${tmp.dir}"/>
<delete dir="${testtmp.dir}"/>
</target>
<!-- Would like to be able to set bcel to true or false
This is easy in ant 1.8, but not earlier versions-->
<condition property="act.include.libs">
<and>
<available classname="org.apache.tools.ant.util.depend.bcel.FullAnalyzer"/>
<istrue value="${include.libs}"/>
</and>
</condition>
<!-- Unzip jars to the tmp directory -->
<target name="prepare" if="act.include.libs">
<unzip dest="${tmp.dir}">
<!-- Copy almost everything to tmp directory
Certain jars we include whole, because we need their manifests
Batik and Goby get copied later.
Certain jars we just want to ignore (junit, appbundler)-->
<patternset>
<include name="**/*"/>
<exclude name="META-INF/**"/>
<exclude name="**/*.SF"/>
<exclude name="${lib.dir}/*"/>
</patternset>
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
<exclude name="appbundler*.jar"/>
<exclude name="**/*junit*.jar"/>
<exclude name="**/${batik-codec-finame}"/>
<exclude name="**/${goby-io-finame}"/>
<exclude name="**/*AppleJavaExtensions.jar"/>
</fileset>
</unzip>
</target>
<target name="rewrite-log" if="log.level">
<set_log_level targetFile="${tmp.dir}log4j.properties" logLevel="${log.level}"/>
</target>
<target name="init" depends="clean">
<mkdir dir="${tmp.dir}"/>
<mkdir dir="${testtmp.dir}"/>
<mkdir dir="${dist.dir}"/>
<!-- Copy resource files to the tmp directory -->
<copy todir="${tmp.dir}" overwrite="true">
<fileset dir="${src.dir}">
<exclude name="**/*.form"/>
<exclude name="**/*.java"/>
<exclude name="**/*.svn"/>
<exclude name="**/manifest.mf"/>
</fileset>
</copy>
<unjar dest="${tmp.dir}">
<fileset dir="lib">
<exclude name="**/*.txt"/>
<exclude name="**/*.SF"/>
</fileset>
</unjar>
<delete>
<fileset dir="${tmp.dir}" includes="**/*.SF"/>
</delete>
<antcall target="prepare"/>
<write_version targetFile="${resource.dir}about.properties"/>
<antcall target="rewrite-log"/>
<condition property="compile.tests">
<and>
<not>
<isset property="notests"/>
</not>
<available file="${testsrc.dir}" type="dir"/>
</and>
</condition>
</target>
<!-- We compile IGV and the tests separately, because we only want
to include the main classes in the JAR and so it's easier to run
tests later. -->
<target name="compile" depends="init" description="Compile main source files to temp directory">
<javac includeantruntime="false"
srcdir="${src.dir}" debug="on" destdir="${tmp.dir}" encoding="${java.encoding}"
target="${javac.target}" source="${javac.target}" nowarn="${javac.nowarn}">
<classpath refid="@jars"/>
<classpath>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
</javac>
<!--
<copy todir="${tmp.dir}/META-INF/services" overwrite="true">
<fileset dir="${basedir}/services"/>
</copy>
-->
</target>
<target name="build-java-agent" description="Create JavaAgent.jar in testlib directory. Necessary for profiling"
depends="compile">
<jar destfile="${testlib.dir}/JavaAgent.jar" basedir="${tmp.dir}" compress="true" duplicate="preserve">
<include name="org/broad/igv/util/JavaAgent.class"/>
<include name="org/broad/igv/util/JavaAgent$*.class"/>
<manifest>
<attribute name="Premain-Class" value="org.broad.igv.util.JavaAgent"/>
</manifest>
</jar>
</target>
<target name="compileTests" if="compile.tests" description="Compile test files to testtmp directory, WITHOUT compiling main source files">
<javac srcdir="${testsrc.dir}" debug="on" destdir="${testtmp.dir}" includeantruntime="true"
target="${javac.target}" source="${javac.target}" encoding="${java.encoding}" nowarn="${javac.nowarn}">
<classpath refid="test.classpath"/>
</javac>
</target>
<macrodef name="build">
<attribute name="includedFileset"/>
<sequential>
<jar destfile="${jar.path}" basedir="${tmp.dir}" compress="true" duplicate="preserve" index="true">
<indexjars refid="@jars" />
<fileset refid="@{includedFileset}"/>
<manifest>
<attribute name="Permissions" value="all-permissions"/>
<attribute name="Application-Name" value="${ant.project.name}"/>
<!-- Here just to be a good citizen. Apparently reading from the correct manifest
is tricky. We rely on a separate properties file-->
<attribute name="Class-Path" value="${class-path}"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Main-Class" value="${main-class}"/>
<section name="org/broad/igv">
<attribute name="Specification-Title" value="${ant.project.name}"/>
<attribute name="Specification-Version" value="${version}"/>
<attribute name="Specification-Vendor" value="${vendor}"/>
<attribute name="Implementation-Version" value="${version} ${build-number}"/>
<attribute name="Implementation-Vendor" value="${vendor}"/>
</section>
</manifest>
</jar>
<!--<copy file="${lib.dir}${batik-codec-finame}" tofile="${dist.dir}${batik-codec-finame}" overwrite="true"/>-->
<copy file="${igvlib.dir}${goby-io-finame}" tofile="${dist.dir}${goby-io-finame}" overwrite="true"/>
<delete dir="${tmp.dir}"/>
<delete dir="${testtmp.dir}"/>
</sequential>
</macrodef>
<target name="build-small" depends="compile,compileTests" unless="act.include.libs"
description="Build the IGV JAR, without including libraries">
<fileset dir="${tmp.dir}" id="files"/>
<pathconvert property="class-path" pathsep=" " dirsep="/" refid="@jars">
<map from="${lib.dir}" to="/"/>
</pathconvert>
<build includedFileset="files"/>
</target>
<target name="build-all" depends="compile,compileTests" if="act.include.libs"
description="Build the IGV JAR, including libraries, using BCEL to take only required classes">
<classfileset dir="${tmp.dir}" id="files">
<root classname="${main-class}"/>
</classfileset>
<property name="class-path" value="${goby-io-finame}"/>
<build includedFileset="files"/>
</target>
<condition property="isWindows">
<os family="windows" />
</condition>
<condition property="isLinux">
<os family="unix" />
</condition>
<condition property="isMac">
<os family="mac" />
</condition>
<!-- Copy launching scripts to dest dir, where igv.jar is -->
<target name="copy-launch-scripts-win" if="isWindows">
<copy file="scripts/igv.bat" todir="${dist.dir}" overwrite="false"/>
<copy file="scripts/igvtools.bat" todir="${dist.dir}" overwrite="false"/>
<copy file="scripts/igvtools_gui.bat" todir="${dist.dir}" overwrite="false"/>
</target>
<target name="copy-launch-scripts-mac" if="isMac">
<copy file="scripts/igv.command" todir="${dist.dir}" overwrite="false"/>
<copy file="scripts/igvtools" todir="${dist.dir}" overwrite="false"/>
<copy file="scripts/igvtools_gui.command" todir="${dist.dir}" overwrite="false"/>
</target>
<target name="copy-launch-scripts-linux" if="isLinux">
<copy file="scripts/igv.sh" todir="${dist.dir}" overwrite="false"/>
<copy file="scripts/igvtools" todir="${dist.dir}" overwrite="false"/>
<copy file="scripts/igvtools_gui" todir="${dist.dir}" overwrite="false"/>
</target>
<target name="build" depends="build-small,build-all"/>
<target name="all" depends="build, clean"/>
<!-- Run all tests with ant -->
<path id="test.classpath">
<path refid="@jars"/>
<fileset dir="${testlib.dir}">
<include name="fest*.jar"/>
<include name="jcip*.jar"/>
</fileset>
<pathelement location="${testtmp.dir}"/>
<pathelement location="${tmp.dir}"/>
</path>
<property name="test.reports" value="${basedir}/reports"/>
<property name="test.reports.tmp" value="${basedir}/reportstmp"/>
<property name="LARGE_DATA_DIR" value="${basedir}/test/largedata/"/>
<!--Path to mongodb executable. For testing; is optional-->
<property name="MONGO_EXEC_PATH" value="mongod"/>
<!--Can override this on command line to see test output-->
<property name="show.test.out" value="no"/>
<!--For testing jenkins mostly. When set to true, there is a test in ReadmeParserTest which will fail-->
<property name="make.fail" value="false"/>
<!--Hosted data test explicitly excluded, never run automated, can run manual-->
<fileset dir="${testtmp.dir}" id="allfileset">
<include name="**/*.class"/>
<exclude name="**/*$*.class"/>
</fileset>
<fileset dir="${testtmp.dir}" id="longfileset">
<include name="**/*HostedData*.class"/>
<include name="**/*IGVTools*.class"/>
<include name="**/*TrackLoader*.class"/>
<exclude name="**/*$*.class"/>
</fileset>
<fileset dir="${testtmp.dir}" id="uifileset">
<include name="**/IGVCommandBarTest.class"/>
<include name="**/CommandExecutorTest.class"/>
<include name="**/MainTest.class"/>
<include name="**/IGVTestHeaded.class"/>
<include name="**/CoverageTrackTest.class"/>
<include name="**/TrackLoaderTestHeaded.class"/>
<exclude name="**/*$*.class"/>
</fileset>
<!-- This looks a bit complicated but there is logic to it. We define this target
to be run by any other test runners, after they define an appropriate fileset.
We define files of tests to be run above (allfileset and uifileset), one
can also define their own by setting the filesetpattern property.
e.g.
>ant tests
runs all tests
>ant -Dfilesetpattern *BED* tests
would run any test with BED in the file name.
>ant -Dfilesetpattern IGVToolsTest tests
would simply run IGVToolsTest.
-->
<target name="actruntests" depends="compileTests">
<delete dir="${test.reports}"/>
<mkdir dir="${test.reports}"/>
<junit haltonfailure="no" showoutput="${show.test.out}" printsummary="on" failureproperty="tests.failed"
maxmemory="2000m">
<jvmarg value="-javaagent:${testlib.dir}/JavaAgent.jar"/>
<jvmarg value="-Dfile.encoding=${java.encoding}"/>
<jvmarg value="-Dinclude.longrunning=${include.longrunning}"/>
<jvmarg value="-Dignore.ioexceptions=${ignore.ioexceptions}"/>
<sysproperty key="LARGE_DATA_DIR" value="${LARGE_DATA_DIR}"/>
<sysproperty key="MONGO_EXEC_PATH" value="${MONGO_EXEC_PATH}"/>
<sysproperty key="make.fail" value="${make.fail}"/>
<classpath refid="test.classpath"/>
<formatter type="xml" usefile="true"/>
<batchtest fork="yes" todir="${test.reports}" if="filesetpattern">
<fileset dir="${testtmp.dir}">
<include name="**/${filesetpattern}.class"/>
<exclude name="**/*$*.class"/>
</fileset>
</batchtest>
<batchtest fork="yes" todir="${test.reports}" unless="filesetpattern">
<fileset refid="${filesetid}"/>
</batchtest>
</junit>
</target>
<target name="makereports" depends="actruntests">
<junitreport todir="${test.reports}">
<fileset dir="${test.reports}">
<include name="TEST-*.xml"/>
</fileset>
<report todir="${test.reports}"/>
</junitreport>
<fail message="Test failure detected, check test results." if="tests.failed"/>
</target>
<!-- Run tests without compiling source files. Primarily used
for testing packaged jar-->
<target name="tests_nocompile">
<antcall target="makereports">
<param name="filesetid" value="allfileset"/>
</antcall>
</target>
<target name="tests" depends="compile, tests_nocompile"/>
<target name="uitests" depends="compile">
<antcall target="makereports">
<param name="filesetid" value="uifileset"/>
</antcall>
</target>
<!-- Re-run failed tests only. Copy reports to a temp file
because otherwise they would get deleted-->
<fileset dir="${testtmp.dir}" id="failedtests">
<include name="**/*.class"/>
<exclude name="**/*$*.class"/>
<custom classname="util.FailedTestSelector" classpath="${testtmp.dir}">
<param name="reportDir" value="${test.reports.tmp}"/>
</custom>
</fileset>
<property name="input.test.reports" value="${test.reports}"/>
<target name="failedtests" depends="compile">
<delete dir="${test.reports.tmp}"/>
<copy todir="${test.reports.tmp}" overwrite="true">
<fileset dir="${input.test.reports}">
<include name="**/*.xml"/>
</fileset>
</copy>
<antcall target="makereports">
<param name="filesetid" value="failedtests"/>
</antcall>
<delete dir="${test.reports.tmp}"/>
</target>
<!-- Deploy the application -->
<target name="deploy">
<copy todir="${deploy.dir}" overwrite="true">
<fileset dir="${dist.dir}">
<include name="lib/**"/>
</fileset>
<fileset file="${dist.dir}${jar.name}"/>
</copy>
</target>
<!--
We use publishedApiDoclet to generate documentation only for those methods/fields
which are marked as part of the api.
See http://developer.berlios.de/projects/padoclet/
and
http://developer.berlios.de/forum/forum.php?forum_id=22147
-->
<target name="create-api-doc">
<delete dir="${api.docs.dir}"/>
<mkdir dir="${api.docs.dir}"/>
<javadoc access="public"
useexternalfile="yes"
additionalparam="-quiet"
destdir="${api.docs.dir}"
packagenames="org.broad.igv.*"
sourcepath="src"
defaultexcludes="yes"
author="true"
version="true"
use="true"
windowtitle="IGV API Documentation">
<tag name="api_since" description="Since: " scope="all"/>
<tag name="api_until" description="Until: "/>
<doclet name="de.kruis.padoclet.PublishedApiDoclet" path="${basedir}/docs/lib/publishedApiDoclet1.5-0.4.jar">
<param name="-padDefaultIsExclude"/>
<param name="-padFilterDefault" value=".*"/>
<param name="-padExcludeTag" value="noapi"/>
<param name="-padIncludeTag" value="api"/>
</doclet>
</javadoc>
</target>
<!-- Build MacOS native app-->
<!-- Create the app bundle from an input jar-->
<macrodef name="bundle-jar-macro">
<attribute name="version"/>
<attribute name="dist.dir"/>
<attribute name="jar.name"/>
<sequential>
<!-- Define the appbundler task -->
<taskdef name="bundleapp" classname="com.oracle.appbundler.AppBundlerTask" classpath="${basedir}/ant/appbundler-1.0.jar"/>
<bundleapp outputdirectory="${download.dir}"
name="IGV_@{version}"
displayname="${ant.project.name}"
identifier="${main-class}"
shortversion="${version}"
applicationCategory="public.app-category.developer-tools"
mainclassname="${main-class}"
icon="${basedir}/resources/igv_icon.icns">
<!-- Bundle JRE located at dir-->
<!--runtime dir="${env.JAVA_HOME}" /-->
<classpath dir="@{dist.dir}">
<include name="@{jar.name}"/>
<include name="${goby-io-finame}"/>
</classpath>
<option value="-Dapple.laf.useScreenMenuBar=true"/>
<argument value="-Xmx4g"/>
<argument value="-Xdock:name=${ant.project.name}"/>
</bundleapp>
</sequential>
</macrodef>
<!-- Target to be called as part of building all-->
<target name="bundle" depends="build-all">
<bundle-jar-macro version="${version}" dist.dir="${dist.dir}" jar.name="${jar.name}"/>
</target>
<!-- Target to bundle an existing build -->
<target name="bundle-existing">
<bundle-jar-macro version="${version}" dist.dir="${dist.dir}" jar.name="${jar.name}"/>
</target>
</project>
|