-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
345 lines (256 loc) · 11.5 KB
/
build.xml
File metadata and controls
345 lines (256 loc) · 11.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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
<?xml version="1.0" encoding="UTF-8"?>
<project name="wificompass" default="help">
<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked into
Version Control Systems. -->
<loadproperties srcFile="local.properties" />
<!-- The ant.properties file can be created by you. It is only edited by the
'android' tool to add properties to it.
This is the place to change some Ant specific build properties.
Here are some properties you may want to change/update:
source.dir
The name of the source directory. Default is 'src'.
out.dir
The name of the output directory. Default is 'bin'.
For other overridable properties, look at the beginning of the rules
files in the SDK, at tools/ant/build.xml
Properties related to the SDK location or the project target should
be updated using the 'android' tool with the 'update' action.
This file is an integral part of the build system for your
application and should be checked into Version Control Systems.
-->
<property file="ant.properties" />
<!-- The project.properties file is created and updated by the 'android'
tool, as well as ADT.
This contains project specific properties such as project target, and library
dependencies. Lower level build properties are stored in ant.properties
(or in .classpath for Eclipse projects).
This file is an integral part of the build system for your
application and should be checked into Version Control Systems. -->
<loadproperties srcFile="project.properties" />
<!-- quick check on sdk.dir -->
<fail message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'" unless="sdk.dir" />
<property name="key.store" value="key.store" />
<property name="key.alias" value="release-key" />
<!--<isset property="key.store.password" />
<isset property="key.alias.password" />-->
<property name="project.base.dir" value="." />
<property name="package.name" value="at.fhstp.wificompass" />
<property name="package.mainactivity" value=".activities.MainActivity" />
<!--<property environment="env" />-->
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="lib/ant-contrib-1.0b3.jar" />
</classpath>
</taskdef>
<taskdef classname="net.bluecow.googlecode.ant.GoogleCodeUploadTask" classpath="lib/ant-googlecode-0.0.3.jar" name="gcupload" />
<property name="file.credentials" value="credentials.xml" />
<target name="git-or-svn">
<exec executable="git" resultproperty="git.rc" outputproperty="git.output">
<arg line="status" />
</exec>
<if>
<condition>
<equals arg1="${git.rc}" arg2="0" />
</condition>
<then>
<echo>Hey, you're running git!</echo>
<property name="vcs.name" value="git" />
</then>
<else>
<property name="vcs.name" value="svn" />
</else>
</if>
</target>
<target name="get-version" depends="git-or-svn">
<if>
<condition>
<equals arg1="${vcs.name}" arg2="svn" />
</condition>
<then>
<exec executable="svn" output="svninfo.xml">
<arg line="info --xml ${project.base.dir}" />
</exec>
<xmlproperty file="svninfo.xml" prefix="svn" collapseattributes="true" />
<delete file="svninfo.xml" />
<!--<echoproperties/>-->
<property name="vcs.revision" value="${svn.info.entry.revision}" />
<property name="vcs.date" value="${svn.info.entry.commit.date}" />
<property name="vcs.url" value="${svn.info.entry.url}" />
<property name="vcs.shortrevision" value="${svn.info.entry.revision}" />
</then>
<else>
<!-- git -->
<exec executable="git" output="git.properties">
<arg line="log -1 --pretty="git.version=%H%ngit.date=%cD%ngit.commiter=%cn%ngit.shortversion=%h"" />
</exec>
<loadproperties srcFile="git.properties" />
<delete file="git.properties" />
<property name="vcs.revision" value="${git.version}" />
<property name="vcs.date" value="${git.date}" />
<property name="vcs.url" value="https://code.google.com/p/wificompass/" />
<property name="vcs.shortrevision" value="${git.shortversion}" />
</else>
</if>
<echo>Current Revision: ${vcs.revision}
Short Revision: ${vcs.shortrevision}
Last Commit Date: ${vcs.date}
Repository Url: ${vcs.url}
</echo>
</target>
<target name="generate-version" depends="get-version">
<echo>Generate build info class...</echo>
<!-- the source code of the java class -->
<echo file="${basedir}/gen/at/fhstp/wificompass/BuildInfo.java">
package at.fhstp.wificompass;
public class BuildInfo {
public static final String revision="${vcs.revision}";
public static final String shortRevision="${vcs.shortrevision}";
public static final String commitDate="${vcs.date}";
public static final String repositoryURL="${vcs.url}";
}
</echo>
</target>
<target name="upload-nightly" depends="release, check-credentials">
<!-- create a nightly build an upload it to the google project site -->
<echo>uploading nightly build to google code...</echo>
<echo>Remember to delete the old nightly file, because overwrite is not possible!</echo>
<gcupload username="${credentials.google.username}" password="${credentials.google.password}" projectname="wificompass" filename="bin/wificompass-release.apk" targetfilename="wificompass-nightly.apk" summary="Nightly build of wificompass" labels="Type-Package, OpSys-Android" verbose="true" />
<echo>done.</echo>
</target>
<target name="upload-with-version" depends="release, get-version, check-credentials">
<!-- create a nightly build an upload it to the google project site -->
<echo>uploading nightly build to google code...</echo>
<echo>Remember to delete the old nightly file, because overwrite is not possible!</echo>
<gcupload username="${credentials.google.username}" password="${credentials.google.password}" projectname="wificompass" filename="bin/wificompass-release.apk" targetfilename="wificompass-${vcs.shortrevision}.apk" summary="build of wificompass, version ${vcs.revision}" labels="Featured, Type-Package, OpSys-Android" verbose="true" />
<echo>done.</echo>
</target>
<target name="check-credentials">
<if>
<condition>
<not>
<available file="${file.credentials}" />
</not>
</condition>
<then>
<echo>google credential file not found, creating it</echo>
<antcall target="create-credentials-file" />
</then>
</if>
<xmlproperty file="${file.credentials}" collapseattributes="true" />
<!-- quick check on username and password -->
<fail message="googlecode username or password is missing. Make sure to fill in your credentials for google code in ${file.credentials}">
<condition>
<or>
<not>
<isset property="credentials.google.username" />
</not>
<not>
<isset property="credentials.google.password" />
</not>
<equals arg1="${credentials.google.username}" arg2="" />
<equals arg1="${credentials.google.password}" arg2="" />
</or>
</condition>
</fail>
</target>
<target name="create-credentials-file">
<echo file="${file.credentials}">
<![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<credentials>
<google>
<username></username>
<password></password>
</google>
<keystore>
<password></password>
<alias-password></alias-password>
</keystore>
</credentials>
rd></alias-password>
</keystore>
]]></echo>
<fail message="googlecode username and password is missing. Make sure to fill in your credentials for google code in ${file.credentials}" />
</target>
<target name="load-keypass-credentials" depends="check-credentials">
<property name="key.store.password" value="${credentials.keystore.password}"/>
<property name="key.alias.password" value="${credentials.keystore.alias-password}" />
</target>
<target name="run-debug" depends="debug, installd, run" />
<target name="run-release" depends="release, installr, run" />
<target name="run">
<exec executable="${sdk.dir}/platform-tools/adb">
<arg value="shell" />
<arg value="am" />
<arg value="start" />
<arg value="-a" />
<arg value="android.intent.action.MAIN" />
<arg value="-n" />
<arg value="${package.name}/${package.mainactivity}" />
</exec>
</target>
<!-- extension targets. Uncomment the ones where you want to do custom work
in between standard targets -->
<target name="-pre-build" depends="generate-version" />
<!-- <target name="-pre-build" depends="generate-version">
</target>-->
<!-- <target name="-pre-compile" >
</target>
<
/* This is typically used for code obfuscation.
Compiled code location: ${out.classes.absolute.dir}
If this is not done in place, override ${out.dex.input.absolute.dir} */
<target name="-post-compile">
</target>
-->
<!-- now we use two lib dirs. one which will automatically included in android builds (libs) and one (lib) which holds ant tasks and sources aso
<property name="jar.libs.dir" value="lib" /> -->
<!-- This runs -package-release and -release-nosign first and then runs
only if release-sign is true (set in -release-check,
called by -release-no-sign)-->
<target name="release"
depends="-set-release-mode, -release-obfuscation-check, -package, load-keypass-credentials, -release-prompt-for-password, -release-nosign"
if="has.keystore"
description="Builds the application. The generated apk file must be signed before
it is published.">
<!-- only create apk if *not* a library project -->
<do-only-if-not-library elseText="Library project: do not create apk..." >
<sequential>
<property name="out.unaligned.file" location="${out.absolute.dir}/${ant.project.name}-release-unaligned.apk" />
<!-- Signs the APK -->
<echo>Signing final apk...</echo>
<signjar
jar="${out.packaged.file}"
signedjar="${out.unaligned.file}"
keystore="${key.store}"
storepass="${key.store.password}"
alias="${key.alias}"
keypass="${key.alias.password}"
verbose="${verbose}" />
<!-- Zip aligns the APK -->
<zipalign-helper in.package="${out.unaligned.file}"
out.package="${out.final.file}" />
<echo>Release Package: ${out.final.file}</echo>
</sequential>
</do-only-if-not-library>
<record-build-info />
</target>
<!-- Import the actual build file.
To customize existing targets, there are two options:
- Customize only one target:
- copy/paste the target into this file, *before* the
<import> task.
- customize it to your needs.
- Customize the whole content of build.xml
- copy/paste the content of the rules files (minus the top node)
into this file, replacing the <import> task.
- customize to your needs.
***********************
****** IMPORTANT ******
***********************
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
in order to avoid having your file be overridden by tools such as "android update project"
-->
<!-- version-tag: 1 -->
<import file="${sdk.dir}/tools/ant/build.xml" />
</project>