turtle/build/build.xml
mat007 086a42e432 Added thread-safety
git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@730 860be788-9bd5-4423-9f1e-828f051e677b
2014-05-20 05:56:27 +00:00

262 lines
11 KiB
XML

<project name="turtle" default="all">
<property environment="env"/>
<import file="${env.PONEY_HOME}/poney.xml"/>
<property name="boost.root" value="${env.BOOST_ROOT}"/>
<property name="boost.dir" value="${out.dir}/../boost"/>
<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"/>
<compilerarg value="-Wno-strict-aliasing" location="mid" if="is-gcc"/>
<compilerarg value="/wd4505" if="is-msvc"/>
</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_no_decltype">
<defineset define="MOCK_NO_DECLTYPE"/>
</build-turtle-test>
<build-turtle-test name="turtle_no_variadic_macros">
<defineset define="MOCK_NO_VARIADIC_MACROS"/>
</build-turtle-test>
<build-turtle-test name="turtle_thread_safe">
<defineset define="MOCK_THREAD_SAFE"/>
</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" excludes="**/*_iterate.hpp,**/*_template.hpp"/>
<check name="turtle"/>
</target>
<target name="export" description="export distribution">
<sync todir="${dist.dir}/include">
<fileset dir="${libraries.dir}" includes="turtle/**"/>
</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/**"/>
</zip>
<tar destfile="${dist.dir}/${ant.project.name}.tar.bz2" compression="bzip2">
<fileset dir="${dist.dir}" includes="include/**"/>
</tar>
</target>
<condition property="b2" value="b2.exe" else="b2">
<os family="windows"/>
</condition>
<presetdef name="b2">
<exec taskname="b2" failonerror="true" executable="${boost.root}/${b2}">
<arg value="-q"/>
</exec>
</presetdef>
<target name="boost.generate" description="generate boost.mock into ${boost.dir}">
<delete dir="${boost.dir}/boost/mock"/>
<delete dir="${boost.dir}/libs/mock"/>
<copy todir="${boost.dir}/boost/mock">
<fileset dir="${libraries.dir}/turtle" includes="**"/>
</copy>
<copy todir="${boost.dir}/libs/mock/doc">
<fileset dir="${boost.root}/tools/boostbook" includes="xsl/**,dtd/**"/>
</copy>
<copy todir="${boost.dir}/libs/mock/doc/html">
<fileset dir="${boost.root}/doc/src" includes="**/*.css,**/**.png"/>
<fileset dir="boost/doc" includes="images/*.png"/>
</copy>
<copy todir="${boost.dir}/libs/mock" overwrite="true">
<fileset dir="${tests.dir}" includes="test/**"/>
<fileset dir="boost" includes="test/**,doc/**,index.html"/>
</copy>
<copy todir="${boost.dir}">
<fileset dir="boost" includes="LICENSE_1_0.txt,Jamroot.jam,Jamfile.v2"/>
</copy>
</target>
<target name="boost.convert" description="convert boost.mock in ${boost.dir}">
<replaceregexp match="MOCK" replace="BOOST_MOCK" flags="g">
<fileset dir="${boost.dir}/boost/mock" includes="**/*.hpp"/>
<fileset dir="${boost.dir}/libs/mock" includes="**/*.cpp,**/*.hpp,**/*.qbk"/>
</replaceregexp>
<replaceregexp match="BOOST_MOCK_BOOST_MOCK" replace="BOOST_MOCK" flags="g">
<fileset dir="${boost.dir}/boost/mock" includes="**/*.hpp"/>
<fileset dir="${boost.dir}/libs/mock" includes="**/*.cpp,**/*.hpp,**/*.qbk"/>
</replaceregexp>
<replaceregexp match='"([^"]+\.hpp)"' replace="&lt;boost/mock/\1&gt;" flags="g">
<fileset dir="${boost.dir}/boost/mock" includes="**/*.hpp" excludes="**/detail/*.hpp"/>
</replaceregexp>
<replaceregexp match='"\.\./([^"]+\.hpp)"' replace="&lt;boost/mock/\1&gt;" flags="g">
<fileset dir="${boost.dir}/boost/mock" includes="**/*.hpp"/>
</replaceregexp>
<replaceregexp match='"([^"]+\.hpp)"' replace="&lt;boost/mock/detail/\1&gt;" flags="g">
<fileset dir="${boost.dir}/boost/mock" includes="**/detail/*.hpp"/>
</replaceregexp>
<replaceregexp match="&lt;turtle/([^&gt;]+)" replace="&lt;boost/mock/\1" flags="g">
<fileset dir="${boost.dir}/boost/mock" includes="**/*.hpp"/>
<fileset dir="${boost.dir}/libs/mock" includes="**/*.cpp,**/*.hpp,**/*.qbk"/>
</replaceregexp>
<replaceregexp match="(namespace mock)" replace="namespace boost${line.separator}{${line.separator}\1" flags="g">
<fileset dir="${boost.dir}/boost/mock" includes="**/*.hpp"/>
<fileset dir="${boost.dir}/libs/mock" includes="**/*.cpp,**/*.hpp,**/*.qbk"/>
</replaceregexp>
<replaceregexp match="} // mock" replace="}${line.separator}}" flags="g">
<fileset dir="${boost.dir}/boost/mock" includes="**/*.hpp"/>
<fileset dir="${boost.dir}/libs/mock" includes="**/*.cpp,**/*.hpp"/>
</replaceregexp>
<replaceregexp match=" mock::" replace=" boost::mock::" flags="g">
<fileset dir="${boost.dir}/boost/mock" includes="**/*.hpp"/>
<fileset dir="${boost.dir}/libs/mock" includes="**/*.cpp,**/*.hpp,**/*.qbk"/>
</replaceregexp>
<replaceregexp match="^mock::" replace="boost::mock::" flags="m">
<fileset dir="${boost.dir}/boost/mock" includes="**/*.hpp"/>
<fileset dir="${boost.dir}/libs/mock" includes="**/*.cpp,**/*.hpp,**/*.qbk"/>
</replaceregexp>
<replaceregexp match="http://turtle.sourceforge.net" replace="Boost.Mock" flags="g">
<fileset dir="${boost.dir}/boost/mock" includes="**/*.hpp"/>
<fileset dir="${boost.dir}/libs/mock" includes="**/*.cpp,**/*.hpp"/>
</replaceregexp>
<replaceregexp match="reference.helpers." replace="reference.helpers.boost_" flags="g">
<fileset dir="${boost.dir}/libs/mock" includes="**/*.qbk"/>
</replaceregexp>
<replaceregexp match="turtle." replace="boost_mock." flags="g">
<fileset dir="${boost.dir}/libs/mock" includes="**/*.qbk"/>
</replaceregexp>
<replaceregexp match="Turtle" replace="Boost.Mock" flags="g">
<fileset dir="${boost.dir}/libs/mock" includes="**/*.qbk"/>
</replaceregexp>
<replaceregexp match="\[include changelog.qbk\]" replace="" flags="g">
<fileset dir="${boost.dir}/libs/mock" includes="**/mock.qbk"/>
</replaceregexp>
<copy todir="${boost.dir}/libs/mock/doc" overwrite="true">
<fileset dir="${boost.root}/tools/boostbook" includes="xsl/navbar.xsl"/>
</copy>
</target>
<target name="boost.test" description="run boost.mock tests in ${boost.dir}">
<b2 dir="${boost.dir}/libs/mock/test"/>
</target>
<target name="boost.doc" description="generate boost.mock documentation in ${boost.dir}">
<b2 dir="${boost.dir}/libs/mock/doc"/>
</target>
<target name="boost.package" description="package boost.mock">
<zip destfile="${out.dir}/boost-mock.zip">
<fileset dir="${boost.dir}" includes="boost/mock/**"/>
<fileset dir="${boost.dir}" includes="libs/mock/**" excludes="**/bin/**"/>
<fileset dir="${boost.dir}" includes="LICENSE_1_0.txt,Jamroot.jam,Jamfile.v2"/>
</zip>
</target>
<target name="documentation" depends="boost.generate,boost.doc" description="generate documentation"/>
<target name="boost" depends="boost.generate,boost.convert,boost.test,boost.doc" description="convert to boost with documentation and tests"/>
<target name="release" depends="documentation,package" description="produce release packages">
<fail unless="version" message="missing version property"/>
<copy file="version.hpp" tofile="${out.dir}/version.hpp">
<filterset>
<filter token="MOCK_VERSION" value="${version}"/>
</filterset>
</copy>
<zip destfile="${dist.dir}/${ant.project.name}-${version}.zip">
<fileset dir="${dist.dir}" includes="include/**"/>
<zipfileset dir="${boost.dir}/libs/mock/doc/html" prefix="doc"/>
<zipfileset dir="${out.dir}" includes="version.hpp" prefix="include/turtle"/>
</zip>
<tar destfile="${dist.dir}/${ant.project.name}-${version}.tar.bz2" compression="bzip2">
<fileset dir="${dist.dir}" includes="include/**"/>
<zipfileset dir="${boost.dir}/libs/mock/doc/html" prefix="doc"/>
<zipfileset dir="${out.dir}" includes="version.hpp" prefix="include/turtle"/>
</tar>
</target>
<target name="all" depends="configure,test,bench,reports,export,package" description="configure, build and run tests and benchmark, export and package distribution"/>
</project>