forked from SimonRichardson/as3-spod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
147 lines (112 loc) · 5.64 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
<project name="as3-spod" 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 generating 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"/>
</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="-external-library-path+=${FLEX_HOME}/frameworks/libs/air"/>
<arg value="-external-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+=${FLEX_HOME}/frameworks/libs/air"/>
<arg value="-library-path+=${libs.dir}"/>
<arg value="-verbose-stacktraces=true"/>
<arg value="-headless-server=true"/>
<arg value="-optimize=true"/>
<arg value="-keep-as3-metadata+=Test,Suite,Before,BeforeClass,After,AfterClass,RunWith,Ignore,Inject,Override,Frame"/>
</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,Override,Frame"/>
</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="-library-path+=${libs.dir}"/>
<arg line="-external-library-path+=${FLEX_HOME}/frameworks/libs/air"/>
<arg line="-output ${docs.dir}"/>
<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>
</project>