forked from alfongj/gte
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.xml
205 lines (171 loc) · 6.82 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" encoding="utf-8"?>
<!--
Build file for Game Theory Explorer
@author Mark Egesdal
Adapted by Rahul Savani
to replace dependency on Google App Engine with Jetty
-->
<project name="GameTheoryExplorer" basedir="." default="main">
<!-- setup a prefix for all environment variables -->
<property file="build.properties" />
<property name="gui.proj.dir" value="gui-builder"/>
<property name="gui.test.proj.dir" value="gui-builder/test"/>
<property name="lib.proj.dir" value="lib-algo"/>
<property name="lib.test.proj.dir" value="lib-algo/test"/>
<property name="web.proj.dir" value="web-service"/>
<property name="war.name" value="gte"/>
<property name="lib.jar.name" value="${lib.proj.dir}"/>
<property name="build.dir" value="build"/>
<property name="lib.build.dir" value="${build.dir}/${lib.proj.dir}"/>
<property name="lib.test.build.dir" value="${build.dir}/${lib.proj.dir}-test"/>
<property name="gui.build.dir" value="${build.dir}/${gui.proj.dir}"/>
<property name="gui.test.build.dir" value="${build.dir}/${gui.proj.dir}-test"/>
<property name="war.dir" value="${build.dir}/${war.name}"/>
<!-- This is what you have to include to be able to use "mxml" ant task -->
<taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
<taskdef resource="flexUnitTasks.tasks">
<classpath>
<fileset dir="${gui.test.proj.dir}/lib">
<include name="flexUnitTasks*.jar" />
</fileset>
</classpath>
</taskdef>
<target name="main" depends="clean, test-core, test-gui, package">
<echo>Finished</echo>
</target>
<target name="setup">
<mkdir dir="${build.dir}"/>
</target>
<target name="clean">
<delete dir="build"/>
</target>
<target name="compile-core" depends="setup">
<echo>Compiling core library...</echo>
<mkdir dir="${lib.build.dir}"/>
<javac
srcdir="${lib.proj.dir}/src"
destdir="${lib.build.dir}"
includeAntRuntime="false"
/>
</target>
<target name="compile-gui" depends="setup">
<echo>Compiling Flash GUI...</echo>
<mxmlc
file="${gui.proj.dir}/src/lse/math/games/builder/view/Main.mxml"
debug="false"
output="${gui.build.dir}/GuiBuilder.swf"
actionscript-file-encoding="UTF-8"
keep-generated-actionscript="false"
link-report="${gui.build.dir}/MxmlcReport.xml"
incremental="true">
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
<source-path path-element="${FLEX_HOME}/frameworks"/>
<compiler.source-path path-element="${gui.proj.dir}/src"/>
<compiler.library-path dir="${FLEX_HOME}/frameworks" append="true">
<include name="libs" />
<include name="../bundles/{locale}" />
</compiler.library-path>
<!--<library-path dir="${SWC_LIB_DIR}" append="true">
<include name="*.swc" />
</library-path> -->
</mxmlc>
</target>
<target name="test-gui" depends="compile-gui">
<mkdir dir="${gui.test.build.dir}"/>
<!-- Execute FlexUnit tests and publish reports -->
<flexunit
workingDir="${gui.test.build.dir}"
toDir="${gui.test.build.dir}"
haltonfailure="true"
verbose="false"
localTrusted="true">
<source dir="${gui.proj.dir}/src" />
<testSource dir="${gui.test.proj.dir}/src">
<include name="**/*Test.as" />
</testSource>
<library dir="${gui.test.proj.dir}/lib" />
</flexunit>
<!-- Generate readable JUnit-style reports -->
<!--<junitreport todir="${gui.test.build.dir}">
<fileset dir="${gui.test.build.dir}">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${gui.test.build.dir}/html" />
</junitreport>-->
</target>
<target name="test-core" depends="compile-core">
<mkdir dir="${lib.test.build.dir}"/>
<echo>Compiling Java library tests...</echo>
<javac
srcdir="${lib.test.proj.dir}/src"
destdir="${lib.test.build.dir}"
includeAntRuntime="false">
<classpath>
<pathelement location="${lib.build.dir}" />
<fileset dir="${lib.test.proj.dir}/lib">
<include name="junit*.jar" />
</fileset>
</classpath>
</javac>
<echo>Running Java library tests...</echo>
<junit printsummary="on" haltonfailure="yes">
<formatter type="brief" usefile="true"/>
<classpath>
<pathelement location="${lib.test.build.dir}" />
<pathelement location="${lib.build.dir}" />
<fileset dir="${lib.test.proj.dir}/lib">
<include name="junit*.jar" />
</fileset>
</classpath>
<batchtest todir="${lib.test.build.dir}">
<fileset dir="${lib.test.proj.dir}/src"/>
</batchtest>
</junit>
</target>
<target name="package" depends="compile-core, compile-gui">
<echo>Building WAR directory...</echo>
<mkdir dir="${war.dir}"/>
<copy todir="${war.dir}" overwrite="true">
<fileset dir="${web.proj.dir}/war"></fileset>
</copy>
<tstamp>
<format property="last.mod" pattern="yyyy-MM-dd hh:mm" timezone="GMT"/>
</tstamp>
<replace file="${war.dir}/builder/index.jsp" token="yyyy-MM-dd hh:mm" value="${last.mod}"/>
<echo>Creating core library JAR file...</echo>
<mkdir dir="${war.dir}/WEB-INF/lib"/>
<jar
destfile="${war.dir}/WEB-INF/lib/${lib.jar.name}.jar"
basedir="${lib.build.dir}"
update="true"
/>
<echo>Copying GUI flash program to WAR...</echo>
<html-wrapper swf="GuiBuilder" express-install="true" output="${gui.build.dir}" height="100%" width="100%" />
<copy file="${gui.build.dir}/GuiBuilder.swf" todir="${war.dir}/builder" overwrite="true"/>
<copy file="${gui.build.dir}/playerProductInstall.swf" todir="${war.dir}/builder" overwrite="true"/>
<copy file="${gui.build.dir}/swfobject.js" todir="${war.dir}/builder" overwrite="true"/>
<!-- Timestamp the swf to prevent browser caching of the old one -->
<replace file="${war.dir}/builder/index.jsp" token="GuiBuilder.swf" value="GuiBuilder-${DSTAMP}${TSTAMP}.swf"/>
<move file="${war.dir}/builder/GuiBuilder.swf" tofile="${war.dir}/builder/GuiBuilder-${DSTAMP}${TSTAMP}.swf" />
<echo>Compiling WAR class files...</echo>
<mkdir dir="${war.dir}/WEB-INF/classes"/>
<javac
srcdir="${web.proj.dir}/src"
destdir="${war.dir}/WEB-INF/classes"
includeAntRuntime="false">
<classpath>
<fileset dir="${war.dir}/WEB-INF/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${JETTY_HOME}/lib">
<include name="*.jar"/>
</fileset>
</classpath>
</javac>
<echo>Packaging WAR...</echo>
<war destfile="${build.dir}/${war.name}.war"
webxml="${war.dir}/WEB-INF/web.xml"
basedir="${war.dir}">
</war>
</target>
</project>