forked from dfabulich/choicescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
219 lines (195 loc) · 7.73 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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<!--
Copyright 2010 by Dan Fabulich.
Dan Fabulich licenses this file to you under the
ChoiceScript License, Version 1.0 (the "License"); you may
not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.choiceofgames.com/LICENSE-1.0.txt
See the License for the specific language governing
permissions and limitations under the License.
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied.
-->
<project default="quicktest">
<property name = "game.dir" value="mygame" />
<target name="burn-revision-numbers" unless="skipVersion">
<condition property="git" value="gitx.cmd">
<os family="windows" />
</condition>
<property name="git" value="git" />
<exec executable="${git}" outputproperty="revision" failonerror="true">
<arg value="describe"/>
<arg value="--long"/>
</exec>
<echo file="web/version.js">window.version="${revision}"</echo>
</target>
<target name="check-node" unless="skipNode">
<exec taskName="node" executable="node" resultproperty="exitCode" failIfExecutionFails="false">
<arg value="--version" />
</exec>
<condition property="hasNode">
<equals arg1="${exitCode}" arg2="0" />
</condition>
</target>
<target name="node" depends="check-node" if="hasNode">
<presetdef name="rhino">
<exec taskName="node" failonerror="true" executable="node" />
</presetdef>
<property name="input.dir" location="${basedir}/web/${game.dir}/scenes" />
<property name="output.dir" location="${basedir}/deploy/scenes" />
<property name="test.dir" location="${basedir}/tests" />
</target>
<target name="rhino" depends="node" unless="hasNode">
<condition property="rhinoClass" value="org.mozilla.javascript.tools.debugger.Main">
<isset property="debug" />
</condition>
<property name="rhinoClass" value="org.mozilla.javascript.tools.shell.Main"/>
<presetdef name="rhino">
<java failonerror="true" classpath="js.jar" classname="${rhinoClass}" fork="true">
<arg line="-w -opt -1 -debug"/>
</java>
</presetdef>
<property name="input.dir" location="${basedir}/web/${game.dir}/scenes" />
<property name="output.dir" location="${basedir}/deploy/scenes" />
<property name="test.dir" location="${basedir}/tests" />
</target>
<target name="unittest-core" depends="rhino">
<rhino>
<arg file="${test.dir}/suite.js" />
<arg file="${test.dir}/qunit.js" />
<arg file="${basedir}/web/scene.js" />
<arg file="${basedir}/web/util.js" />
<arg file="${basedir}/headless.js" />
<arg file="${test.dir}/scenetest.js" />
</rhino>
</target>
<target name="unittest-util" depends="rhino">
<rhino>
<arg file="${test.dir}/suite.js" />
<arg file="${test.dir}/qunit.js" />
<arg file="${basedir}/web/scene.js" />
<arg file="${basedir}/web/util.js" />
<arg file="${basedir}/headless.js" />
<arg file="${test.dir}/utiltest.js" />
</rhino>
</target>
<target name="unittest-autotest" depends="rhino">
<rhino>
<arg file="${test.dir}/suite.js" />
<arg file="${test.dir}/qunit.js" />
<arg file="${basedir}/web/scene.js" />
<arg file="${basedir}/web/util.js" />
<arg file="${basedir}/headless.js" />
<arg file="${basedir}/editor/embeddable-autotester.js" />
<arg file="${test.dir}/autotesttest.js" />
</rhino>
</target>
<target name="unittest-xmltranslator" depends="rhino">
<rhino>
<arg file="${test.dir}/suite.js" />
<arg file="${test.dir}/qunit.js" />
<arg file="${basedir}/web/scene.js" />
<arg file="${basedir}/web/util.js" />
<arg file="${basedir}/headless.js" />
<arg file="${test.dir}/xmltranslatortestoverride.js" />
<arg file="${basedir}/xmltranslator.js" />
<arg file="${test.dir}/xmltranslatortest.js" />
</rhino>
</target>
<target name="unittest-achievetest" depends="rhino">
<rhino>
<arg file="${test.dir}/suite.js" />
<arg file="${test.dir}/qunit.js" />
<arg file="${test.dir}/uisetup.js" />
<arg file="${basedir}/web/ui.js" />
<arg file="${test.dir}/achievetest.js" />
</rhino>
</target>
<target name="unittest" depends="unittest-core, unittest-util, unittest-autotest, unittest-xmltranslator, unittest-achievetest" />
<target name="randomtest" depends="rhino">
<property name="num" value="10000" />
<property name="game" value="${game.dir}" />
<property name="outputFile" value="randomtest-output.txt" />
<property name="trial" value="false" />
<property name="showText" value="false" />
<property name="avoidUsedOptions" value="true" />
<property name="showChoices" value="true" />
<property name="seed" value="0" />
<property name="recordBalance" value="false" />
<echo>Executing randomtest, writing to ${outputFile}</echo>
<rhino>
<arg value="randomtest.js" />
<arg value="num=${num}" />
<arg value="game=${game}" />
<arg value="seed=${seed}" /> <!--seed-->
<arg value="delay=false" /> <!--delay-->
<arg value="trial=${trial}" />
<arg value="showText=${showText}" />
<arg value="avoidUsedOptions=${avoidUsedOptions}" />
<arg value="showChoices=${showChoices}" />
<arg value="recordBalance=${recordBalance}" />
<arg value="outputFile=${outputFile}" />
</rhino>
</target>
<target name="autotest" depends="quicktest" />
<target name="quicktest" depends="rhino">
<property name="vig" value="" />
<rhino>
<arg value="autotest.js"/>
<arg value="${game.dir}" />
<arg value="${vig}" />
</rhino>
</target>
<target name="generator" depends="rhino">
<condition property="scriptSuffix" value="Node">
<isset property="hasNode" />
</condition>
<property name="scriptSuffix" value="" />
<mkdir dir="${output.dir}" />
<rhino>
<arg file="generator${scriptSuffix}.js"/>
<arg value="${input.dir}" />
<arg value="${output.dir}" />
</rhino>
<rhino output="web/${game.dir}/mygame.js">
<arg file="mygamegenerator.js" />
<arg value="${game.dir}" />
</rhino>
</target>
<target name="xmltranslator" depends="rhino">
<property name="vig" value="" />
<rhino>
<arg file="xmltranslator.js"/>
<arg value="${input.dir}" />
<arg value="${vig}" />
</rhino>
</target>
<target name="clean">
<delete dir="deploy" />
</target>
<target name="copy-deploy">
<mkdir dir="deploy" />
<copy todir="deploy">
<fileset dir="web">
<include name="*/**" />
<exclude name="${game.dir}/**" />
<exclude name=".htaccess" />
</fileset>
<fileset dir="web/${game.dir}">
<include name="*/**" />
<exclude name="index.html" />
<exclude name="credits.html" />
</fileset>
</copy>
</target>
<target name="deploy" depends="generator">
<copy file="web/${game.dir}/index.html" tofile="deploy/index.html" overwrite="true"/>
<replace file="deploy/index.html" token="../" value="" />
<copy file="web/${game.dir}/credits.html" tofile="deploy/credits.html" overwrite="true"/>
<replace file="deploy/credits.html" token="../" value="" />
<exec executable="svnversion" outputproperty="revision" failonerror="true"/>
<echo file="deploy/version.js">window.version="${revision}" window.generatedFast = true;</echo>
</target>
</project>