openrocket/core/build.xml
Kevin Ruland b415238a02 Changed Motor to support additional fields case info, prop info, and
availability flag provided by Thrustcurve.org.  Change serialization
process to pull current files from Thrustcurve.org using the xml api,
use the corrected data for diameter and length, and use a consistent
motor designation.  Added fields to the Motor chooser - case info is a
column in the listing (replacing MotorType), the other info is in the
motor details tab.  Added toggle to hide motors which are OOP.
2015-12-07 22:27:05 -06:00

154 lines
5.9 KiB
XML

<project name="OpenRocket-Core" basedir=".">
<property file="resources/build.properties" />
<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 -->
<!-- Distribution directory, from which stuff is jar'ed -->
<property name="dist.dir" value="${build.dir}/dist"/>
<property name="dist-test.dir" value="${build.dir}/dist-test"/>
<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="pkgname" value="${ant.project.name}-${build.version}"/>
<property name="jar.file" value="${jar.dir}/${ant.project.name}.jar"/>
<!-- Classpath definitions -->
<path id="classpath">
<fileset dir="${lib.dir}" includes="**/*.jar"/>
</path>
<path id="test-classpath">
<path refid="classpath"/>
<pathelement location="${resources.dir}"/>
<pathelement location="${build-test.dir}"/>
<pathelement location="${classes.dir}"/>
<pathelement location="${src-test.dir}"/>
<fileset dir="${libtest.dir}/" includes="*.jar"/>
</path>
<path id="run-classpath">
<path refid="classpath"/>
<pathelement location="${resources.dir}"/>
<pathelement location="${classes.dir}"/>
</path>
<!-- CLEAN -->
<target name="clean" description="Removes all build artifacts">
<delete dir="${build.dir}"/>
<delete dir="${tmp.dir}/"/>
</target>
<!-- BUILD -->
<target name="build">
<mkdir dir="${classes.dir}"/>
<echo level="info">Compiling main classes</echo>
<javac debug="true" srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath" includeantruntime="false" source="1.7" target="1.7"/>
</target>
<!-- Executible Eclipse-Jar-In-Jar style JAR -->
<target name="jar" depends="build,serialize-motors" 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>
<!-- 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"/>
<echo>Running unit tests</echo>
<mkdir dir="${tmp.dir}/rawtestoutput"/>
<junit fork="yes" forkmode="once" printsummary="false" failureproperty="junit.failure" dir="${basedir}">
<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>
</junit>
<junitreport todir="${tmp.dir}">
<fileset dir="${tmp.dir}/rawtestoutput"/>
<report todir="${tmp.dir}/test-reports"/>
</junitreport>
<fail if="junit.failure" message="Unit test(s) failed. See report in ${tmp.dir}/test-reports/index.html"/>
<echo>
Unit tests passed successfully.
</echo>
</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>
</project>