openrocket/core/build.xml

154 lines
5.9 KiB
XML
Raw Normal View History

<project name="OpenRocket-Core" basedir=".">
2009-05-31 17:23:49 +00:00
<property file="resources/build.properties" />
2009-06-09 16:56:52 +00:00
<property name="src.dir" value="${basedir}/src"/> <!-- Source directory -->
<property name="src-test.dir" value="${basedir}/test"/> <!-- Test directory -->
<property name="build.dir" value="${basedir}/build"/> <!-- Build directory -->
<property name="build-test.dir" value="${basedir}/build/test"/> <!-- Build directory -->
<property name="lib.dir" value="${basedir}/lib"/> <!-- Library source directory -->
<property name="libtest.dir" value="${basedir}/../lib-test"/> <!-- Library test source directory -->
<property name="libextra.dir" value="${basedir}/lib-extra"/> <!-- Library extra source directory -->
<property name="tmp.dir" value="${basedir}/tmp"/> <!-- Temporary directory -->
<property name="resources.dir" value="${basedir}/resources"/> <!-- Resources directory -->
<property name="resources-src.dir" value="${basedir}/resources-src"/> <!-- Resources 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 -->
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-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"/>
<pathelement location="${resources.dir}"/>
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}"/>
<fileset dir="${libtest.dir}/" includes="*.jar"/>
2009-09-26 17:06:37 +00:00
</path>
<path id="run-classpath">
<path refid="classpath"/>
<pathelement location="${resources.dir}"/>
<pathelement location="${classes.dir}"/>
</path>
2009-05-31 17:23:49 +00:00
<!-- CLEAN -->
<target name="clean" description="Removes all build artifacts">
2009-05-31 17:23:49 +00:00
<delete dir="${build.dir}"/>
<delete dir="${tmp.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
<!-- 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" includeantruntime="false" source="1.8" target="1.8"/>
2009-05-31 17:23:49 +00:00
</target>
<!-- Executible Eclipse-Jar-In-Jar style JAR -->
<target name="jar" depends="build" description="Create the OpenRocket Core">
<mkdir dir="${jar.dir}" />
<jar destfile="${jar.file}" basedir="${dist.dir}">
<!-- Include, in the root of the JAR, the resources needed by OR -->
<fileset dir="${src.dir}/" includes="META-INF/,logback.xml" />
<fileset dir="${resources.dir}/" />
<!-- Include metafiles about OR -->
<fileset dir="${basedir}" includes="LICENSE.TXT README.TXT ChangeLog ReleaseNotes fileformat.txt" />
</jar>
</target>
<target name="serialize-motors" depends="build" description="Preprocess the motor files into serialized form">
<java classname="net.sf.openrocket.thrustcurve.SerializeThrustcurveMotors"
fork="true"
classpathref="run-classpath"
failonerror="true">
<arg value="${resources-src.dir}/datafiles/thrustcurves/"/>
<arg value="${resources.dir}/datafiles/thrustcurves/thrustcurves.ser"/>
</java>
</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}"/>
<javac debug="true" srcdir="${src-test.dir}" destdir="${build-test.dir}" classpathref="test-classpath" includeantruntime="false"/>
2009-09-01 15:25:04 +00:00
<echo>Running unit tests</echo>
<mkdir dir="${tmp.dir}/rawtestoutput"/>
<junit fork="yes" forkmode="once" printsummary="false" failureproperty="junit.failure" dir="${basedir}">
2009-09-26 17:06:37 +00:00
<classpath>
<path refid="test-classpath"/>
<path location="${basedir}"/>
</classpath>
<batchtest todir="${tmp.dir}/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"/>
<formatter type="plain" usefile="false" />
2009-09-01 15:25:04 +00:00
</batchtest>
</junit>
<junitreport todir="${tmp.dir}">
<fileset dir="${tmp.dir}/rawtestoutput"/>
<report todir="${tmp.dir}/test-reports"/>
2009-09-01 15:25:04 +00:00
</junitreport>
<fail if="junit.failure" message="Unit test(s) failed. See report in ${tmp.dir}/test-reports/index.html"/>
2009-10-10 13:13:32 +00:00
<echo>
Unit tests passed successfully.
</echo>
2009-09-01 15:25:04 +00:00
</target>
<!-- Unit test (show errors in output stream instead of junit report) -->
<target name="unittest-no-junit-report" description="Execute unit tests, show report to output stream" depends="build">
<echo>Building unit tests</echo>
<mkdir dir="${build-test.dir}"/>
<javac debug="true" srcdir="${src-test.dir}" destdir="${build-test.dir}" classpathref="test-classpath"/>
<echo>Running unit tests</echo>
<mkdir dir="${tmp.dir}/rawtestoutput"/>
<junit fork="yes" forkmode="once" printsummary="false" failureproperty="junit.failure">
<classpath>
<path refid="test-classpath"/>
<path location="${basedir}"/>
</classpath>
<batchtest todir="${tmp.dir}/rawtestoutput">
<fileset dir="${build-test.dir}">
<include name="**/Test*.class" />
<include name="**/*Test.class" />
<exclude name="**/*$*.class" />
<exclude name="Test.class" />
</fileset>
<!-- <formatter type="xml"/> -->
<formatter type="plain" usefile="false" />
</batchtest>
<jvmarg value="-Dlogback.configurationFile=config/logback-stdout-level-error.xml"/>
</junit>
<fail if="junit.failure" message="Unit test(s) failed. See output above for failures."/>
<echo>
Unit tests passed successfully.
</echo>
</target>
2009-09-01 15:25:04 +00:00
</project>