-
Notifications
You must be signed in to change notification settings - Fork 17
/
build.xml
474 lines (337 loc) · 12.1 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
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
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
<?xml version="1.0" encoding="UTF-8"?>
<project
name="opentasks-provider"
basedir="."
default="build" >
<!--
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.
-->
<property file="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" />
<!--
if sdk.dir was not set from one of the property file, then
get it from the ANDROID_HOME env var.
This must be done before we load project.properties since
the proguard config can use sdk.dir
-->
<property environment="env" />
<condition
property="sdk.dir"
value="${env.ANDROID_HOME}" >
<isset property="env.ANDROID_HOME" />
</condition>
<!--
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' or to inject it through the ANDROID_HOME environment variable."
unless="sdk.dir" />
<!--
Import per project custom build rules if present at the root of the project.
This is the place to put custom intermediary targets such as:
-pre-build
-pre-compile
-post-compile (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})
-post-package
-post-build
-pre-clean
-->
<import
file="custom_rules.xml"
optional="true" />
<!--
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" />
<property
name="base.dir"
value="${basedir}" />
<property
name="dist.dir"
value="${basedir}/dist" />
<property
name="src.dir"
value="${basedir}/src" />
<property
name="jar.dir"
value="${dist.dir}/lib" />
<!-- define Maven coordinates -->
<property
name="groupId"
value="org.dmfs" />
<property
name="artifactId"
value="${ant.project.name}" />
<!-- defined maven snapshots and staging repository id and url -->
<property
name="ossrh-snapshots-repository-url"
value="https://oss.sonatype.org/content/repositories/snapshots/" />
<property
name="ossrh-staging-repository-url"
value="https://oss.sonatype.org/service/local/staging/deploy/maven2/" />
<!-- there server id in the Maven settings.xml -->
<property
name="ossrh-server-id"
value="ossrh" />
<path id="libraryclasspath" >
<fileset
dir="libs"
includes="*.jar" />
</path>
<path id="classpath" >
<pathelement location="bin/classes" />
<path refid="libraryclasspath" />
</path>
<available
file=".git"
property="git.present"
type="dir" />
<target
name="gitinfo"
description="determine git properties"
if="git.present" >
<exec
errorproperty=""
executable="git"
failifexecutionfails="false"
outputproperty="git.commithash" >
<arg value="rev-parse" />
<arg value="HEAD" />
</exec>
<exec
errorproperty=""
executable="git"
failifexecutionfails="false"
outputproperty="git.repo" >
<arg value="config" />
<arg value="--get" />
<arg value="remote.github.url" />
</exec>
<exec
errorproperty=""
executable="git"
failifexecutionfails="false"
outputproperty="git.tag" >
<arg value="describe" />
<arg value="--abbrev=0" />
<arg value="--tags" />
</exec>
<exec
errorproperty=""
executable="git"
failifexecutionfails="false"
outputproperty="git.user.email" >
<arg value="config" />
<arg value="user.email" />
</exec>
<condition
else="${version}"
property="git.tag"
value="${git.tag}" >
<and>
<isset property="git.tag" />
<length
length="0"
string="${git.tag}"
trim="yes"
when="greater" />
</and>
</condition>
<property
name="jar"
value="${jar.dir}/${artifactId}-${git.tag}.jar" />
<property
name="javadoc-jar"
value="${jar.dir}/${artifactId}-${git.tag}-javadoc.jar" />
<property
name="sources-jar"
value="${jar.dir}/${artifactId}-${git.tag}-sources.jar" />
</target>
<!-- Compile project -->
<target name="compile" >
<path id="project.javac.classpath" >
<path path="${sdk.dir}/platforms/android-22/android.jar" />
<path refid="libraryclasspath" />
<path path="${java.compiler.classpath}" />
</path>
<javac
includeantruntime="false"
source="1.7"
srcdir="${src.dir}"
target="1.7" >
<classpath refid="project.javac.classpath" />
</javac>
</target>
<target
name="jar"
depends="compile,gitinfo" >
<delete file="${jar.dir}/${name}.jar" />
<buildnumber file=".build" />
<manifest file="MANIFEST.MF" >
<attribute
name="Git-Release-Hash"
value="${git.commithash}" />
<attribute
name="Git-Release-Tag"
value="${git.tag}" />
<attribute
name="Built-By"
value="${git.user.email}" />
<attribute
name="Implementation-Version"
value="${git.tag}-${build.number}" />
</manifest>
<jar
basedir="${src.dir}"
destfile="${jar}"
includes="**/*.class **/*.java"
manifest="MANIFEST.MF" >
<metainf
dir="${basedir}"
includes="NOTICE" />
<metainf
dir="${basedir}"
includes="LICENSE" />
</jar>
</target>
<target
name="dist"
depends="jar" >
<!-- build the javadoc jar -->
<javadoc
destdir="${dist.dir}/javadoc"
sourcepath="${src.dir}" >
<classpath>
<path refid="classpath" />
</classpath>
</javadoc>
<jar
jarfile="${javadoc-jar}"
manifest="MANIFEST.MF" >
<fileset dir="${dist.dir}/javadoc" />
<metainf
dir="${basedir}"
includes="NOTICE" />
<metainf
dir="${basedir}"
includes="LICENSE" />
</jar>
<!-- build the sources jar -->
<jar
jarfile="${sources-jar}"
manifest="MANIFEST.MF" >
<fileset dir="${src.dir}" />
<metainf
dir="${basedir}"
includes="NOTICE" />
<metainf
dir="${basedir}"
includes="LICENSE" />
</jar>
</target>
<target name="cleanup" >
<delete>
<fileset
dir="."
includes="**/*.class" />
<fileset file="MANIFEST.MF" />
</delete>
<delete dir="${dist.dir}" />
</target>
<target
name="build"
depends="jar,cleanup" />
<target
name="deploy"
depends="dist"
description="deploy snapshot version to Maven snapshot repository" >
<exec executable="mvn" >
<arg value="org.apache.maven.plugins:maven-deploy-plugin:2.6:deploy-file" />
<arg value="-Durl=${ossrh-snapshots-repository-url}" />
<arg value="-DrepositoryId=${ossrh-server-id}" />
<arg value="-DpomFile=pom.xml" />
<arg value="-Dfile=${jar}" />
</exec>
</target>
<!--
before this, update project version (both build.xml and pom.xml) from
SNAPSHOT to RELEASE
-->
<target
name="stage"
depends="dist"
description="deploy release version to Maven staging repository" >
<!-- sign and deploy the main artifact -->
<exec executable="mvn" >
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${ossrh-staging-repository-url}" />
<arg value="-DrepositoryId=${ossrh-server-id}" />
<arg value="-DpomFile=pom.xml" />
<arg value="-Dfile=${jar}" />
<arg value="-Pgpg" />
</exec>
<!-- sign and deploy the sources artifact -->
<exec executable="mvn" >
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${ossrh-staging-repository-url}" />
<arg value="-DrepositoryId=${ossrh-server-id}" />
<arg value="-DpomFile=pom.xml" />
<arg value="-Dfile=${sources-jar}" />
<arg value="-Dclassifier=sources" />
<arg value="-Pgpg" />
</exec>
<!-- sign and deploy the javadoc artifact -->
<exec executable="mvn" >
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${ossrh-staging-repository-url}" />
<arg value="-DrepositoryId=${ossrh-server-id}" />
<arg value="-DpomFile=pom.xml" />
<arg value="-Dfile=${javadoc-jar}" />
<arg value="-Dclassifier=javadoc" />
<arg value="-Pgpg" />
</exec>
</target>
</project>