forked from joelhooks/tinytlf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
executable file
·173 lines (148 loc) · 6.48 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
<project name="tinytlf-build" basedir="." default="asdoc">
<property environment="env." />
<!-- identify properties file -->
<property file="build.properties" />
<property name="FLEX_HOME" location="${env.FLEX_HOME}" />
<property name="mxmlc" value="${FLEX_HOME}/bin/mxmlc"/>
<!-- Set up FlexUnit Ant tasks -->
<taskdef resource="flexUnitTasks.tasks" classpath="${lib.loc}/flexUnitTasks.jar" />
<taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}ant/lib/flexTasks.jar" />
<target name="usage">
<echo message="" />
<echo message="${project.name} Build Usage" />
<echo message="-----------------------------------" />
<echo message="" />
<echo message="Main targets are:" />
<echo message="compile --> Build ${project.name} SWC, demos, asdoc, test" />
<echo message="" />
<echo message="Additonal targets are:" />
<echo message="clean --> Remove all folders created by build script" />
<echo message="init --> Clean and create build folders" />
<echo message="asdoc --> Build ${project.name} test and generate asdocs" />
<echo message="test --> Build ${project.name} runs unit tests" />
<echo message="" />
</target>
<!-- Clean Build and Report files -->
<target name="clean">
<!-- Remove all directories created during the build process -->
<echo>[clean] Removing Bin and Report directories</echo>
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${report.loc}" defaultexcludes="false">
<include name="**/*" />
</fileset>
<fileset dir="${report.xml.loc}" defaultexcludes="false">
<include name="**/*" />
</fileset>
<fileset dir="${report.html.loc}" defaultexcludes="false">
<include name="**/*" />
</fileset>
<fileset dir="${bin.loc}" defaultexcludes="false">
<include name="**/*" />
</fileset>
</delete>
<echo>[clean] Bin and Report directories removed</echo>
</target>
<!-- Create directories needed for the build process -->
<target name="init" depends="clean">
<echo>[init] Creating Bin and Report directories</echo>
<mkdir dir="${bin.loc}" />
<mkdir dir="${report.loc}" />
<mkdir dir="${report.xml.loc}" />
<mkdir dir="${report.html.loc}" />
<echo>[init] Bin and Report directories created</echo>
</target>
<!-- Run Unit Tests -->
<target name="test" depends="init">
<echo>[test] Running Unit Tests</echo>
<!-- Compile TestRunner.mxml as a SWF -->
<mkdir dir="${report.loc}" />
<build-flex-swf source="${test.src.loc}" name="TestRunner" file="${project.name}Tests.mxml"/>
<!-- Execute TestRunner.swf as FlexUnit tests and publish reports -->
<flexunit swf="bin/TestRunner.swf" toDir="${report.loc}" haltonfailure="false" verbose="true" localTrusted="true" failureproperty="flexunit.failed" />
<!-- Generate readable JUnit-style reports -->
<junitreport todir="${report.loc}">
<fileset dir="${report.loc}">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${report.loc}/html" />
</junitreport>
<echo>[test] Finished running Unit Tests</echo>
</target>
<!-- Build Documentation -->
<target name="asdoc" depends="compile">
<echo>[asdoc] Generating ASDOC documentation</echo>
<java jar="${FLEX_HOME}/lib/asdoc.jar" dir="${FLEX_HOME}/frameworks" fork="true" failonerror="true">
<arg value="+flexlib=${FLEX_HOME}/frameworks"/>
<arg value="-load-config+=${basedir}/config.xml" />
<!-- Include classes from SWCs in this folder, but only the ones we use. -->
<arg value="-library-path+=${lib.loc}" />
<arg value="-external-library-path+=${bin.loc}" />
<arg line="-doc-sources ${utils.src.loc} ${core.src.loc}" />
<arg line="-source-path ${utils.src.loc} ${core.src.loc}" />
<arg line="-output ${doc.loc}" />
<arg line="-window-title '${project.name.versioned}'" />
<arg line="-main-title '${project.name.versioned}'" />
<arg line="-footer '${project.name.versioned}'" />
</java>
<echo>[asdoc] ASDOC documentation generated successfully</echo>
</target>
<!-- Compile Release SWC -->
<target name="compile" depends="test">
<echo>[compile] Compiling release SWC</echo>
<echo>[compile] Using Flex SDK at: ${FLEX_HOME}</echo>
<build-swc source="${utils.src.loc}" version="${project.name.versioned}" project="fte-utils"/>
<build-swc source="${core.src.loc}" version="${project.name.versioned}" project="core" />
</target>
<macrodef name="build-swc">
<attribute name="source" />
<attribute name="project" />
<attribute name="version" />
<sequential>
<java jar="${FLEX_HOME}/lib/compc.jar" dir="${FLEX_HOME}/frameworks" fork="true" failonerror="true">
<arg value="+flexlib=${FLEX_HOME}/frameworks"/>
<arg value="-output=${bin.loc}/@{version}_@{project}.swc" />
<arg value="-load-config+=${basedir}/config.xml" />
<arg value="-include-sources=@{source}/" />
<arg line="-source-path @{source}" />
<arg value="-external-library-path+=${lib.loc}" />
<arg value="-external-library-path+=${bin.loc}" />
<arg value="-link-report=${report.xml.loc}/@{version}_@{project}_report.xml" />
<arg value="-verbose-stacktraces=true" />
<arg value="-headless-server=true" />
</java>
<xslt
in="${report.xml.loc}/@{version}_@{project}_report.xml"
out="${report.html.loc}/@{version}_@{project}_report.html"
style="${lib.loc}/link-report.xsl"
/>
<echo>[compile] Release SWC @{project}.swc created successfully</echo>
<echo></echo>
</sequential>
</macrodef>
<macrodef name="build-flex-swf">
<attribute name="source" />
<attribute name="name" />
<attribute name="file" />
<sequential>
<java jar="${FLEX_HOME}/lib/mxmlc.jar" dir="${FLEX_HOME}/frameworks" fork="true" failonerror="true">
<arg value="+flexlib=${FLEX_HOME}/frameworks"/>
<arg value="-load-config+=${basedir}/config.xml" />
<arg value="@{source}/@{file}" />
<arg value="-source-path=${utils.src.loc}" />
<arg value="-source-path=${core.src.loc}" />
<arg value="-output=${bin.loc}/@{name}.swf" />
<arg value="-default-size=148,148" />
<arg value="-default-background-color=0x320401" />
<arg value="-show-deprecation-warnings=true" />
<!-- Include classes from SWCs in this folder, but only the ones we use. -->
<arg value="-library-path+=${lib.loc}" />
<!-- So true. -->
<arg value="-incremental=true" />
<arg value="-verbose-stacktraces=true" />
<arg value="-headless-server=true" />
</java>
<echo>[compile] @{name}.swf created successfully</echo>
<echo></echo>
</sequential>
</macrodef>
</project>