My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
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
<?xml version="1.0" ?>
<project name="android-build">
<!-- No user servicable parts below. -->

<!-- Input directories -->
<property name="resource-dir" value="res" />
<property name="asset-dir" value="assets" />
<property name="srcdir" value="src" />

<!-- Create R.java in the source directory -->
<property name="outdir-r" value="src" />

<!-- Intermediate files -->
<property name="dex-file" value="classes.dex" />
<property name="intermediate-dex" value="${outdir}/${dex-file}" />

<!-- The final package file to generate -->
<property name="out-package" value="${outdir}/${ant.project.name}.apk" />

<!-- Tools -->
<property name="aapt" value="${android-tools}/aapt" />
<property name="aidl" value="${android-tools}/aidl" />
<property name="dx" value="${android-tools}/dx" />
<property name="zip" value="zip" />
<property name="android-jar" value="${sdk-folder}/android.jar" />

<!-- Rules -->

<!-- Create the output directories if they don't exist yet. -->
<target name="dirs">
<mkdir dir="${outdir}" />
<mkdir dir="${outdir-classes}" />
<mkdir dir="${android-lib-dir}"/>
</target>

<!-- Generate the R.java file for this project's resources. -->
<target name="resource-src" depends="dirs">
<!--echo>Generating R.java...</echo-->
<exec executable="${aapt}" failonerror="true">
<arg value="compile" />
<arg value="-m" />
<arg value="-J" />
<arg value="${outdir-r}" />
<arg value="-M" />
<arg value="AndroidManifest.xml" />
<arg value="-S" />
<arg value="${resource-dir}" />
<arg value="-I" />
<arg value="${android-jar}" />
</exec>
</target>

<!-- Generate java classes from .aidl files. -->
<target name="aidl" depends="dirs">
<apply executable="${aidl}" failonerror="true">
<fileset dir="${srcdir}">
<include name="**/*.aidl"/>
</fileset>
</apply>
</target>

<!-- Pre android stuff; -->
<target name="pre-android" depends="dirs, resource-src, aidl">
</target>

<target name="init-post-android">
<copy includeemptydirs="false" todir="${outdir-classes}">
<fileset dir="src" excludes="**/*.launch, **/*.java"/>
</copy>
</target>

<!-- Convert this project's .class files into .dex files. -->
<target name="dex">
<exec executable="${dx}" failonerror="true">
<arg value="-JXmx384M" />
<arg value="--dex" />
<arg value="--output=${intermediate-dex}" />
<arg value="--locals=full" />
<arg value="--positions=lines" />
<arg path="${outdir-classes}" />
</exec>
</target>

<!-- Put the project's resources into the output package file. -->
<target name="package-res-and-assets">
<!--echo>Packaging resources and assets...</echo-->
<exec executable="${aapt}" failonerror="true">
<arg value="package" />
<arg value="-f" />
<arg value="-c" />
<arg value="-M" />
<arg value="AndroidManifest.xml" />
<arg value="-S" />
<arg value="${resource-dir}" />
<arg value="-A" />
<arg value="${asset-dir}" />
<arg value="-I" />
<arg value="${android-jar}" />
<arg value="${out-package}" />
</exec>
</target>

<!-- Same as package-res-and-assets, but without "-A ${asset-dir}" -->
<target name="package-res-no-assets">
<!--echo>Packaging resources...</echo-->
<exec executable="${aapt}" failonerror="true">
<arg value="package" />
<arg value="-f" />
<arg value="-c" />
<arg value="-M" />
<arg value="AndroidManifest.xml" />
<arg value="-S" />
<arg value="${resource-dir}" />
<!-- No assets directory -->
<arg value="-I" />
<arg value="${android-jar}" />
<arg value="${out-package}" />
</exec>
</target>

<!-- Invoke the proper target depending on whether or not
an assets directory is present. -->
<!-- TODO: find a nicer way to include the "-A ${asset-dir}" argument
only when the assets dir exists. -->
<target name="package-res">
<available file="${asset-dir}" type="dir"
property="res-target" value="and-assets" />
<property name="res-target" value="no-assets" />
<antcall target="package-res-${res-target}" />
</target>

<!-- Put the project's .class files into the output package file. -->
<target name="package-java" depends="package-res">
<!--echo>Packaging java...</echo-->
<jar destfile="${out-package}"
basedir="${outdir-classes}"
update="true" />
</target>

<!-- Put the project's .dex files into the output package file. -->
<target name="package-dex" depends="dex, package-res">
<!--echo>Packaging dex...</echo-->
<exec executable="${zip}" failonerror="true">
<arg value="-qj" />
<arg value="${out-package}" />
<arg value="${intermediate-dex}" />
</exec>
</target>

<!-- Post android stuff; Create the package file for this project from the sources. -->
<target name="post-android" depends="init-post-android,package-dex" />
</project>

Change log

r71 by w...@saville.com on Feb 12, 2008   Diff
Tweak common-build.xml and android-
build.xml

Removed android specific mkdirs.
Moved making android-lib-dir to android-
build.xml
Go to: 
Project members, sign in to write a code review

Older revisions

r63 by w...@saville.com on Feb 9, 2008   Diff
Added android mc build.xml
r53 by w...@saville.com on Feb 9, 2008   Diff
Added ant support.

To create the jar files automatically
it appears
you must use ant build scripts.
All revisions of this file

File info

Size: 5579 bytes, 152 lines
Powered by Google Project Hosting