forked from robertpenner/as3-signals
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
180 lines (164 loc) · 7.25 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
<project name="as3-signals" basedir="." default="swc">
<!-- Set up a prefix for all environment variables. -->
<property environment="env."/>
<fail unless="env.FLEX_HOME" message="FLEX_HOME needs to be defined as an environment variable or in the Ant build." />
<!-- Copy Flex SDK location from environment variable. This can be set manually instead. -->
<property name="FLEX_HOME" value="${env.FLEX_HOME}" />
<property file="build.properties"/>
<taskdef resource="flexUnitTasks.tasks" classpath="${libs.dir}/flexUnitTasks.jar" />
<target name="clean" description="Remove folders generated by the build.">
<echo>[clean] Removing generated folders.</echo>
<delete dir="${output.dir}" quiet="true" includeEmptyDirs="true"/>
<delete dir="${report.dir}" quiet="true" includeEmptyDirs="true"/>
<delete dir="${docs.dir}" quiet="true" includeEmptyDirs="true"/>
<delete dir="${dist.dir}" quiet="true" includeEmptyDirs="true"/>
</target>
<target name="swc" depends="clean" description="Compile AS3 code into a SWC.">
<echo>[swc] Building SWC</echo>
<echo>[swc] Using Flex SDK at: ${FLEX_HOME}</echo>
<mkdir dir="${output.dir}"/>
<java jar="${FLEX_HOME}/lib/compc.jar" dir="." fork="true" failonerror="true">
<arg value="+flexlib=${FLEX_HOME}/frameworks" />
<arg value="-incremental=true" />
<arg value="-source-path+=${src.dir}" />
<!-- Include all classes in this path. -->
<arg value="-include-sources=${src.dir}/${package.dir}" />
<!-- Link in classes from swc library (only those used). -->
<!--<arg value="-library-path+=${libs.dir}" />-->
<arg value="-output=${output.swc}" />
</java>
</target>
<target name="test" depends="swc" description="Run unit tests in a Flash Player window.">
<echo>[test] Running unit tests</echo>
<!-- Compile SWF -->
<java jar="${FLEX_HOME}/lib/mxmlc.jar" dir="${FLEX_HOME}/frameworks" fork="true" failonerror="true">
<arg value="${tests.dir}/${package.dir}/AllTestsRunner.as"/>
<arg value="-incremental=true"/>
<arg value="-source-path+=${src.dir}"/>
<arg value="-source-path+=${tests.dir}"/>
<arg value="-output=${tests.swf}"/>
<arg value="-target-player=10"/>
<arg value="-default-size=1000,800"/>
<arg value="-default-background-color=0x000000"/>
<arg value="-static-link-runtime-shared-libraries=true"/>
<!-- Include classes from SWCs in this folder, but only the ones we use. -->
<arg value="-library-path+=${libs.dir}"/>
<arg value="-verbose-stacktraces=true"/>
<arg value="-headless-server=true"/>
<arg value="-keep-as3-metadata+=Test,Suite,Before,BeforeClass,After,AfterClass,RunWith,Ignore,Inject"/>
</java>
<exec executable="open" os="Mac OS X">
<arg line='-a "flash player debugger" ${tests.swf}' />
</exec>
<exec executable="cmd.exe" osfamily="windows">
<arg line='/C start ${tests.swf}' />
</exec>
<exec executable="flashplayer" os="Linux">
<arg line="${tests.swf}"/>
</exec>
</target>
<target name="ci" depends="swc" description="Run unit tests and create JUnit-style reports for continuous integration.">
<echo>[ci] Running unit tests and generating reports</echo>
<mkdir dir="${report.dir}"/>
<!-- Compile SWF -->
<java jar="${FLEX_HOME}/lib/mxmlc.jar" dir="${FLEX_HOME}/frameworks" fork="true" failonerror="true">
<arg value="${tests.dir}/${package.dir}/AllTestsCIRunner.as"/>
<arg value="-incremental=true"/>
<arg value="-source-path+=${src.dir}"/>
<arg value="-source-path+=${tests.dir}"/>
<arg value="-output=${tests.swf}"/>
<arg value="-target-player=10"/>
<arg value="-default-size=1000,800"/>
<arg value="-default-background-color=0x000000"/>
<arg value="-static-link-runtime-shared-libraries=true"/>
<!-- Include classes from SWCs in this folder, but only the ones we use. -->
<arg value="-library-path+=${libs.dir}"/>
<arg value="-verbose-stacktraces=true"/>
<arg value="-headless-server=true"/>
<arg value="-keep-as3-metadata+=Test,Suite,Before,BeforeClass,After,AfterClass,RunWith,Ignore,Inject"/>
</java>
<!-- Execute test runner SWF and publish reports -->
<flexunit swf="${tests.swf}" toDir="${report.dir}" haltonfailure="false" verbose="true" localTrusted="false" />
<!-- Generate readable JUnit-style reports -->
<junitreport todir="${report.dir}">
<fileset dir="${report.dir}">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${report.dir}/html" />
</junitreport>
</target>
<target name="asdoc" depends="swc" description="Create API docs for ${project.title}">
<echo>[asdoc] Generating ASDOC documentation</echo>
<mkdir dir="${docs.dir}"/>
<tstamp>
<format property="docgen.time" pattern="MM/dd/yyyy hh:mm aa" unit="hour"/>
</tstamp>
<java jar="${FLEX_HOME}/lib/asdoc.jar" dir="${FLEX_HOME}/frameworks" fork="true" failonerror="true">
<!--<arg line="-external-library-path+=${libs.dir}"/>-->
<arg line="-doc-sources+=${src.dir}/${package.dir}"/>
<arg line="-source-path+=${src.dir}"/>
<arg line="-output ${docs.dir}"/>
<arg value="-keep-xml=true"/>
<arg value="-lenient=true"/>
<arg line="-window-title '${project.title} ${ver.num}'"/>
<arg line="-main-title '${project.title} ${ver.num}'"/>
<arg line="-footer '${project.title} - Documentation generated at: ${docgen.time}'"/>
</java>
<echo>ASDOC documentation generated successfully.</echo>
</target>
<!-- Package the Build -->
<target name="package" depends="asdoc,ci">
<tstamp>
<format property="touch.time" pattern="MM/dd/yyyy hh:mm aa" unit="hour"/>
</tstamp>
<!-- Assemble -->
<echo>[package] Packaging Release</echo>
<mkdir dir="${dist.dir}"/>
<mkdir dir="${dist.dir}/bin"/>
<mkdir dir="${dist.dir}/src"/>
<mkdir dir="${dist.dir}/tests"/>
<mkdir dir="${dist.dir}/libs"/>
<copy file="${output.dir}/${project.name.versioned}.swc" todir="${dist.dir}/bin"/>
<copy todir="${dist.dir}/libs">
<fileset dir="${libs.dir}"/>
</copy>
<copy todir="${dist.dir}/src">
<fileset dir="${src.dir}"/>
</copy>
<copy todir="${dist.dir}/tests">
<fileset dir="${tests.dir}"/>
</copy>
<copy todir="${dist.dir}/docs">
<fileset dir="${docs.dir}"/>
</copy>
<delete dir="${dist.dir}/docs/tempdita"/>
<!-- Add ASDoc xml to swc for Flex Builder Tooltips -->
<zip destfile="${dist.dir}/bin/${project.name.versioned}.swc" update="true">
<zipfileset dir="${docs.dir}/tempdita" prefix="docs">
<include name="*packages.dita*"/>
<include name="*org.*"/>
</zipfileset>
</zip>
<!-- Copy README -->
<copy file="README.textile" tofile="${dist.dir}/README" overwrite="true"/>
<!-- Copy LICENSE -->
<copy file="MIT-LICENSE.txt" tofile="${dist.dir}/LICENSE" overwrite="true"/>
<!-- Copy CHANGELOG -->
<copy file="CHANGELOG.textile" tofile="${dist.dir}/CHANGELOG" overwrite="true"/>
<!-- Zip It -->
<zip destfile="${dist.dir}/${project.name.versioned}.zip">
<fileset dir="${dist.dir}"/>
</zip>
<!-- Clean Up -->
<delete file="${dist.dir}/${project.name.versioned}.swc"/>
<delete file="${dist.dir}/README"/>
<delete file="${dist.dir}/LICENSE"/>
<delete file="${dist.dir}/CHANGELOG"/>
<delete dir="${dist.dir}/bin"/>
<delete dir="${dist.dir}/src"/>
<delete dir="${dist.dir}/tests"/>
<delete dir="${dist.dir}/libs"/>
<delete dir="${dist.dir}/docs"/>
<echo>[package] Release packaged successfully</echo>
</target>
</project>