forked from richardszalay/raix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
206 lines (205 loc) · 9.55 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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<?xml version="1.0"?>
<!-- Build script converted from the Robotlegs build script. Many thanks to the RL team -->
<project name="raix" basedir="." default="test">
<!-- set up a prefix for all environment variables -->
<property environment="env."/>
<!-- load user properties to override defaults -->
<property file="user.properties"/>
<!-- System environment must contain FLEX_HOME variable that points to Flex SDK -->
<property name="FLEX_HOME" location="${env.FLEX_HOME}"/>
<!-- identify properties file -->
<property file="build.properties"/>
<!-- Set up FlexUnit Ant tasks -->
<taskdef resource="flexUnitTasks.tasks" classpath="${build.lib.loc}/flexUnitTasks.jar"/>
<target name="usage">
<echo message=""/>
<echo message="raix Build Usage"/>
<echo message="-----------------------------------"/>
<echo message=""/>
<echo message="Available targets are:"/>
<echo message=""/>
<echo message="test --> Build raix SWC and run unit tests"/>
<echo message="asdoc --> Build raix SWC, test, and generate asdocs"/>
<echo message="package --> Build raix SWC, test, and create release zip"/>
<echo message="compile --> Build raix SWC"/>
<echo message="clean --> Remove all folders created by build script"/>
<echo message="init --> Clean and create build folders"/>
<echo message=""/>
</target>
<!-- Clean Build and Report files -->
<target name="clean">
<!-- Remove all directories created during the build process -->
<echo>[clean] Removing Build and Report directories</echo>
<delete includeemptydirs="true" failonerror="false">
<fileset dir="${report.loc}" defaultexcludes="false">
<include name="**/*"/>
</fileset>
<fileset dir="${dist.loc}" defaultexcludes="false">
<include name="**/*"/>
</fileset>
</delete>
<echo>[clean] Build 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}"/>
<echo>[init] Bin and Report directories created</echo>
</target>
<!-- Compile Release SWC -->
<target name="compile" depends="init">
<echo>[compile] Compiling release SWC</echo>
<echo>[compile] Using Flex SDK at: ${FLEX_HOME}</echo>
<java jar="${FLEX_HOME}/lib/compc.jar" dir="${FLEX_HOME}/frameworks" fork="true" failonerror="true">
<!-- Build our SWC with a versioned name. -->
<arg value="-output=${bin.loc}/${project.name.versioned}.swc"/>
<!-- We want all the org package classes in the SWC being built. -->
<arg value="-external-library-path+=${FLEX_HOME}/frameworks/libs/flex.swc" />
<arg value="-external-library-path+=${FLEX_HOME}/frameworks/libs/framework.swc" />
<arg value="-external-library-path+=${FLEX_HOME}/frameworks/libs/rpc.swc" />
<arg value="-external-library-path+=${FLEX_HOME}/frameworks/libs/utilities.swc" />
<arg value="-source-path=${main.src.loc}"/>
<arg value="-include-sources=${main.src.loc}/raix"/>
<arg value="-include-sources+=${main.src.loc}/raix/reactive/scheduling"/>
<arg value="-include-sources+=${main.src.loc}/raix/reactive/flex"/>
<arg value="-include-sources+=${main.src.loc}/raix/reactive/impl"/>
<arg value="-include-sources+=${main.src.loc}/raix/reactive/subjects"/>
<arg value="-include-sources+=${main.src.loc}/raix/interactive"/>
<!-- Boolean mosh pit! -->
<arg value="-incremental=true"/>
<arg value="-static-link-runtime-shared-libraries=true"/>
<arg value="-verbose-stacktraces=true"/>
<arg value="-headless-server=true"/>
<!-- Conditional compilation -->
<arg value="-define+=CONFIG::FLEX,true"/>
</java>
<echo>[compile] Release SWC ${project.name.versioned}.swc created successfully</echo>
</target>
<target name="copy-test-files">
<copy todir="${bin.loc}" includeEmptyDirs="false">
<fileset dir="${test.src.loc}">
<exclude name="**/*.as" />
<exclude name="**/*.mxml" />
</fileset>
</copy>
</target>
<!-- Run Unit Tests -->
<target name="test" depends="compile,copy-test-files">
<echo>[test] Running Unit Tests</echo>
<!-- Compile TestRunner.mxml as a SWF -->
<java jar="${FLEX_HOME}/lib/mxmlc.jar" dir="${FLEX_HOME}/frameworks" fork="true" failonerror="true" maxmemory="${compile.maxmemory}">
<arg value="${test.src.loc}/tests.mxml"/>
<arg value="-source-path=${test.src.loc}"/>
<arg value="-includes+=asmock.integration.flexunit.ASMockClassRunner"/>
<!-- Flash those sweet legs. Blink and you'll miss 'em. -->
<arg value="-output=${bin.loc}/TestRunner.swf"/>
<arg value="-default-size=200,200"/>
<arg value="-default-background-color=0x000000"/>
<!-- Include classes from SWCs in this folder, but only the ones we use. -->
<arg value="-library-path+=${test.lib.loc}"/>
<arg value="-library-path+=${bin.loc}/${project.name.versioned}.swc"/>
<!-- So true. -->
<arg value="-incremental=true"/>
<arg value="-verbose-stacktraces=true"/>
<arg value="-headless-server=true"/>
<arg value="-use-network=true"/>
<!-- Conditional compilation -->
<arg value="-define+=CONFIG::AUTOMATED,true"/>
</java>
<!-- Execute TestRunner.swf as FlexUnit tests and publish reports -->
<flexunit swf="bin/TestRunner.swf" toDir="${report.loc}" haltonfailure="false" verbose="true"
localTrusted="${test.localTrusted}" failureProperty="test.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>
<fail message="Unit Tests failed" if="${test.failed}" />
<echo>[test] Finished running Unit Tests</echo>
</target>
<!-- Build Documentation -->
<target name="asdoc" depends="test">
<echo>[asdoc] Generating ASDOC documentation</echo>
<tstamp>
<format property="docgen.time" pattern="MM/dd/yyyy hh:mm aa" unit="hour"/>
</tstamp>
<java jar="${FLEX_4_HOME}/lib/asdoc.jar" dir="${FLEX_4_HOME}/frameworks" fork="true" failonerror="true">
<!--<arg line="-external-library-path ${lib.loc}"/>-->
<arg line="-doc-sources ${main.src.loc}"/>
<arg line="-source-path ${main.src.loc}"/>
<arg line="-output ${doc.loc}"/>
<arg value="-keep-xml=true"/>
<arg value="-templates-path=${doc.config.loc}" />
<arg value="-lenient=true" />
<arg line="-window-title 'raix ${raix.ver.num}'"/>
<arg line="-main-title 'raix ${raix.ver.num}'"/>
<arg line="-footer 'raix - http://github.com/richardszalay/raix - Documentation generated at: ${docgen.time}'"/>
<arg line="-package raix.interactive 'Classes for working with interactive / pull collections'" />
<arg line="-package raix.reactive.flex 'Flex integration classes'"/>
<arg line="-package raix.reactive.subjects 'Subject implementations'"/>
<arg line="-package raix.reactive.scheduling 'Classes that schedule execution for raix classes'"/>
<!-- Conditional compilation -->
<arg value="-define+=CONFIG::FLEX,true"/>
</java>
<echo>[asdoc] ASDOC documentation generated successfully</echo>
</target>
<!-- Package the Build -->
<target name="package" depends="asdoc">
<tstamp>
<format property="touch.time" pattern="MM/dd/yyyy hh:mm aa" unit="hour"/>
</tstamp>
<!-- Assemble -->
<echo>[package] Packaging Release</echo>
<mkdir dir="${dist.loc}"/>
<mkdir dir="${dist.loc}/bin"/>
<mkdir dir="${dist.loc}/src"/>
<copy file="${bin.loc}/${project.name.versioned}.swc" todir="${dist.loc}/bin"/>
<copy todir="${dist.loc}/src/raix">
<fileset dir="${main.src.loc}/raix"/>
</copy>
<copy todir="${dist.loc}/docs">
<fileset dir="${doc.loc}"/>
</copy>
<delete dir="${dist.loc}/docs/tempdita" />
<!-- Add ASDoc xml to swc for Flex Builder Tooltips -->
<zip destfile="${dist.loc}/bin/${project.name.versioned}.swc" update="true">
<zipfileset dir="${doc.loc}/tempdita" prefix="docs">
<include name="*packages.dita*"/>
<include name="*raix.*"/>
</zipfileset>
</zip>
<!-- Copy README -->
<copy file="${template.loc}/README.tmpl" tofile="${dist.loc}/README" overwrite="true">
<filterchain>
<replacetokens>
<token key="date" value="${touch.time}"/>
<token key="raixversion" value="${raix.ver.num}"/>
<token key="releasename" value="${project.name.versioned}"/>
<token key="raixprojectlink" value="${raix.project.link}"/>
<token key="wikilink" value="${raix.wiki.link}"/>
<token key="wikidocslink" value="${raix.wikidocs.link}"/>
<token key="livedocslink" value="${raix.livedocs.link}"/>
<token key="builddocslink" value="${raix.builddocs.link}"/>
</replacetokens>
</filterchain>
</copy>
<!-- Copy LICENSE -->
<copy file="LICENSE" tofile="${dist.loc}/LICENSE" overwrite="true"/>
<!-- Zip It -->
<zip destfile="${dist.loc}/${project.name.versioned}.zip">
<fileset dir="${dist.loc}"/>
</zip>
<copy file="${dist.loc}/bin/${project.name.versioned}.swc"
tofile="${dist.loc}/${project.name.versioned}.swc" overwrite="true" />
<!-- Clean Up -->
<delete file="${dist.loc}/README"/>
<delete file="${dist.loc}/LICENSE"/>
<delete dir="${dist.loc}/bin"/>
<delete dir="${dist.loc}/src"/>
<delete dir="${dist.loc}/docs"/>
<echo>[package] Release packaged successfully</echo>
</target>
</project>