2 <project name="MapView" default="debug">
4 <!-- The build.properties file can be created by you and is never touched
5 by activitycreator. If you want to manually set properties, this is
6 the best place to set them. -->
7 <property file="build.properties"/>
9 <!-- The default.properties file is created and updated by activitycreator.
10 It will set any properties not already defined by build.properties. -->
11 <property file="default.properties"/>
13 <!-- ************************************************************************************* -->
14 <!-- These settings were written by activitycreator.
15 Do not change them unless you really know what you are doing. -->
17 <!-- Application Package Name -->
18 <property name="application-package" value="org.technomancy.osm.viewmap" />
20 <!-- The intermediates directory, Eclipse uses "bin"
21 for its own output, so we do the same. -->
22 <property name="outdir" value="bin" />
24 <!-- ************************************************************************************* -->
25 <!-- No user servicable parts below. -->
27 <property name="android-tools" value="${sdk-folder}/tools" />
28 <property name="android-framework" value="${android-tools}/lib/framework.aidl" />
30 <!-- Input directories -->
31 <property name="resource-dir" value="res" />
32 <property name="asset-dir" value="assets" />
33 <property name="srcdir" value="src" />
34 <condition property="srcdir-ospath"
35 value="${basedir}\${srcdir}"
36 else="${basedir}/${srcdir}" >
37 <os family="windows"/>
40 <!-- folder for the 3rd party java libraries -->
41 <property name="external-libs" value="libs" />
42 <condition property="external-libs-ospath"
43 value="${basedir}\${external-libs}"
44 else="${basedir}/${external-libs}" >
45 <os family="windows"/>
48 <!-- folder for the native libraries -->
49 <property name="native-libs" value="libs" />
50 <condition property="native-libs-ospath"
51 value="${basedir}\${native-libs}"
52 else="${basedir}/${native-libs}" >
53 <os family="windows"/>
56 <!-- Output directories -->
57 <property name="outdir-classes" value="${outdir}/classes" />
58 <condition property="outdir-classes-ospath"
59 value="${basedir}\${outdir-classes}"
60 else="${basedir}/${outdir-classes}" >
61 <os family="windows"/>
64 <!-- Create R.java in the source directory -->
65 <property name="outdir-r" value="src" />
67 <!-- Intermediate files -->
68 <property name="dex-file" value="classes.dex" />
69 <property name="intermediate-dex" value="${outdir}/${dex-file}" />
70 <condition property="intermediate-dex-ospath"
71 value="${basedir}\${intermediate-dex}"
72 else="${basedir}/${intermediate-dex}" >
73 <os family="windows"/>
76 <!-- The final package file to generate -->
77 <property name="resources-package" value="${outdir}/${ant.project.name}.ap_" />
78 <condition property="resources-package-ospath"
79 value="${basedir}\${resources-package}"
80 else="${basedir}/${resources-package}" >
81 <os family="windows"/>
84 <property name="out-debug-package" value="${outdir}/${ant.project.name}-debug.apk" />
85 <condition property="out-debug-package-ospath"
86 value="${basedir}\${out-debug-package}"
87 else="${basedir}/${out-debug-package}" >
88 <os family="windows"/>
91 <property name="out-unsigned-package" value="${outdir}/${ant.project.name}-unsigned.apk" />
92 <condition property="out-unsigned-package-ospath"
93 value="${basedir}\${out-unsigned-package}"
94 else="${basedir}/${out-unsigned-package}" >
95 <os family="windows"/>
99 <condition property="aapt" value="${android-tools}/aapt.exe" else="${android-tools}/aapt" >
100 <os family="windows"/>
102 <condition property="aidl" value="${android-tools}/aidl.exe" else="${android-tools}/aidl" >
103 <os family="windows"/>
105 <condition property="adb" value="${android-tools}/adb.exe" else="${android-tools}/adb" >
106 <os family="windows"/>
108 <condition property="dx" value="${android-tools}/dx.bat" else="${android-tools}/dx" >
109 <os family="windows"/>
111 <condition property="apk-builder" value="${android-tools}/apkbuilder.bat" else="${android-tools}/apkbuilder" >
112 <os family="windows"/>
115 <property name="android-jar" value="${sdk-folder}/android.jar" />
119 <!-- Create the output directories if they don't exist yet. -->
121 <echo>Creating output directories if needed...</echo>
122 <mkdir dir="${outdir}" />
123 <mkdir dir="${outdir-classes}" />
126 <!-- Generate the R.java file for this project's resources. -->
127 <target name="resource-src" depends="dirs">
128 <echo>Generating R.java / Manifest.java from the resources...</echo>
129 <exec executable="${aapt}" failonerror="true">
130 <arg value="package" />
133 <arg value="${outdir-r}" />
135 <arg value="AndroidManifest.xml" />
137 <arg value="${resource-dir}" />
139 <arg value="${android-jar}" />
143 <!-- Generate java classes from .aidl files. -->
144 <target name="aidl" depends="dirs">
145 <echo>Compiling aidl files into Java classes...</echo>
146 <apply executable="${aidl}" failonerror="true">
147 <arg value="-p${android-framework}" />
148 <arg value="-I${srcdir}" />
149 <fileset dir="${srcdir}">
150 <include name="**/*.aidl"/>
155 <!-- Compile this project's .java files into .class files. -->
156 <target name="compile" depends="dirs, resource-src, aidl">
157 <javac encoding="ascii" target="1.5" debug="true" extdirs=""
159 destdir="${outdir-classes}"
160 bootclasspath="${android-jar}">
162 <fileset dir="${external-libs}" includes="*.jar"/>
167 <!-- Convert this project's .class files into .dex files. -->
168 <target name="dex" depends="compile">
169 <echo>Converting compiled files and external libraries into ${outdir}/${dex-file}...</echo>
170 <apply executable="${dx}" failonerror="true" parallel="true">
171 <arg value="--dex" />
172 <arg value="--output=${intermediate-dex-ospath}" />
173 <arg path="${outdir-classes-ospath}" />
174 <fileset dir="${external-libs}" includes="*.jar"/>
178 <!-- Put the project's resources into the output package file. -->
179 <target name="package-res-and-assets">
180 <echo>Packaging resources and assets...</echo>
181 <exec executable="${aapt}" failonerror="true">
182 <arg value="package" />
185 <arg value="AndroidManifest.xml" />
187 <arg value="${resource-dir}" />
189 <arg value="${asset-dir}" />
191 <arg value="${android-jar}" />
193 <arg value="${resources-package}" />
197 <!-- Same as package-res-and-assets, but without "-A ${asset-dir}" -->
198 <target name="package-res-no-assets">
199 <echo>Packaging resources...</echo>
200 <exec executable="${aapt}" failonerror="true">
201 <arg value="package" />
204 <arg value="AndroidManifest.xml" />
206 <arg value="${resource-dir}" />
207 <!-- No assets directory -->
209 <arg value="${android-jar}" />
211 <arg value="${resources-package}" />
215 <!-- Invoke the proper target depending on whether or not
216 an assets directory is present. -->
217 <!-- TODO: find a nicer way to include the "-A ${asset-dir}" argument
218 only when the assets dir exists. -->
219 <target name="package-res">
220 <available file="${asset-dir}" type="dir"
221 property="res-target" value="and-assets" />
222 <property name="res-target" value="no-assets" />
223 <antcall target="package-res-${res-target}" />
226 <!-- Package the application and sign it with a debug key.
227 This is the default target when building. It is used for debug. -->
228 <target name="debug" depends="dex, package-res">
229 <echo>Packaging ${out-debug-package}, and signing it with a debug key...</echo>
230 <exec executable="${apk-builder}" failonerror="true">
231 <arg value="${out-debug-package-ospath}" />
233 <arg value="${resources-package-ospath}" />
235 <arg value="${intermediate-dex-ospath}" />
237 <arg value="${srcdir-ospath}" />
239 <arg value="${external-libs-ospath}" />
241 <arg value="${native-libs-ospath}" />
245 <!-- Package the application without signing it.
246 This allows for the application to be signed later with an official publishing key. -->
247 <target name="release" depends="dex, package-res">
248 <echo>Packaging ${out-unsigned-package} for release...</echo>
249 <exec executable="${apk-builder}" failonerror="true">
250 <arg value="${out-unsigned-package-ospath}" />
253 <arg value="${resources-package-ospath}" />
255 <arg value="${intermediate-dex-ospath}" />
257 <arg value="${srcdir-ospath}" />
259 <arg value="${external-libs-ospath}" />
261 <arg value="${native-libs-ospath}" />
263 <echo>It will need to be signed with jarsigner before being published.</echo>
266 <!-- Install the package on the default emulator -->
267 <target name="install" depends="debug">
268 <echo>Installing ${out-debug-package} onto default emulator...</echo>
269 <exec executable="${adb}" failonerror="true">
270 <arg value="install" />
271 <arg value="${out-debug-package}" />
275 <target name="reinstall" depends="debug">
276 <echo>Installing ${out-debug-package} onto default emulator...</echo>
277 <exec executable="${adb}" failonerror="true">
278 <arg value="install" />
280 <arg value="${out-debug-package}" />
284 <!-- Uinstall the package from the default emulator -->
285 <target name="uninstall">
286 <echo>Uninstalling ${application-package} from the default emulator...</echo>
287 <exec executable="${adb}" failonerror="true">
288 <arg value="uninstall" />
289 <arg value="${application-package}" />