-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
103 lines (81 loc) · 3.94 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="BaseMobileTasks ANE" basedir="." default="all">
<!-- thanks to Freshplanet for a good chunk of the compile and package targets: https://github.com/freshplanet -->
<!-- Property Files -->
<property file="ane.properties"/>
<property file="build.properties"/>
<!-- Paths -->
<property name="as3.src" location="as3/src"/>
<property name="bin.dir" location="bin"/>
<property name="resources.dir" location="resources"/>
<property name="bin.ane" location="${bin.dir}/ane"/>
<!-- All -->
<target name="all" depends="clean, android, package" description="Full build of extension incl. native compilation"/>
<!-- Clean -->
<target name="clean">
<delete dir="${bin.dir}"/>
</target>
<!-- Compile Actionscript -->
<target name="compile-swc" description="Build SWC library">
<mkdir dir="temp"/>
<fileset dir="${as3.src}" casesensitive="yes" id="classfiles">
<include name="**/*.as"/>
</fileset>
<pathconvert property="classlist" refid="classfiles" pathsep=" " dirsep=".">
<regexpmapper from=".*src.(.*)\.as" to="\1"/>
</pathconvert>
<exec executable="${air.sdk.home}/bin/compc${bin.ext}" failonerror="true">
<arg line='-source-path "${as3.src}"'/>
<arg line='-output "${bin.dir}/swc/${ane.name}-${ane.version}.swc"'/>
<arg line='-swf-version=27'/>
<arg line='-external-library-path+="${air.sdk.home}/frameworks/libs/air/airglobal.swc"'/>
<arg line='-include-classes ${classlist}'/>
<env key="AIR_SDK_HOME" value="${air.sdk.home}"/>
</exec>
<unzip src="${bin.dir}/swc/${ane.name}-${ane.version}.swc" dest="temp" overwrite="true"/>
<copy file="temp/library.swf" todir="${bin.dir}/android/swf" overwrite="true"/>
<copy file="temp/library.swf" todir="${bin.dir}/default/swf" overwrite="true"/>
<delete dir="temp"/>
</target>
<!-- Package Ane -->
<target name="package" description="Create the ane file" depends="compile-swc">
<copy todir="${bin.ane}/android">
<fileset dir="${bin.dir}/android/jar"/>
<fileset dir="${bin.dir}/android/swf">
<include name="library.swf"/>
</fileset>
</copy>
<copy todir="${bin.ane}/default">
<fileset dir="${bin.dir}/default/swf">
<include name="library.swf"/>
</fileset>
</copy>
<copy file="${resources.dir}/extension.xml" tofile="${bin.dir}/temp/extension.xml" overwrite="true">
<filterset>
<filter token="ANE_VERSION" value="${ane.version}"/>
</filterset>
</copy>
<exec executable='${air.sdk.home}/bin/adt${bin.ext}' failonerror='true'>
<arg value='-package'/>
<arg value='-target'/>
<arg value='ane'/>
<arg value='"${bin.dir}/ane/${ane.name}-${ane.version}.ane"'/>
<arg value='"${bin.dir}/temp/extension.xml"'/>
<arg line='-swc "${bin.dir}/swc/${ane.name}-${ane.version}.swc"'/>
<arg line='-platform Android-ARM -C "${bin.ane}/android/" .'/>
<arg line='-platform Android-x86 -C "${bin.ane}/android/" .'/>
<arg line='-platform default -C "${bin.ane}/default/" .'/>
</exec>
<!-- Clean up copied source files -->
<delete dir="${bin.dir}/temp"/>
<delete dir="${bin.dir}/android"/>
<delete dir="${bin.dir}/default"/>
</target>
<!-- Android -->
<target name="android" description="Build Android">
<!-- Android has own build file -->
<ant dir="android" inheritAll="true" inheritRefs="true" target="all">
<property name="bin.dir" value="${bin.dir}/android"/>
</ant>
</target>
</project>