This repository has been archived by the owner on Mar 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.xml
62 lines (58 loc) · 2.46 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
<?xml version="1.0"?>
<project name="AS3ToHaxe" default="build" basedir="./">
<property file="${user.home}\ant\my.build.properties"/>
<property file="${os.name}.build.properties"/>
<property file="build.properties"/>
<macrodef name="test">
<attribute name="id" />
<sequential>
<fail unless="id" message="id needs to be specified in the build properties as the name of the project" />
<fail unless="build.dir" message="build.dir needs to be specified in the build properties output binary folder" />
<fail unless="runtime" message="runtime needs to be specified in the build properties as neko" />
<exec executable="${runtime}" failonerror="true">
<arg line="${build.dir}/${id}.n" />
<arg line="-from ${tests.dir}/@{id}" />
<arg line="-to ${tests.dir}/@{id}" />
</exec>
<loadfile property="@{id}" srcFile="${tests.dir}/@{id}/@{id}.hx" />
<loadfile property="@{id}.result" srcFile="${tests.dir}/@{id}/@{id}.result.hx" />
<compare id="@{id}" output="${@{id}}" result="${@{id}.result}" />
</sequential>
</macrodef>
<scriptdef name="compare" language="javascript">
<attribute name="output" />
<attribute name="result" />
<attribute name="id" />
<![CDATA[
var output = String(attributes.get("output"));
var result = String(attributes.get("result"));
var id = attributes.get("id");
if (!output || !result || output != result)
self.log("[FAILED] " + id);
else
self.log("[PASSED] " + id);
]]>
</scriptdef>
<target name="build">
<fail unless="compiler" message="compiler needs to be specified in the build properties as the haxe compiler" />
<fail unless="source.dir" message="source.dir needs to be specified in the build properties as the path of the source" />
<fail unless="id" message="id needs to be specified in the build properties as the name of the project" />
<fail unless="build.dir" message="build.dir needs to be specified in the build properties output binary folder" />
<fail unless="runtime" message="runtime needs to be specified in the build properties as neko" />
<exec executable="${compiler}" failonerror="true">
<arg line="-cp ${source.dir}" />
<arg line="-main ${id}" />
<arg line="-${runtime} ${build.dir}/${id}.n" />
</exec>
<antcall target="runTests" />
</target>
<target name="runTests">
<test id="Structure" />
<test id="Methods" />
<test id="Loops" />
<test id="GettersSetters" />
<test id="Types" />
<test id="Casts" />
<test id="Events" />
</target>
</project>