forked from appsquickly/XcodeEditor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
177 lines (153 loc) · 6.87 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<?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">
<map from='${source.main.dir}' to='"${source.main.dir}"' />
</pathconvert>
<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>