Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
176 lines (151 sloc) 6.77 KB
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="${module.name}" default="build"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="antlib:org.apache.ivy.ant ">
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CONFIGURATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<property file="build-configuration.properties"/>
<path id="headers">
<fileset dir="${source.main.dir}">
<include name="**/*.h"/>
</fileset>
</path>
<path id="classes">
<fileset dir="${source.main.dir}">
<include name="**/*.m"/>
<exclude name="**/main.m"/>
</fileset>
</path>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PUBLIC TARGETS (can depend on other targets) ~~~~~~~~~~~~~~~~~~~~~~~~ -->
<target name="build" depends="
--make.dirs,
--clean,
--make.dirs,
--unit.tests.build,
--assemble.coverage.data,
--coverage.report,
--api.report,
--framework.build"/>
<target name="clean" depends="--clean"/>
<target name="jenkins" depends="
build,
--publish.site"/>
<target name="fast">
<property name="fast" value="yes"/>
</target>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ END PUBLIC TARGETS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PRIVATE TARGETS (MUST NOT depend on other targets!) ~~~~~~~~~~~~~~~~~~~ -->
<target name="--make.dirs">
<mkdir dir="${target.dir}"/>
<mkdir dir="${temp.dir}"/>
<mkdir dir="${temp.dir}/coverage-data"/>
<mkdir dir="${reports.dir}"/>
<mkdir dir="${reports.dir}/tests"/>
</target>
<target name="--clean" unless="fast">
<delete dir="${target.dir}"/>
<delete verbose="yes" failonerror="no">
<fileset dir="/tmp" includes="**/*.pbxproj,**/*.m,**/*.h"/>
</delete>
</target>
<target name="--unit.tests.build">
<exec executable="xcodebuild" failonerror="true">
<arg line="-target ${tests.target.name}"/>
</exec>
<fail if="tests.failed" message="Tests failed. Report is at ${tests.report}"/>
<fail if="tests.exception" message="Tests failed. Report is at ${tests.report}"/>
</target>
<target name="--framework.build">
<exec executable="xcodebuild" failonerror="true">
<arg line="-target ${application.target.name}"/>
</exec>
</target>
<target name="--assemble.coverage.data">
<mkdir dir="${temp.dir}/coverage-data"/>
<pathconvert pathsep=", " property="gcno.list" refid="classes">
<mapper>
<chainedmapper>
<flattenmapper/>
<globmapper from="*.m" to="**/*.gcno"/>
</chainedmapper>
</mapper>
</pathconvert>
<echo message="Coverage info files: ${gcno.list}"/>
<copy todir="${temp.dir}/coverage-data" flatten="true">
<fileset dir="${target.dir}" includes="${gcno.list}"/>
</copy>
<pathconvert pathsep=", " property="gcda.list" refid="classes">
<mapper>
<chainedmapper>
<flattenmapper/>
<globmapper from="*.m" to="**/*.gcda"/>
</chainedmapper>
</mapper>
</pathconvert>
<echo message="Coverage data files: ${gcda.list}"/>
<copy todir="${temp.dir}/coverage-data" flatten="true">
<fileset dir="${target.dir}" includes="${gcda.list}"/>
</copy>
</target>
<target name="--coverage.report">
<property name="coverage.reports.dir" value="${reports.dir}/coverage"/>
<mkdir dir="${coverage.reports.dir}"/>
<echo file="${temp.dir}/geninfo.sh">
#!/bin/sh
geninfo ${temp.dir}/coverage-data/*.gcda --no-recursion -o ${temp.dir}/coverage-temp.info
#Remove symbols we're not interested in.
lcov -r ${temp.dir}/coverage-temp.info _string.h > ${temp.dir}/coverage.info
</echo>
<chmod perm="+x" file="${temp.dir}/geninfo.sh"/>
<exec executable="${temp.dir}/geninfo.sh" failonerror="true" failifexecutionfails="true"/>
<echo file="${temp.dir}/genhtml.sh">
#!/bin/sh
genhtml -p ${source.main.dir} --no-function-coverage --no-branch-coverage -o ${coverage.reports.dir} \
--prefix ${basedir} ${temp.dir}/coverage.info
</echo>
<chmod perm="+x" file="${temp.dir}/genhtml.sh"/>
<exec executable="${temp.dir}/genhtml.sh" failonerror="true" failifexecutionfails="true"/>
</target>
<target name="--api.report">
<mkdir dir="${reports.dir}/api"/>
<mkdir dir="${user.home}/Library/Developer/Shared"/>
<mkdir dir="${user.home}/Library/Developer/Shared/Documentation"/>
<mkdir dir="${user.home}/Library/Developer/Shared/Documentation/Docsets"/>
<!-- In case it's turned up somehow, despite cleaning up. -->
<delete file="${basedir}/docset-installed.txt"/>
<pathconvert pathsep=" " property="doc.files.list" refid="headers"/>
<echo message="Documenting: ${doc.files.list}"/>
<exec executable="appledoc">
<arg line="--project-name=${module.name}"/>
<arg line="--project-company=${module.company}"/>
<arg line="--company-id=${module.company}"/>
<arg line="-h --keep-undocumented-objects --keep-undocumented-members"/>
<arg line="${doc.files.list}"/>
</exec>
<loadfile srcfile="${basedir}/docset-installed.txt" property="docset.installed"/>
<fail unless="docset.installed" message="Error creating documentation"/>
<!-- Don't leave it lying around -->
<delete file="${basedir}/docset-installed.txt"/>
<property name="docs.dir" value="${user.home}/Library/Developer/Shared/Documentation/Docsets"/>
<copy todir="${reports.dir}/api">
<fileset dir="${docs.dir}/${module.company}.${module.name}.docset/Contents/Resources/Documents"/>
</copy>
</target>
<target name="--publish.site">
<echo file="${temp.dir}/publish-site.sh">
#!/bin/sh
cd ${basedir}
git checkout gh-pages
git pull
rm -fr ./coverage
cp -fr ${reports.dir}/coverage/ ./coverage
git add ./coverage
rm -fr ./api
cp -fr ${reports.dir}/api ./api
git add api
git commit -a -m "publish reports to gh-pages"
git push -u origin gh-pages
git checkout master
</echo>
<chmod perm="+x" file="${temp.dir}/publish-site.sh"/>
<exec executable="${temp.dir}/publish-site.sh" failonerror="true" failifexecutionfails="true"/>
</target>
</project>
Jump to Line
Something went wrong with that request. Please try again.