forked from appsquickly/Typhoon-Swift-Example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
144 lines (122 loc) · 5.69 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="${module.name}" default="build"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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"/>
</fileset>
</path>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PUBLIC TARGETS (can depend on other targets) ~~~~~~~~~~~~~~~~~~~~~~~~ -->
<target name="build" depends="
--init,
--clean,
--run.tests,
--assemble.coverage.data,
--coverage.report"/>
<target name="fast">
<property name="fast" value="yes"/>
</target>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ END PUBLIC TARGETS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PRIVATE TARGETS (MUST NOT depend on other targets!) ~~~~~~~~~~~~~~~~~~~ -->
<target name="--init">
<exec executable="xcode-select" outputproperty="xcode.path">
<arg line="-print-path"/>
</exec>
<property name="xcode.path.message">
Xcode path is not set. Please use run xcode-select from the cmd-line, to specify location of Xcode tools.
${line.separator}Example: sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
</property>
<fail unless="xcode.path"
message="${xcode.path.message}"/>
<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">
<mkdir dir="${target.dir}"/>
<mkdir dir="${temp.dir}"/>
<fail unless="xcode.path" message="Xcode path is not set"/>
<echo message="Based on xcode-select, simulator path is: ${xcode.path}/${simulator.path}"/>
<echo file="${temp.dir}/quit-simulator.script">
tell application "${xcode.path}/${simulator.path}" to quit
</echo>
<exec executable="osascript" failonerror="true" failifexecutionfails="true">
<arg line="${temp.dir}/quit-simulator.script"/>
</exec>
<delete dir="${target.dir}"/>
</target>
<target name="--simulator.launch">
<echo file="${temp.dir}/fg-simulator.script">
tell application "${xcode.path}/${simulator.path}" to launch
tell application "${xcode.path}/${simulator.path}" to activate
</echo>
<echo message="Launching the iPhone simulator for unit tests. . "/>
<echo message="Leave it running in the foreground, or things won't work."/>
<exec executable="osascript" failonerror="true" failifexecutionfails="true">
<arg line="${temp.dir}/fg-simulator.script"/>
</exec>
</target>
<target name="--run.tests">
<!-- Running from cmd-line requires this docs dir to be created -->
<mkdir dir="${user.home}/Library/Application Support/iPhone Simulator/Documents"/>
<exec executable="${xcodebuild}" failonerror="true">
<arg line="-sdk iphonesimulator${module.sdk.version} -target ${tests.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/*.gcno --no-recursion --output-filename \
${temp.dir}/${module.name}-temp.info
#Remove symbols we're not interested in.
lcov -r ${temp.dir}/${module.name}-temp.info UIGeometry.h CGGeometry.h > ${temp.dir}/${module.name}.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 --no-function-coverage --no-branch-coverage -o ${coverage.reports.dir} \
--prefix ${source.main.dir} ${temp.dir}/${module.name}.info
</echo>
<chmod perm="+x" file="${temp.dir}/genhtml.sh"/>
<exec executable="${temp.dir}/genhtml.sh" failonerror="true" failifexecutionfails="true"/>
</target>
</project>