2009-05-31 17:23:49 +00:00
|
|
|
<project name="OpenRocket" basedir=".">
|
|
|
|
|
2009-06-09 16:56:52 +00:00
|
|
|
<property file="build.properties" />
|
|
|
|
|
2009-09-01 15:25:04 +00:00
|
|
|
<property name="src.dir" value="src"/> <!-- Source directory -->
|
|
|
|
<property name="src-test.dir" value="test"/> <!-- Test directory -->
|
|
|
|
<property name="build.dir" value="build"/> <!-- Build directory -->
|
|
|
|
<property name="build-test.dir" value="build/test"/><!-- Build directory -->
|
|
|
|
|
2009-05-31 17:23:49 +00:00
|
|
|
<!-- Distribution directory, from which stuff is jar'ed -->
|
2009-09-01 15:25:04 +00:00
|
|
|
<property name="dist.dir" value="${build.dir}/dist"/>
|
|
|
|
<property name="dist-test.dir" value="${build.dir}/dist-test"/>
|
2009-05-31 17:23:49 +00:00
|
|
|
|
|
|
|
<property name="classes.dir" value="${dist.dir}"/> <!-- Directory for classes -->
|
|
|
|
<property name="jar.dir" value="${build.dir}/jar"/> <!-- Directory for built jar's -->
|
|
|
|
<property name="lib.dir" value="lib"/> <!-- Library source directory -->
|
|
|
|
|
2009-06-09 18:27:33 +00:00
|
|
|
<property name="pkgname" value="${ant.project.name}-${build.version}"/>
|
|
|
|
|
2009-06-09 16:56:52 +00:00
|
|
|
<property name="jar.file" value="${jar.dir}/${ant.project.name}.jar"/>
|
2009-06-09 18:27:33 +00:00
|
|
|
<property name="dist.bin" value="${jar.dir}/${pkgname}.jar"/>
|
|
|
|
<property name="dist.src" value="${jar.dir}/${pkgname}-src.zip"/>
|
2009-05-31 17:23:49 +00:00
|
|
|
|
|
|
|
<!-- The main class of the application -->
|
2009-05-31 17:50:09 +00:00
|
|
|
<property name="main-class" value="net.sf.openrocket.startup.Startup"/>
|
2009-05-31 17:23:49 +00:00
|
|
|
|
|
|
|
|
2009-09-26 17:06:37 +00:00
|
|
|
<!-- Classpath definitions -->
|
2009-05-31 17:23:49 +00:00
|
|
|
<path id="classpath">
|
|
|
|
<fileset dir="${lib.dir}" includes="**/*.jar"/>
|
|
|
|
</path>
|
|
|
|
|
2009-09-26 17:06:37 +00:00
|
|
|
<path id="test-classpath">
|
|
|
|
<path refid="classpath"/>
|
2009-10-04 15:46:32 +00:00
|
|
|
<pathelement location="${basedir}"/>
|
2009-09-26 17:06:37 +00:00
|
|
|
<pathelement location="${build-test.dir}"/>
|
|
|
|
<pathelement location="${classes.dir}"/>
|
2010-03-20 13:36:07 +00:00
|
|
|
<pathelement location="${src-test.dir}"/>
|
2010-10-25 19:02:31 +00:00
|
|
|
<pathelement location="lib-test/junit-dep-4.8.2.jar"/>
|
|
|
|
<pathelement location="lib-test/hamcrest-core-1.3.0RC1.jar"/>
|
|
|
|
<pathelement location="lib-test/hamcrest-library-1.3.0RC1.jar"/>
|
|
|
|
<pathelement location="lib-test/jmock-2.6.0-RC2.jar"/>
|
|
|
|
<pathelement location="lib-test/jmock-junit4-2.6.0-RC2.jar"/>
|
2009-09-26 17:06:37 +00:00
|
|
|
</path>
|
|
|
|
|
2009-09-01 15:25:04 +00:00
|
|
|
|
2009-06-09 16:56:52 +00:00
|
|
|
|
2009-05-31 17:23:49 +00:00
|
|
|
<!-- CLEAN -->
|
|
|
|
<target name="clean">
|
|
|
|
<delete dir="${build.dir}"/>
|
2009-09-26 17:06:37 +00:00
|
|
|
<delete dir="tmp/"/>
|
2009-05-31 17:23:49 +00:00
|
|
|
</target>
|
|
|
|
|
2009-06-09 16:56:52 +00:00
|
|
|
|
2009-05-31 17:23:49 +00:00
|
|
|
<!-- BUILD -->
|
|
|
|
<target name="build">
|
|
|
|
<mkdir dir="${classes.dir}"/>
|
2010-07-17 22:52:23 +00:00
|
|
|
<echo level="info">Compiling main classes</echo>
|
|
|
|
<javac debug="true" srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath"/>
|
|
|
|
<echo level="info">Copying build.properties</echo>
|
2009-09-26 17:06:37 +00:00
|
|
|
<copy file="build.properties" todir="${dist.dir}"/>
|
2009-05-31 17:23:49 +00:00
|
|
|
</target>
|
|
|
|
|
2009-06-09 16:56:52 +00:00
|
|
|
|
2009-05-31 17:23:49 +00:00
|
|
|
<!-- JAR -->
|
|
|
|
<target name="jar" depends="build">
|
|
|
|
<copy todir="${dist.dir}/">
|
2009-09-26 17:06:37 +00:00
|
|
|
<fileset dir="." includes="LICENSE.TXT README.TXT ChangeLog ReleaseNotes build.properties fileformat.txt" />
|
2009-06-09 16:56:52 +00:00
|
|
|
<fileset dir="." includes="datafiles/ pix/" />
|
2009-05-31 17:23:49 +00:00
|
|
|
</copy>
|
|
|
|
<mkdir dir="${jar.dir}"/>
|
2009-06-09 16:56:52 +00:00
|
|
|
<jar destfile="${jar.file}" basedir="${dist.dir}">
|
2009-05-31 17:23:49 +00:00
|
|
|
<manifest>
|
|
|
|
<attribute name="Main-Class" value="${main-class}"/>
|
|
|
|
<attribute name="SplashScreen-Image" value="pix/splashscreen.png"/>
|
|
|
|
</manifest>
|
|
|
|
<zipfileset src="lib/miglayout15-swing.jar" />
|
|
|
|
<zipfileset src="lib/jcommon-1.0.16.jar" />
|
|
|
|
<zipfileset src="lib/jfreechart-1.0.13.jar" />
|
|
|
|
</jar>
|
|
|
|
</target>
|
|
|
|
|
2009-06-09 16:56:52 +00:00
|
|
|
|
|
|
|
<!-- DIST-SRC -->
|
2009-09-26 17:06:37 +00:00
|
|
|
<target name="dist-src">
|
2009-06-09 16:56:52 +00:00
|
|
|
<echo>
|
|
|
|
Building source distribution
|
|
|
|
</echo>
|
2009-06-09 18:27:33 +00:00
|
|
|
<mkdir dir="${build.dir}/${pkgname}"/>
|
2009-06-09 16:56:52 +00:00
|
|
|
<mkdir dir="${jar.dir}"/>
|
2009-06-09 18:27:33 +00:00
|
|
|
<copy todir="${build.dir}/${pkgname}">
|
2009-06-09 16:56:52 +00:00
|
|
|
<fileset dir="." includes="*">
|
|
|
|
<type type="file"/>
|
|
|
|
</fileset>
|
2009-10-10 13:13:32 +00:00
|
|
|
<fileset dir="." includes="datafiles/ lib/ lib-test/ pix/ src/ test/"/>
|
2009-06-09 18:27:33 +00:00
|
|
|
</copy>
|
|
|
|
<zip destfile="${dist.src}" basedir="${build.dir}" includes="${pkgname}/"/>
|
|
|
|
<delete dir="${build.dir}/${pkgname}"/>
|
2009-06-09 16:56:52 +00:00
|
|
|
</target>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- DIST-SRC-TEST -->
|
|
|
|
<target name="dist-src-test" depends="dist-src">
|
|
|
|
<echo>
|
|
|
|
Testing source distribution
|
|
|
|
</echo>
|
2009-09-01 15:25:04 +00:00
|
|
|
<delete dir="${dist-test.dir}"/>
|
|
|
|
<mkdir dir="${dist-test.dir}"/>
|
|
|
|
<unzip dest="${dist-test.dir}" src="${dist.src}"/>
|
|
|
|
<ant dir="${dist-test.dir}/${pkgname}" antfile="build.xml" target="jar"/>
|
|
|
|
<ant dir="${dist-test.dir}/${pkgname}" antfile="build.xml" target="unittest"/>
|
|
|
|
<delete dir="${dist-test.dir}"/>
|
2009-06-09 16:56:52 +00:00
|
|
|
<echo>
|
2009-09-01 15:25:04 +00:00
|
|
|
Source distribution test successful
|
2009-06-09 16:56:52 +00:00
|
|
|
</echo>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- DIST-BIN -->
|
2009-10-10 13:13:32 +00:00
|
|
|
<target name="dist-bin" depends="check,clean,unittest,jar">
|
2009-06-09 16:56:52 +00:00
|
|
|
<move file="${jar.file}" tofile="${dist.bin}"/>
|
2009-05-31 17:23:49 +00:00
|
|
|
</target>
|
|
|
|
|
2009-06-09 16:56:52 +00:00
|
|
|
|
|
|
|
<!-- DIST -->
|
|
|
|
<target name="dist" depends="dist-bin,dist-src,dist-src-test">
|
|
|
|
<echo>Distribution ${build.version} (${build.source}) built into directory ${jar.dir}</echo>
|
|
|
|
</target>
|
|
|
|
|
2009-09-01 15:25:04 +00:00
|
|
|
|
2009-10-10 13:13:32 +00:00
|
|
|
<!-- CHECK -->
|
|
|
|
<target name="check" depends="checktodo,checkascii"/>
|
|
|
|
|
2009-09-01 15:25:04 +00:00
|
|
|
<!-- CHECK TODOs -->
|
2010-02-17 20:37:35 +00:00
|
|
|
<target name="todo" depends="checktodo"/>
|
2009-09-01 15:25:04 +00:00
|
|
|
<target name="checktodo">
|
|
|
|
<tempfile property="todo.file" prefix="checktodo-"/>
|
|
|
|
<echo>Checking project for critical TODOs.</echo>
|
|
|
|
<concat destfile="${todo.file}">
|
|
|
|
<fileset dir="${src.dir}">
|
|
|
|
<include name="**/*.java"/>
|
|
|
|
</fileset>
|
2009-10-10 13:13:32 +00:00
|
|
|
<fileset dir="${src-test.dir}">
|
|
|
|
<include name="**/*.java"/>
|
|
|
|
</fileset>
|
2009-09-01 15:25:04 +00:00
|
|
|
<filterchain>
|
|
|
|
<linecontainsregexp>
|
|
|
|
<regexp pattern="TODO:.*CRITICAL"/>
|
|
|
|
</linecontainsregexp>
|
|
|
|
</filterchain>
|
|
|
|
</concat>
|
|
|
|
<loadfile srcfile="${todo.file}" property="criticaltodos"/>
|
|
|
|
<delete file="${todo.file}"/>
|
|
|
|
<fail if="criticaltodos">CRITICAL TODOs exist in project:
|
|
|
|
${criticaltodos}</fail>
|
|
|
|
<echo>No critical TODOs in project.</echo>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
|
2009-10-10 13:13:32 +00:00
|
|
|
<!-- CHECK TODOs -->
|
2010-02-17 20:37:35 +00:00
|
|
|
<target name="ascii" depends="checkascii"/>
|
2009-10-10 13:13:32 +00:00
|
|
|
<target name="checkascii">
|
|
|
|
<tempfile property="ascii.file" prefix="checkascii-"/>
|
|
|
|
<echo>Checking project for non-ASCII characters.</echo>
|
|
|
|
<concat destfile="${ascii.file}">
|
|
|
|
<fileset dir="${src.dir}">
|
|
|
|
<include name="**/*.java"/>
|
|
|
|
</fileset>
|
|
|
|
<fileset dir="${src-test.dir}">
|
|
|
|
<include name="**/*.java"/>
|
|
|
|
</fileset>
|
|
|
|
<filterchain>
|
|
|
|
<linecontainsregexp>
|
|
|
|
<regexp pattern="\P{ASCII}"/>
|
|
|
|
</linecontainsregexp>
|
|
|
|
</filterchain>
|
|
|
|
</concat>
|
|
|
|
<loadfile srcfile="${ascii.file}" property="nonascii"/>
|
|
|
|
<delete file="${ascii.file}"/>
|
|
|
|
<fail if="nonascii">Non-ASCII characters exist in project:
|
|
|
|
${nonascii}</fail>
|
|
|
|
<echo>No non-ASCII characters in project.</echo>
|
|
|
|
</target>
|
|
|
|
|
|
|
|
|
2009-09-01 15:25:04 +00:00
|
|
|
<!-- Unit tests -->
|
|
|
|
<target name="unittest" description="Execute unit tests" depends="build">
|
|
|
|
<echo>Building unit tests</echo>
|
|
|
|
<mkdir dir="${build-test.dir}"/>
|
2009-10-04 15:46:32 +00:00
|
|
|
<javac debug="true" srcdir="${src-test.dir}" destdir="${build-test.dir}" classpathref="test-classpath"/>
|
2009-09-01 15:25:04 +00:00
|
|
|
|
|
|
|
<echo>Running unit tests</echo>
|
|
|
|
<mkdir dir="tmp/rawtestoutput"/>
|
2010-03-20 13:36:07 +00:00
|
|
|
<junit fork="yes" forkmode="once" printsummary="false" failureproperty="junit.failure">
|
2009-09-26 17:06:37 +00:00
|
|
|
<classpath>
|
|
|
|
<path refid="test-classpath"/>
|
|
|
|
<path location="${basedir}"/>
|
|
|
|
</classpath>
|
2009-09-01 15:25:04 +00:00
|
|
|
<batchtest todir="tmp/rawtestoutput">
|
2009-09-26 17:06:37 +00:00
|
|
|
<fileset dir="${build-test.dir}">
|
2010-03-20 13:36:07 +00:00
|
|
|
<include name="**/Test*.class" />
|
|
|
|
<include name="**/*Test.class" />
|
2009-10-10 13:13:32 +00:00
|
|
|
<exclude name="**/*$*.class" />
|
2009-09-26 17:06:37 +00:00
|
|
|
<exclude name="Test.class" />
|
2009-09-01 15:25:04 +00:00
|
|
|
</fileset>
|
|
|
|
<formatter type="xml"/>
|
|
|
|
</batchtest>
|
|
|
|
</junit>
|
|
|
|
<junitreport todir="tmp">
|
|
|
|
<fileset dir="tmp/rawtestoutput"/>
|
|
|
|
<report todir="tmp/test-reports"/>
|
|
|
|
</junitreport>
|
2009-10-10 13:13:32 +00:00
|
|
|
<fail if="junit.failure" message="Unit test(s) failed. See report in ${basedir}/tmp/test-reports/index.html"/>
|
|
|
|
<echo>
|
|
|
|
Unit tests passed successfully.
|
|
|
|
</echo>
|
2009-09-01 15:25:04 +00:00
|
|
|
</target>
|
|
|
|
|
2009-05-31 17:23:49 +00:00
|
|
|
</project>
|