turtle/build/build.xml
mat007 946d1f6874 Changed project layout
git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@464 860be788-9bd5-4423-9f1e-828f051e677b
2012-06-15 22:15:54 +00:00

163 lines
6.3 KiB
XML

<project name="turtle" default="all">
<property environment="env"/>
<import file="${env.PONEY_HOME}/poney.xml"/>
<target name="clean" description="clean intermediate build artifacts">
<delete dir="${out.dir}"/>
</target>
<target name="configure" description="update external libraries">
<update name="boost"/>
</target>
<presetdef name="build-turtle-test">
<build-test input="test" depends="boost" mode="all" excludes="bench_*,fail_*">
<compilerarg value="-Wno-uninitialized" location="mid" if="is-cygwin"/>
</build-test>
</presetdef>
<target name="test" description="run unit tests">
<delete dir="${tests.dir}/test/bin"/>
<build-turtle-test name="turtle"/>
<build-turtle-test name="turtle_max_args">
<defineset>
<define name="MOCK_MAX_ARGS" value="21"/>
</defineset>
</build-turtle-test>
<build-turtle-test name="turtle_use_conversions">
<defineset define="MOCK_USE_CONVERSIONS"/>
</build-turtle-test>
<build-turtle-test name="turtle_use_boost_test">
<defineset define="MOCK_USE_BOOST_TEST"/>
</build-turtle-test>
</target>
<target name="analyse" description="run errors analyser">
<quiet>
<mkdir dir="${reports.dir}"/>
<delete file="${reports.dir}/errors-${platform}.log"/>
<touch file="${reports.dir}/errors-${platform}.log"/>
</quiet>
<for param="file">
<fileset dir="${tests.dir}/test" includes="fail*.cpp"/>
<sequential>
<record name="${reports.dir}/errors-${platform}.log" action="start" append="true"/>
<ant target="-analyse">
<property name="file" value="@{file}"/>
</ant>
<record name="${reports.dir}/errors-${platform}.log" action="stop"/>
</sequential>
</for>
</target>
<target name="-analyse">
<trycatch>
<try>
<echo>${file}</echo>
<compile name="errors" input="${tests.dir}/errors_test" outdir="${out.dir}/errors_test" excludes="**">
<includepath path="${libraries.dir}"/>
<fileset file="${file}"/>
</compile>
</try>
</trycatch>
</target>
<target name="bench" description="run compilation benchmark">
<mkdir dir="${reports.dir}"/>
<quiet>
<delete file="${reports.dir}/benchmark-${platform}.log"/>
<touch file="${reports.dir}/benchmark-${platform}.log"/>
<delete dir="${out.dir}/bench_test"/>
<delete dir="${tests.dir}/test/bin"/>
</quiet>
<for param="file">
<fileset dir="${tests.dir}/test" includes="bench_*.cpp"/>
<sequential>
<record name="${reports.dir}/benchmark-${platform}.log" action="start" append="true"/>
<ant target="-bench">
<property name="file" value="@{file}"/>
</ant>
<record name="${reports.dir}/benchmark-${platform}.log" action="stop"/>
</sequential>
</for>
</target>
<target name="-bench">
<echo>${file}</echo>
<stopwatch name="bench"/>
<quiet>
<compile name="bench" input="${tests.dir}/test" outdir="${out.dir}/bench_test" excludes="**">
<includepath path="${libraries.dir}"/>
<fileset file="${file}"/>
</compile>
</quiet>
<stopwatch name="bench" action="total"/>
</target>
<target name="reports" description="generate code analysis reports">
<headers name="turtle"/>
<check name="turtle"/>
</target>
<target name="export" description="export distribution">
<sync todir="${dist.dir}/include">
<fileset dir="${libraries.dir}" includes="turtle/**.hpp"/>
</sync>
<info version="svn rev ${svn.revision}" todir="${dist.dir}"/>
</target>
<target name="package" depends="export" description="package distribution">
<mkdir dir="${dist.dir}"/>
<zip destfile="${dist.dir}/${ant.project.name}.zip">
<fileset dir="${dist.dir}" includes="include/**"/>
<fileset dir="${root.dir}" includes="*.txt"/>
</zip>
<tar destfile="${dist.dir}/${ant.project.name}.tar.bz2" compression="bzip2">
<fileset dir="${dist.dir}" includes="include/**"/>
<fileset dir="${root.dir}" includes="*.txt"/>
</tar>
</target>
<property name="boost.dir" value="${out.dir}/../boost"/>
<target name="boost" description="convert to boost">
<delete dir="${boost.dir}"/>
<copy todir="${boost.dir}/boost/mock">
<fileset dir="${libraries.dir}/turtle" includes="**"/>
</copy>
<copy todir="${boost.dir}/libs/mock/test">
<fileset dir="${tests.dir}/test" includes="**"/>
<fileset dir="jam" includes="Jamfile.jam"/>
</copy>
<copy todir="${boost.dir}">
<fileset dir="jam" includes="Jamroot.jam,Jamfile.v2"/>
</copy>
<replaceregexp match="MOCK" replace="BOOST_MOCK" flags="g">
<fileset dir="${boost.dir}" includes="**/*.hpp,**/*.cpp"/>
</replaceregexp>
<replaceregexp match="BOOST_MOCK_BOOST_MOCK" replace="BOOST_MOCK" flags="g">
<fileset dir="${boost.dir}" includes="**/*.hpp,**/*.cpp"/>
</replaceregexp>
<replaceregexp match='"([^"]+)"' replace="&lt;boost/mock/\1&gt;" flags="g">
<fileset dir="${boost.dir}" includes="**/*.hpp,**/*.cpp"/>
</replaceregexp>
<replaceregexp match="&lt;turtle/([^&gt;]+)" replace="&lt;boost/mock/\1" flags="g">
<fileset dir="${boost.dir}" includes="**/*.hpp,**/*.cpp"/>
</replaceregexp>
<replaceregexp match="(namespace mock)" replace="namespace boost${line.separator}{${line.separator}\1" flags="g">
<fileset dir="${boost.dir}" includes="**/*.hpp,**/*.cpp"/>
</replaceregexp>
<replaceregexp match="(}${line.separator}${line.separator}#endif //)" replace="}${line.separator}\1" flags="g">
<fileset dir="${boost.dir}" includes="**/*.hpp,**/*.cpp"/>
</replaceregexp>
<replaceregexp match="(}${line.separator}${line.separator}#define)" replace="}${line.separator}\1" flags="g">
<fileset dir="${boost.dir}" includes="**/*.hpp,**/*.cpp"/>
</replaceregexp>
<replaceregexp match="(mock::)" replace="boost::\1" flags="g">
<fileset dir="${boost.dir}" includes="**/*.hpp,**/*.cpp"/>
</replaceregexp>
</target>
<target name="all" depends="configure,test,bench,reports,export,package" description="configure, build and run tests and benchmark, export and package distribution"/>
</project>