-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.xml
More file actions
177 lines (160 loc) · 7.5 KB
/
build.xml
File metadata and controls
177 lines (160 loc) · 7.5 KB
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
<?xml version="1.0" standalone="yes"?>
<project name="thane" default="dist" basedir="." xmlns:artifact="urn:maven-artifact-ant">
<property name="deploy.dir" value="dist"/>
<property name="bin.dir" value="bin"/>
<property name="tamarin.dir" value="${basedir}/tamarin-central"/>
<property name="tamdist.dir" value="${tamarin.dir}/dist"/>
<property name="thane.dir" value="${tamarin.dir}/thane"/>
<property name="thanedist.dir" value="${tamdist.dir}/${ant.project.name}"/>
<property name="builtin.name" value="builtin"/>
<property name="maven-ant.vers" value="2.1.1"/>
<property name="maven-ant.dir" value="${user.home}/.m2/ant-support"/>
<property name="maven-ant.jar" value="${maven-ant.dir}/maven-ant-tasks-${maven-ant.vers}.jar"/>
<property name="maven-ant.url"
value="http://repo1.maven.org/maven2/org/apache/maven/maven-ant-tasks"/>
<condition property="maven-ant.exists"><available file="${maven-ant.jar}"/></condition>
<target name="-download-maven-ant" unless="maven-ant.exists">
<mkdir dir="${maven-ant.dir}"/>
<get src="${maven-ant.url}/${maven-ant.vers}/maven-ant-tasks-${maven-ant.vers}.jar"
dest="${maven-ant.jar}" usetimestamp="true"/>
</target>
<target name="-init-maven-ant" depends="-download-maven-ant">
<taskdef resource="org/apache/maven/artifact/ant/antlib.xml"
uri="urn:maven-artifact-ant" classpath="${maven-ant.jar}"/>
<artifact:pom id="pom" file="pom.xml"/>
<artifact:dependencies pomRefId="pom" useScope="compile"/>
</target>
<target name="-prepare" depends="-init-maven-ant">
<fail><condition><not><isset property="flexsdk.dir"/></not></condition>
You must pass -Dflexsdk.dir=/path/to/flexsdk when building. It must be an
absolute path.
</fail>
<mkdir dir="${deploy.dir}"/>
<mkdir dir="${tamdist.dir}"/>
<copy file="etc/thane-config.xml.in" tofile="${deploy.dir}/thane-config.xml">
<filterset>
<filter token="flex_sdk_dir" value="${flexsdk.dir}"/>
</filterset>
</copy>
</target>
<!-- checks whether the Thane library needs building -->
<target name="checkthanelib">
<condition property="no_build_thanelib"><and>
<uptodate targetfile="${thane.dir}/${ant.project.name}.abc">
<srcfiles dir="${thane.dir}" includes="**/*.as"/>
<srcfiles dir="${tamarin.dir}/core" includes="*.abc"/>
</uptodate>
<uptodate targetfile="${thanedist.dir}/${ant.project.name}.swc">
<srcfiles dir="${thane.dir}" includes="**/*.as"/>
<srcfiles dir="${tamarin.dir}/core" includes="*.as"/>
</uptodate>
</and></condition>
</target>
<!-- builds the Thane library -->
<target name="thanelib" unless="no_build_thanelib" depends="-prepare,checkthanelib">
<taskdef name="asclib" classname="flex.ant.AscLibTask">
<classpath>
<pathelement location="lib/flexTasks.jar"/>
<pathelement location="lib/asc.jar"/>
</classpath>
</taskdef>
<dirname property="abs.thane.out.dir" file="${tamarin.dir}/thane/somefile.txt"/>
<java jar="${flexsdk.dir}/lib/compc.jar" fork="true" failonerror="true">
<arg value="-load-config"/>
<arg value="dist/thane-config.xml"/>
<arg value="-compiler.strict=false"/>
<arg value="-compiler.show-actionscript-warnings=false"/>
<arg value="-compiler.optimize=true"/>
<arg value="-include-sources"/>
<arg value="${tamarin.dir}/core/builtin.as"/>
<arg value="${tamarin.dir}/core/Error.as"/>
<arg value="${tamarin.dir}/core/Math.as"/>
<arg value="${tamarin.dir}/core/XML.as"/>
<arg value="${tamarin.dir}/core/Date.as"/>
<arg value="${tamarin.dir}/core/RegExp.as"/>
<arg value="${thane.dir}/as3src"/>
<arg value="-output"/>
<arg value="${thanedist.dir}/${ant.project.name}.swc"/>
</java>
</target>
<!-- detect make command -->
<condition property="isunix"><os family="unix"/></condition>
<condition property="make" value="gmake" else="make"><os name="FreeBSD"/></condition>
<!-- enable debugging -->
<!-- TODO: are 2 individual targets needed and what do we do with them? -->
<property name="tamarin-debugger" value="--enable-debugger --enable-debug"/>
<!-- build tamarin -->
<target name="tamarin" depends="thanelib" if="isunix">
<echo level="info" message="Doing native compilation on ${os.name}..."/>
<exec dir="${tamdist.dir}" executable="python" failonerror="true">
<arg line="${tamarin.dir}/configure.py --enable-thane ${tamarin-debugger}"/>
</exec>
<exec dir="${thane.dir}" executable="python" failonerror="true">
<arg line="thanelib.py"/>
</exec>
<exec dir="${tamdist.dir}" executable="${make}" failonerror="true">
<arg line="-j4"/>
</exec>
</target>
<!-- copy pre-built binary files to dist. we can't do this as part of dist because the -->
<!-- dist target must be runnable on an arbitrary architecture -->
<target name="distbinary" depends="-prepare,detect-arch">
<copy todir="${deploy.dir}">
<fileset dir="${bin.dir}/${arch.id}" includes="avm${ant.project.name}*"/>
</copy>
</target>
<!-- cleans up our build artifacts -->
<target name="clean">
<delete dir="${deploy.dir}"/>
<delete dir="${tamarin.dir}/${deploy.dir}"/>
<delete><fileset dir="${tamarin.dir}/build" includes="*.pyc"/></delete>
<!-- temporary hack to soothe upset build machine -->
<delete>
<fileset dir="${bin.dir}">
<include name="thane.swc.r*"/>
<include name="lin32"/>
</fileset>
</delete>
</target>
<!-- distclean = same as clean in this case -->
<target name="distclean" depends="clean"/>
<target name="dist" depends="thanelib">
<!-- copies thane.swc to the dist -->
<copy file="${thanedist.dir}/${ant.project.name}.swc" todir="${deploy.dir}"/>
</target>
<!-- Detects the architecture id of this computer -->
<target name="detect-arch">
<!-- apparently Java uses both amd64 and x86_64 -->
<condition property="arch.width" value="64" else="32">
<and>
<!-- Mac binaries and windows binaries all get called '32-bit' -->
<not><or><os name="Mac OS X"/><os family="windows"/></or></not>
<or><os arch="amd64"/><os arch="x86_64"/></or>
</and>
</condition>
<!-- Make "Windows 7" just be "Windows" -->
<condition property="arch.os" value="Windows" else="${os.name}">
<os family="windows"/>
</condition>
<property name="arch.id" value="${arch.os}-${arch.width}"/>
<echo>Architecture is ${arch.id}</echo>
</target>
<!-- Deploys our built executables to the bin directory. Normally a developer will -->
<!-- run this then do an svn commit on each target architecture, completing the new -->
<!-- thane release. The thane.swc file is included, but should not change from arch -->
<!-- to arch since the set of native methods doesn't change. -->
<target name="genbinaries" depends="detect-arch,tamarin">
<mkdir dir="${bin.dir}"/>
<mkdir dir="${bin.dir}/${arch.id}"/>
<copy file="${thanedist.dir}/avm${ant.project.name}" todir="${bin.dir}/${arch.id}"/>
<copy file="${thanedist.dir}/${ant.project.name}.swc" todir="${bin.dir}"/>
</target>
<property name="maven.deploy.repo" value="file://${user.home}/.m2/repository"/>
<target name="maven-deploy" depends="dist"
description="Deploys our build artifacts to a Maven repository.">
<artifact:deploy file="${deploy.dir}/${ant.project.name}.swc" uniqueVersion="false">
<remoteRepository url="${maven.deploy.repo}"/>
<pom refid="pom"/>
</artifact:deploy>
</target>
</project>