Rev 84 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 84 | Rev 129 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | <?xml version="1.0" ?> |
1 | <?xml version="1.0" ?> |
2 | <project name="DUBwise" default="package"> |
2 | <project name="DUBwise" default="debug"> |
- | 3 | <!-- SDK Locations --> |
|
3 | <property name="sdk-folder" value="/home/ligi/bin/android" /> |
4 | <property name="sdk-folder" value="/home/ligi/bin/android-sdk-linux_x86-0.9_beta" /> |
4 | <property name="android-tools" value="/home/ligi/bin/android/tools" /> |
5 | <property name="android-tools" value="/home/ligi/bin/android-sdk-linux_x86-0.9_beta/tools" /> |
- | 6 | ||
- | 7 | <!-- Application Package Name --> |
|
5 | <property name="android-framework" value="${android-tools}/lib/framework.aidl" /> |
8 | <property name="application-package" value="org.ligi" /> |
Line 6... | Line 9... | ||
6 | 9 | ||
7 | <!-- The intermediates directory --> |
10 | <!-- The intermediates directory --> |
8 | <!-- Eclipse uses "bin" for its own output, so we do the same. --> |
11 | <!-- Eclipse uses "bin" for its own output, so we do the same. --> |
9 | <property name="outdir" value="bin" /> |
12 | <property name="outdir" value="bin" /> |
- | 13 | ||
10 | 14 | <!-- ************************************************************************************* --> |
|
Line -... | Line 15... | ||
- | 15 | <!-- No user servicable parts below. --> |
|
- | 16 | ||
11 | <!-- No user servicable parts below. --> |
17 | <property name="android-framework" value="${android-tools}/lib/framework.aidl" /> |
12 | 18 | ||
13 | <!-- Input directories --> |
19 | <!-- Input directories --> |
14 | <property name="resource-dir" value="res" /> |
20 | <property name="resource-dir" value="res" /> |
- | 21 | <property name="asset-dir" value="assets" /> |
|
- | 22 | <property name="srcdir" value="src" /> |
|
- | 23 | <condition property="srcdir-ospath" |
|
- | 24 | value="${basedir}\${srcdir}" |
|
- | 25 | else="${basedir}/${srcdir}" > |
|
- | 26 | <os family="windows"/> |
|
- | 27 | </condition> |
|
- | 28 | ||
- | 29 | <property name="external-libs" value="libs" /> |
|
- | 30 | <condition property="external-libs-ospath" |
|
- | 31 | value="${basedir}\${external-libs}" |
|
- | 32 | else="${basedir}/${external-libs}" > |
|
Line 15... | Line 33... | ||
15 | <property name="asset-dir" value="assets" /> |
33 | <os family="windows"/> |
16 | <property name="srcdir" value="src" /> |
34 | </condition> |
- | 35 | ||
- | 36 | <!-- Output directories --> |
|
- | 37 | <property name="outdir-classes" value="${outdir}/classes" /> |
|
- | 38 | <condition property="outdir-classes-ospath" |
|
- | 39 | value="${basedir}\${outdir-classes}" |
|
Line 17... | Line 40... | ||
17 | 40 | else="${basedir}/${outdir-classes}" > |
|
18 | <!-- Output directories --> |
41 | <os family="windows"/> |
Line 19... | Line 42... | ||
19 | <property name="outdir-classes" value="${outdir}/classes" /> |
42 | </condition> |
20 | 43 | ||
21 | <!-- Create R.java in the source directory --> |
44 | <!-- Create R.java in the source directory --> |
- | 45 | <property name="outdir-r" value="src" /> |
|
- | 46 | ||
- | 47 | <!-- Intermediate files --> |
|
- | 48 | <property name="dex-file" value="classes.dex" /> |
|
- | 49 | <property name="intermediate-dex" value="${outdir}/${dex-file}" /> |
|
Line 22... | Line 50... | ||
22 | <property name="outdir-r" value="src" /> |
50 | <condition property="intermediate-dex-ospath" |
23 | 51 | value="${basedir}\${intermediate-dex}" |
|
- | 52 | else="${basedir}/${intermediate-dex}" > |
|
- | 53 | <os family="windows"/> |
|
- | 54 | </condition> |
|
- | 55 | ||
- | 56 | <!-- The final package file to generate --> |
|
- | 57 | <property name="resources-package" value="${outdir}/${ant.project.name}.ap_" /> |
|
- | 58 | <condition property="resources-package-ospath" |
|
- | 59 | value="${basedir}\${resources-package}" |
|
- | 60 | else="${basedir}/${resources-package}" > |
|
- | 61 | <os family="windows"/> |
|
- | 62 | </condition> |
|
- | 63 | ||
- | 64 | <property name="out-debug-package" value="${outdir}/${ant.project.name}-debug.apk" /> |
|
- | 65 | <condition property="out-debug-package-ospath" |
|
- | 66 | value="${basedir}\${out-debug-package}" |
|
- | 67 | else="${basedir}/${out-debug-package}" > |
|
- | 68 | <os family="windows"/> |
|
- | 69 | </condition> |
|
- | 70 | ||
Line 24... | Line 71... | ||
24 | <!-- Intermediate files --> |
71 | <property name="out-unsigned-package" value="${outdir}/${ant.project.name}-unsigned.apk" /> |
25 | <property name="dex-file" value="classes.dex" /> |
72 | <condition property="out-unsigned-package-ospath" |
- | 73 | value="${basedir}\${out-unsigned-package}" |
|
- | 74 | else="${basedir}/${out-unsigned-package}" > |
|
26 | <property name="intermediate-dex" value="${outdir}/${dex-file}" /> |
75 | <os family="windows"/> |
- | 76 | </condition> |
|
- | 77 | ||
27 | 78 | <!-- Tools --> |
|
- | 79 | <condition property="aapt" value="${android-tools}/aapt.exe" else="${android-tools}/aapt" > |
|
- | 80 | <os family="windows"/> |
|
28 | <!-- The final package file to generate --> |
81 | </condition> |
- | 82 | <condition property="aidl" value="${android-tools}/aidl.exe" else="${android-tools}/aidl" > |
|
- | 83 | <os family="windows"/> |
|
- | 84 | </condition> |
|
- | 85 | <condition property="adb" value="${android-tools}/adb.exe" else="${android-tools}/adb" > |
|
- | 86 | <os family="windows"/> |
|
- | 87 | </condition> |
|
29 | <property name="out-package" value="${outdir}/${ant.project.name}.apk" /> |
88 | <condition property="dx" value="${android-tools}/dx.bat" else="${android-tools}/dx" > |
30 | - | ||
Line 31... | Line 89... | ||
31 | <!-- Tools --> |
89 | <os family="windows"/> |
Line 32... | Line 90... | ||
32 | <property name="aapt" value="${android-tools}/aapt" /> |
90 | </condition> |
33 | <property name="aidl" value="${android-tools}/aidl" /> |
91 | <condition property="apk-builder" value="${android-tools}/apkbuilder.bat" else="${android-tools}/apkbuilder" > |
- | 92 | <os family="windows"/> |
|
34 | <property name="dx" value="${android-tools}/dx" /> |
93 | </condition> |
35 | <property name="adb" value="${android-tools}/adb" /> |
94 | |
36 | <property name="android-jar" value="${sdk-folder}/android.jar" /> |
95 | <property name="android-jar" value="${sdk-folder}/android.jar" /> |
Line 37... | Line 96... | ||
37 | <property name="zip" value="zip" /> |
96 | |
38 | 97 | <!-- Rules --> |
|
39 | <!-- Rules --> |
98 | |
40 | 99 | <!-- Create the output directories if they don't exist yet. --> |
|
41 | <!-- Create the output directories if they don't exist yet. --> |
100 | <target name="dirs"> |
42 | <target name="dirs"> |
101 | <echo>Creating output directories if needed...</echo> |
43 | <mkdir dir="${outdir}" /> |
102 | <mkdir dir="${outdir}" /> |
44 | <mkdir dir="${outdir-classes}" /> |
103 | <mkdir dir="${outdir-classes}" /> |
45 | </target> |
104 | </target> |
46 | 105 | ||
Line 61... | Line 120... | ||
61 | </exec> |
120 | </exec> |
62 | </target> |
121 | </target> |
Line 63... | Line 122... | ||
63 | 122 | ||
64 | <!-- Generate java classes from .aidl files. --> |
123 | <!-- Generate java classes from .aidl files. --> |
- | 124 | <target name="aidl" depends="dirs"> |
|
65 | <target name="aidl" depends="dirs"> |
125 | <echo>Compiling aidl files into Java classes...</echo> |
66 | <apply executable="${aidl}" failonerror="true"> |
126 | <apply executable="${aidl}" failonerror="true"> |
67 | <arg value="-p${android-framework}" /> |
127 | <arg value="-p${android-framework}" /> |
68 | <arg value="-I${srcdir}" /> |
128 | <arg value="-I${srcdir}" /> |
69 | <fileset dir="${srcdir}"> |
129 | <fileset dir="${srcdir}"> |
Line 75... | Line 135... | ||
75 | <!-- Compile this project's .java files into .class files. --> |
135 | <!-- Compile this project's .java files into .class files. --> |
76 | <target name="compile" depends="dirs, resource-src, aidl"> |
136 | <target name="compile" depends="dirs, resource-src, aidl"> |
77 | <javac encoding="ascii" target="1.5" debug="true" extdirs="" |
137 | <javac encoding="ascii" target="1.5" debug="true" extdirs="" |
78 | srcdir="." |
138 | srcdir="." |
79 | destdir="${outdir-classes}" |
139 | destdir="${outdir-classes}" |
80 | bootclasspath="${android-jar}" /> |
140 | bootclasspath="${android-jar}"> |
- | 141 | <classpath> |
|
- | 142 | <fileset dir="${external-libs}" includes="*.jar"/> |
|
- | 143 | </classpath> |
|
- | 144 | </javac> |
|
81 | </target> |
145 | </target> |
Line 82... | Line 146... | ||
82 | 146 | ||
83 | <!-- Convert this project's .class files into .dex files. --> |
147 | <!-- Convert this project's .class files into .dex files. --> |
84 | <target name="dex" depends="compile"> |
148 | <target name="dex" depends="compile"> |
85 | <exec executable="${dx}" failonerror="true"> |
149 | <echo>Converting compiled files and external libraries into ${outdir}/${dex-file}...</echo> |
86 | <arg value="-JXmx384M" /> |
150 | <apply executable="${dx}" failonerror="true" parallel="true"> |
87 | <arg value="--dex" /> |
151 | <arg value="--dex" /> |
88 | <arg value="--output=${basedir}/${intermediate-dex}" /> |
- | |
89 | <arg value="--locals=full" /> |
152 | <arg value="--output=${intermediate-dex-ospath}" /> |
90 | <arg value="--positions=lines" /> |
153 | <arg path="${outdir-classes-ospath}" /> |
91 | <arg path="${basedir}/${outdir-classes}" /> |
154 | <fileset dir="${external-libs}" includes="*.jar"/> |
92 | </exec> |
155 | </apply> |
Line 93... | Line 156... | ||
93 | </target> |
156 | </target> |
94 | 157 | ||
95 | <!-- Put the project's resources into the output package file. --> |
158 | <!-- Put the project's resources into the output package file. --> |
96 | <target name="package-res-and-assets"> |
159 | <target name="package-res-and-assets"> |
97 | <echo>Packaging resources and assets...</echo> |
160 | <echo>Packaging resources and assets...</echo> |
98 | <exec executable="${aapt}" failonerror="true"> |
161 | <exec executable="${aapt}" failonerror="true"> |
99 | <arg value="package" /> |
- | |
100 | <arg value="-f" /> |
162 | <arg value="package" /> |
101 | <arg value="-c" /> |
163 | <arg value="-f" /> |
102 | <arg value="-M" /> |
164 | <arg value="-M" /> |
103 | <arg value="AndroidManifest.xml" /> |
165 | <arg value="AndroidManifest.xml" /> |
104 | <arg value="-S" /> |
166 | <arg value="-S" /> |
105 | <arg value="${resource-dir}" /> |
167 | <arg value="${resource-dir}" /> |
106 | <arg value="-A" /> |
168 | <arg value="-A" /> |
107 | <arg value="${asset-dir}" /> |
169 | <arg value="${asset-dir}" /> |
- | 170 | <arg value="-I" /> |
|
108 | <arg value="-I" /> |
171 | <arg value="${android-jar}" /> |
109 | <arg value="${android-jar}" /> |
172 | <arg value="-F" /> |
110 | <arg value="${out-package}" /> |
173 | <arg value="${resources-package}" /> |
Line 111... | Line 174... | ||
111 | </exec> |
174 | </exec> |
112 | </target> |
175 | </target> |
113 | 176 | ||
114 | <!-- Same as package-res-and-assets, but without "-A ${asset-dir}" --> |
177 | <!-- Same as package-res-and-assets, but without "-A ${asset-dir}" --> |
115 | <target name="package-res-no-assets"> |
178 | <target name="package-res-no-assets"> |
116 | <echo>Packaging resources...</echo> |
179 | <echo>Packaging resources...</echo> |
117 | <exec executable="${aapt}" failonerror="true"> |
- | |
118 | <arg value="package" /> |
180 | <exec executable="${aapt}" failonerror="true"> |
119 | <arg value="-f" /> |
181 | <arg value="package" /> |
120 | <arg value="-c" /> |
182 | <arg value="-f" /> |
121 | <arg value="-M" /> |
183 | <arg value="-M" /> |
122 | <arg value="AndroidManifest.xml" /> |
184 | <arg value="AndroidManifest.xml" /> |
123 | <arg value="-S" /> |
185 | <arg value="-S" /> |
124 | <arg value="${resource-dir}" /> |
186 | <arg value="${resource-dir}" /> |
- | 187 | <!-- No assets directory --> |
|
125 | <!-- No assets directory --> |
188 | <arg value="-I" /> |
126 | <arg value="-I" /> |
189 | <arg value="${android-jar}" /> |
127 | <arg value="${android-jar}" /> |
190 | <arg value="-F" /> |
Line 128... | Line 191... | ||
128 | <arg value="${out-package}" /> |
191 | <arg value="${resources-package}" /> |
129 | </exec> |
192 | </exec> |
Line 138... | Line 201... | ||
138 | property="res-target" value="and-assets" /> |
201 | property="res-target" value="and-assets" /> |
139 | <property name="res-target" value="no-assets" /> |
202 | <property name="res-target" value="no-assets" /> |
140 | <antcall target="package-res-${res-target}" /> |
203 | <antcall target="package-res-${res-target}" /> |
141 | </target> |
204 | </target> |
Line 142... | Line 205... | ||
142 | 205 | ||
- | 206 | <!-- Package the application and sign it with a debug key. |
|
143 | <!-- Put the project's .class files into the output package file. --> |
207 | This is the default target when building. It is used for debug. --> |
- | 208 | <target name="debug" depends="dex, package-res"> |
|
- | 209 | <echo>Packaging ${out-debug-package}, and signing it with a debug key...</echo> |
|
- | 210 | <exec executable="${apk-builder}" failonerror="true"> |
|
144 | <target name="package-java" depends="compile, package-res"> |
211 | <arg value="${out-debug-package-ospath}" /> |
145 | <echo>Packaging java...</echo> |
212 | <arg value="-z" /> |
- | 213 | <arg value="${resources-package-ospath}" /> |
|
- | 214 | <arg value="-f" /> |
|
- | 215 | <arg value="${intermediate-dex-ospath}" /> |
|
146 | <jar destfile="${out-package}" |
216 | <arg value="-rf" /> |
147 | basedir="${outdir-classes}" |
217 | <arg value="${srcdir-ospath}" /> |
- | 218 | <arg value="-rj" /> |
|
- | 219 | <arg value="${external-libs-ospath}" /> |
|
148 | update="true" /> |
220 | </exec> |
149 | </target> |
221 | </target> |
150 | 222 | ||
151 | <!-- Put the project's .dex files into the output package file. |
223 | <!-- Package the application without signing it. |
- | 224 | This allows for the application to be signed later with an official publishing key. --> |
|
152 | Use the "zip" command, available on most un*x/Linux/MacOS systems, |
225 | <target name="release" depends="dex, package-res"> |
153 | to create the new package (Ant 1.7 has an internal 'zip' command, |
226 | <echo>Packaging ${out-unsigned-package} for release...</echo> |
- | 227 | <exec executable="${apk-builder}" failonerror="true"> |
|
- | 228 | <arg value="${out-unsigned-package-ospath}" /> |
|
154 | however Ant 1.6.5 lacks it and is still widely installed.) |
229 | <arg value="-u" /> |
155 | --> |
230 | <arg value="-z" /> |
156 | <target name="package-dex" depends="dex, package-res"> |
231 | <arg value="${resources-package-ospath}" /> |
157 | <echo>Packaging dex...</echo> |
232 | <arg value="-f" /> |
158 | <exec executable="${zip}" failonerror="true"> |
233 | <arg value="${intermediate-dex-ospath}" /> |
159 | <arg value="-qj" /> |
234 | <arg value="-rf" /> |
- | 235 | <arg value="${srcdir-ospath}" /> |
|
160 | <arg value="${out-package}" /> |
236 | <arg value="-rj" /> |
161 | <arg value="${intermediate-dex}" /> |
237 | <arg value="${external-libs-ospath}" /> |
- | 238 | </exec> |
|
162 | </exec> |
239 | <echo>It will need to be signed with jarsigner before being published.</echo> |
Line 163... | Line -... | ||
163 | </target> |
- | |
164 | - | ||
165 | <!-- Create the package file for this project from the sources. --> |
- | |
166 | <target name="package" depends="package-dex" /> |
240 | </target> |
167 | 241 | ||
168 | <!-- Create the package and install package on the default emulator --> |
242 | <!-- Install the package on the default emulator --> |
169 | <target name="install" depends="package"> |
243 | <target name="install" depends="debug"> |
170 | <echo>Sending package to default emulator...</echo> |
244 | <echo>Installing ${out-debug-package} onto default emulator...</echo> |
171 | <exec executable="${adb}" failonerror="true"> |
245 | <exec executable="${adb}" failonerror="true"> |
- | 246 | <arg value="install" /> |
|
- | 247 | <arg value="${out-debug-package}" /> |
|
- | 248 | </exec> |
|
- | 249 | </target> |
|
- | 250 | ||
- | 251 | <target name="reinstall" depends="debug"> |
|
- | 252 | <echo>Installing ${out-debug-package} onto default emulator...</echo> |
|
- | 253 | <exec executable="${adb}" failonerror="true"> |
|
- | 254 | <arg value="install" /> |
|
- | 255 | <arg value="-r" /> |
|
- | 256 | <arg value="${out-debug-package}" /> |
|
- | 257 | </exec> |
|
- | 258 | </target> |
|
- | 259 | ||
- | 260 | <!-- Uinstall the package from the default emulator --> |
|
- | 261 | <target name="uninstall"> |
|
- | 262 | <echo>Uninstalling ${application-package} from the default emulator...</echo> |
|
- | 263 | <exec executable="${adb}" failonerror="true"> |
|
172 | <arg value="install" /> |
264 | <arg value="uninstall" /> |
173 | <arg value="${out-package}" /> |
265 | <arg value="${application-package}" /> |
Line 174... | Line 266... | ||
174 | </exec> |
266 | </exec> |