378 lines
13 KiB
XML
378 lines
13 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!--
|
|
Copyright (C) 2003-2006, Daniele Binosi and Lukas Theussl
|
|
Copyright (C) 2007-2008, Daniele Binosi, Lukas Theussl and Christian Kaufhold
|
|
|
|
See the file LICENSE in the source distribution home directory
|
|
for a full copy of the GPL (GNU General Public License).
|
|
|
|
This file is part of JaxoDraw.
|
|
|
|
JaxoDraw is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
JaxoDraw is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
-->
|
|
|
|
<project name="JaxoDraw" default="jar" basedir=".">
|
|
<description>
|
|
Ant build script for JaxoDraw.
|
|
</description>
|
|
|
|
<property file="build.properties"/>
|
|
<!-- set global properties for this build -->
|
|
<property name="name" value="JaxoDraw"/>
|
|
<property name="buildname" value="jaxodraw"/>
|
|
<property name="version" value="${jaxodraw.version}"/>
|
|
<property name="release" value="${jaxodraw.release}"/>
|
|
<property name="fullname" value="${buildname}-${version}-${release}"/>
|
|
<property name="dirname" value="${name}-${version}-${release}"/>
|
|
<property name="package" value="net.sf.jaxodraw"/>
|
|
<property name="package.dir" value="net/sf/jaxodraw"/>
|
|
<property name="src.dir" location="src"/>
|
|
<property name="doc.dir" location="${src.dir}/doc"/>
|
|
<property name="java.dir" location="${src.dir}/main/java"/>
|
|
<property name="test.dir" location="${src.dir}/test/java"/>
|
|
<property name="resource.dir" location="${src.dir}/main/resources"/>
|
|
<property name="test.resource.dir" location="${src.dir}/test/resources"/>
|
|
<property name="build.dir" location="build"/>
|
|
<property name="jarfile" value="${build.dir}/${fullname}.jar"/>
|
|
<property name="report.dir" location="${build.dir}/reports"/>
|
|
<property name="javadoc.dir" location="${build.dir}/javadoc"/>
|
|
<property name="javadoc.jar" value="${build.dir}/${fullname}_javadoc.jar"/>
|
|
<property name="dist.dir" location="dist"/>
|
|
|
|
<patternset id="dist.files">
|
|
<include name="README.txt"/>
|
|
<include name="**/README"/>
|
|
<include name="**/BUGS"/>
|
|
<include name="**/CHANGELOG"/>
|
|
<include name="**/TODO"/>
|
|
<include name="**/*LICENSE"/>
|
|
</patternset>
|
|
|
|
<patternset id="build.files">
|
|
<include name="README.txt"/>
|
|
<include name="build.xml"/>
|
|
<include name="build.properties"/>
|
|
<include name="project.xml"/>
|
|
<include name="project.properties"/>
|
|
</patternset>
|
|
|
|
<target name="check" depends="-init" description="print some properties">
|
|
<echo message="basedir = ${basedir}"/>
|
|
<echo message="fullname = ${fullname}"/>
|
|
<echo message="ant.home = ${ant.home}"/>
|
|
<echo message="ant.version = ${ant.version}"/>
|
|
<echo message="ant.java.version = ${ant.java.version}"/>
|
|
<echo message="java.class.path = ${java.class.path}"/>
|
|
</target>
|
|
|
|
<target name="-init">
|
|
<available
|
|
property="jdk14"
|
|
classname="java.awt.KeyboardFocusManager">
|
|
</available>
|
|
<available
|
|
file="${jarfile}"
|
|
type="file"
|
|
property="jarfile.exists">
|
|
</available>
|
|
<condition property="testcase.set">
|
|
<isset property="testcase"/>
|
|
</condition>
|
|
</target>
|
|
|
|
<target name="test"
|
|
description="runs a JUnit test suite">
|
|
<antcall target="compile-test"/>
|
|
<mkdir dir="${report.dir}"/>
|
|
<junit
|
|
showoutput="yes"
|
|
printsummary="yes"
|
|
fork="yes"
|
|
forkmode="once"
|
|
haltonfailure="yes"
|
|
tempdir="${report.dir}">
|
|
<classpath>
|
|
<pathelement location="${build.dir}"/>
|
|
<pathelement path="${java.class.path}"/>
|
|
</classpath>
|
|
<formatter type="xml"/>
|
|
<formatter type="brief" usefile="false"/>
|
|
<batchtest todir="${report.dir}">
|
|
<fileset dir="${test.dir}">
|
|
<include name="**/*Test.java"/>
|
|
<exclude name="**/Abstract*Test.java"/>
|
|
</fileset>
|
|
</batchtest>
|
|
</junit>
|
|
</target>
|
|
|
|
<target name="test-report" depends="test"
|
|
description="Generates a HTML report of the JUnit test suite">
|
|
<junitreport todir="${report.dir}">
|
|
<fileset dir="${report.dir}">
|
|
<include name="TEST-*.xml"/>
|
|
</fileset>
|
|
<report format="frames" todir="${report.dir}"/>
|
|
</junitreport>
|
|
</target>
|
|
|
|
<target name="test:single" depends="-init"
|
|
description="runs a single JUnit test (specify a 'testcase' property)">
|
|
<fail unless="testcase.set">
|
|
You need to provide a testcase (use eg: -Dtestcase=JaxoDraw.JaxoDrawTest)!
|
|
</fail>
|
|
<antcall target="compile-test"/>
|
|
<mkdir dir="${report.dir}"/>
|
|
<junit
|
|
showoutput="yes"
|
|
printsummary="yes"
|
|
fork="yes"
|
|
forkmode="once"
|
|
haltonfailure="yes"
|
|
tempdir="${report.dir}">
|
|
<classpath>
|
|
<pathelement location="${build.dir}"/>
|
|
<pathelement path="${java.class.path}"/>
|
|
</classpath>
|
|
<formatter type="xml"/>
|
|
<formatter type="brief" usefile="false"/>
|
|
<test name="${testcase}" todir="${report.dir}"/>
|
|
</junit>
|
|
</target>
|
|
|
|
<target name="compile-test" depends="-init" description="compiles tests">
|
|
<fail unless="jdk14">
|
|
You need at least version 1.4.1 of the Java SDK to compile JaxoDraw!
|
|
</fail>
|
|
<antcall target="copy-resources"/>
|
|
<antcall target="copy-test-resources"/>
|
|
<javac
|
|
optimize="yes"
|
|
nowarn="off"
|
|
debug="true"
|
|
deprecation="on"
|
|
source="1.8"
|
|
target="1.8"
|
|
includeAntRuntime="no"
|
|
sourcepath="${java.dir}"
|
|
classpath="${java.class.path}"
|
|
srcdir="${test.dir}"
|
|
destdir="${build.dir}">
|
|
<compilerarg value="-Xlint"/>
|
|
</javac>
|
|
</target>
|
|
|
|
<target name="compile" depends="-init"
|
|
description="compiles the sources">
|
|
<fail unless="jdk14">
|
|
You need at least version 1.4.1 of the Java SDK to compile JaxoDraw!
|
|
</fail>
|
|
<antcall target="prepare"/>
|
|
<javac
|
|
optimize="yes"
|
|
nowarn="off"
|
|
debug="true"
|
|
deprecation="on"
|
|
source="1.8"
|
|
target="1.8"
|
|
includeAntRuntime="no"
|
|
srcdir="${java.dir}"
|
|
destdir="${build.dir}">
|
|
<compilerarg value="-Xlint"/>
|
|
</javac>
|
|
</target>
|
|
|
|
<target name="jar" depends="compile"
|
|
description="delete any existing jar file and generate a new one">
|
|
<delete file="${jarfile}"/>
|
|
<jar
|
|
jarfile="${jarfile}"
|
|
basedir="${build.dir}"
|
|
manifest="${resource.dir}/META-INF/MANIFEST.MF">
|
|
</jar>
|
|
</target>
|
|
|
|
<target name="build" depends="jar"
|
|
description="build a new executable jar file"></target>
|
|
|
|
<target name="jaxodraw" depends="-init"
|
|
description="runs jaxodraw">
|
|
<antcall target="-create-jar"/>
|
|
<java jar="${jarfile}" fork="true" failonerror="true">
|
|
<arg line="${jaxodraw.cmd.args}"/>
|
|
</java>
|
|
</target>
|
|
|
|
<target name="profile" depends="-init" description="Profile Project">
|
|
<fail unless="netbeans.home">This target can only run inside the NetBeans IDE.</fail>
|
|
<antcall target="-create-jar"/>
|
|
<nbprofiledirect>
|
|
<classpath><pathelement location="${java.class.path}"/></classpath>
|
|
</nbprofiledirect>
|
|
|
|
<java jar="${jarfile}" fork="true" failonerror="true">
|
|
<jvmarg value="${profiler.info.jvmargs.agent}"/>
|
|
</java>
|
|
</target>
|
|
|
|
<target name="-create-jar" unless="jarfile.exists">
|
|
<antcall target="jar"/>
|
|
</target>
|
|
|
|
<target name="clean"
|
|
description="removes the ${build.dir} directory">
|
|
<delete dir="${build.dir}"/>
|
|
</target>
|
|
|
|
<target name="clean-all" depends="clean"
|
|
description="calls clean, removes ${dist.dir}">
|
|
<delete dir="${dist.dir}"/>
|
|
</target>
|
|
|
|
<target name="javadoc" depends="-init"
|
|
description="generates the javadoc API in the ${javadoc.dir} directory">
|
|
<fail unless="javadoc.api">
|
|
Please edit the `build.properties` file to set the path to your javadoc API!
|
|
</fail>
|
|
<mkdir dir="${javadoc.dir}"/>
|
|
<javadoc packagenames="${package}.*"
|
|
sourcepath="${java.dir}"
|
|
destdir="${javadoc.dir}"
|
|
breakiterator="yes"
|
|
author="true"
|
|
version="true"
|
|
use="false"
|
|
source="1.8"
|
|
windowtitle="JaxoDraw API">
|
|
<doctitle><![CDATA[<h1>JaxoDraw</h1>]]></doctitle>
|
|
<bottom><![CDATA[${javadoc.bottom}]]></bottom>
|
|
<tag name="todo" scope="all" description="To do:"/>
|
|
<link href="${javadoc.api}"/>
|
|
</javadoc>
|
|
</target>
|
|
|
|
<target name="javadoc:jar" depends="javadoc"
|
|
description="create a jar file containing the javadocs">
|
|
<jar jarfile="${javadoc.jar}" basedir="${javadoc.dir}"/>
|
|
</target>
|
|
|
|
<target name="usage"
|
|
description="print usage information">
|
|
<echo message=" Type 'ant -h' for general help on Ant."/>
|
|
<echo message=" Type 'ant -p' for a list of targets in this build file."/>
|
|
</target>
|
|
|
|
<target name="help" depends="usage" description="print usage information"/>
|
|
|
|
<target name="all" depends="jar, javadoc"
|
|
description="calls jar and javadoc targets">
|
|
</target>
|
|
|
|
<target name="dist-src" depends="-init,clean,test"
|
|
description="builds the source distribution">
|
|
<antcall target="clean"/>
|
|
<mkdir dir="${dist.dir}"/>
|
|
<antcall target="-make-src"/>
|
|
</target>
|
|
|
|
<target name="-make-src">
|
|
<antcall target="-fixEOL"/>
|
|
<tar destfile="${dist.dir}/${fullname}_src.tar.gz"
|
|
longfile="gnu"
|
|
compression="gzip">
|
|
<tarfileset dir="${basedir}"
|
|
prefix="${dirname}/"
|
|
includes="src/">
|
|
<patternset refid="build.files"/>
|
|
</tarfileset>
|
|
</tar>
|
|
</target>
|
|
|
|
<target name="dist-bin" depends="-init,clean,test"
|
|
description="builds the binary package for distribution">
|
|
<antcall target="clean"/>
|
|
<mkdir dir="${dist.dir}"/>
|
|
<antcall target="-make-bin"/>
|
|
</target>
|
|
|
|
<target name="-make-bin">
|
|
<antcall target="-fixEOL"/>
|
|
<antcall target="jar"/>
|
|
<tar destfile="${dist.dir}/${fullname}_bin.tar.gz"
|
|
longfile="gnu"
|
|
compression="gzip">
|
|
<tarfileset dir="${basedir}"
|
|
prefix="${dirname}">
|
|
<patternset refid="dist.files"/>
|
|
</tarfileset>
|
|
<tarfileset dir="${build.dir}"
|
|
prefix="${dirname}"
|
|
includes="${fullname}.jar"/>
|
|
</tar>
|
|
</target>
|
|
|
|
<target name="dist" depends="-init,clean-all,test"
|
|
description="builds all packages (src, bin) for distribution">
|
|
<mkdir dir="${dist.dir}"/>
|
|
<antcall target="-make-src"/>
|
|
<antcall target="-make-bin"/>
|
|
</target>
|
|
|
|
<target name="prepare"
|
|
description="copies resources (properties, icons, usrGuide) to ${build.dir}">
|
|
<mkdir dir="${build.dir}"/>
|
|
<antcall target="copy-resources"/>
|
|
</target>
|
|
|
|
<target name="copy-resources"
|
|
description="copies resources to ${build.dir}">
|
|
|
|
<copy todir="${build.dir}">
|
|
<fileset dir="${resource.dir}">
|
|
<exclude name="**/build-info.properties"/>
|
|
</fileset>
|
|
<mapper>
|
|
<globmapper from="*" to="resources/*"/>
|
|
</mapper>
|
|
</copy>
|
|
<copy file="${resource.dir}/properties/build-info.properties"
|
|
todir="${build.dir}/resources/properties/">
|
|
<filterset>
|
|
<filter token="version" value="${version}-${release}"/>
|
|
</filterset>
|
|
</copy>
|
|
</target>
|
|
|
|
<target name="copy-test-resources"
|
|
description="copies test resources to ${build.dir}">
|
|
|
|
<copy todir="${build.dir}">
|
|
<fileset dir="${test.resource.dir}"/>
|
|
</copy>
|
|
</target>
|
|
|
|
<target name="-fixEOL">
|
|
<fixcrlf srcdir="${doc.dir}"
|
|
tab="remove"
|
|
tablength="4"
|
|
eol="crlf"
|
|
includes="README BUGS CHANGELOG TODO legal/*">
|
|
</fixcrlf>
|
|
</target>
|
|
|
|
</project>
|