-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.xml
168 lines (123 loc) · 6.29 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="smarttrail">
<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked in in Version
Control Systems. -->
<property file="local.properties" />
<!-- The build.properties file can be created by you and is never touched
by the 'android' tool. This is the place to change some of the default property values
used by the Ant rules.
Here are some properties you may want to change/update:
application.package
the name of your application package as defined in the manifest. Used by the
'uninstall' rule.
source.dir
the name of the source directory. Default is 'src'.
out.dir
the name of the output directory. Default is 'bin'.
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 in in Version Control Systems.
-->
<property file="../secure.properties" />
<property file="build.properties" />
<!-- The default.properties file is created and updated by the 'android' tool, as well
as ADT.
This file is an integral part of the build system for your application and
should be checked in in Version Control Systems. -->
<property file="default.properties" />
<!-- Custom Android task to deal with the project target, and import the proper rules.
This requires ant 1.6.0 or above. -->
<path id="android.antlibs">
<pathelement path="${sdk.dir}/tools/lib/anttasks.jar" />
<pathelement path="${sdk.dir}/tools/lib/sdklib.jar" />
<pathelement path="${sdk.dir}/tools/lib/androidprefs.jar" />
<pathelement path="${sdk.dir}/tools/lib/apkbuilder.jar" />
<pathelement path="${sdk.dir}/tools/lib/jarutils.jar" />
</path>
<!-- run the ant timestamp task -->
<tstamp>
<format property="VERSION_DATE" pattern="yyyy-MM-dd" locale="en" />
</tstamp>
<!-- Output directories -->
<property name="out.dir" value="bin" />
<property name="out.absolute.dir" location="${out.dir}" />
<property name="out.release.file.name"
value="${ant.project.name}-beta-${DSTAMP}.apk" />
<property name="out.release.file"
location="${out.absolute.dir}/${out.release.file.name}" />
<echo>Release file: ${out.release.file}...</echo>
<taskdef name="setup"
classname="com.android.ant.SetupTask"
classpathref="android.antlibs" />
<!--<property name="my.out.release.file.name" value="${ant.project.name}-beta-${DSTAMP}.apk" />
<property name="out.release.file" location="${out.absolute.dir}/${out.release.file.name}" />-->
<!-- Execute the Android Setup task that will setup some properties specific to the target,
and import the build rules files.
The rules file is imported from
<SDK>/platforms/<target_platform>/templates/android_rules.xml
To customize some build steps for your project:
- copy the content of the main node <project> from android_rules.xml
- paste it in this build.xml below the <setup /> task.
- disable the import by changing the setup task below to <setup import="false" />
This will ensure that the properties are setup correctly but that your customized
build steps are used.
-->
<setup />
<exec executable="hg" outputproperty="hg.rev">
<arg value="tip" />
<arg value="--template" />
<arg value="{rev}\n" />
</exec>
<exec executable="hg" outputproperty="hg.node">
<arg value="tip" />
<arg value="--template" />
<arg value="{node|short}\n" />
</exec>
<!-- setup config settings before compile -->
<target name="-pre-compile" depends="config"/>
<!-- Config
Copy Config.java to our source tree, replacing custom tokens with values in build.properties.
The configuration depends on "clean" because otherwise the build system will not detect changes
in the configuration.
-->
<target name="config">
<property name="config-target-path" value="${source.dir}/com/geozen/smarttrail/app" />
<!-- Copy the configuration file, replacing tokens in the file. -->
<copy file="templates/Config.java" todir="${config-target-path}" overwrite="true" encoding="utf-8">
<filterset>
<filter token="CONFIG.DEBUG" value="${config.debug}" />
<filter token="CONFIG.USE_DEBUG_SERVER" value="${config.use_debug_server}" />
</filterset>
</copy>
<!-- Now set it to read-only, as we don't want people accidentally
editing the wrong one. NOTE: This step is unnecessary, but I do
it so the developers remember that this is not the original file. -->
<!--<chmod file="${config-target-path}/Config.java" perm="-w" />
<attrib file="${config-target-path}/Config.java" readonly="true" />-->
<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask">
<classpath>
<fileset dir="ant">
<include name="*.jar" />
</fileset>
</classpath>
</taskdef>
<xmltask source="AndroidManifest.xml" dest="AndroidManifest.xml">
<replace path="/manifest/@android:versionName" withText="${VERSION_DATE}" />
</xmltask>
<xmltask source="AndroidManifest.xml" dest="AndroidManifest.xml">
<replace path="/manifest/@android:versionCode" withText="${hg.rev}" />
<replace path="/manifest/application/@android:debuggable" withText="false" />
</xmltask>
<xmltask source="res/values/styles.xml" dest="res/values/styles.xml">
<replace path="/resources/style/item[@name='android:apiKey']/text()" withText="@string/maps_api_key_release" />
</xmltask>
<xmltask source="res/values-xlarge-v11/styles.xml" dest="res/values-xlarge-v11/styles.xml">
<replace path="/resources/style/item[@name='android:apiKey']/text()" withText="@string/maps_api_key_release" />
</xmltask>
<xmltask source="res/values-xlarge-land-v11/styles.xml" dest="res/values-xlarge-land-v11/styles.xml">
<replace path="/resources/style/item[@name='android:apiKey']/text()" withText="@string/maps_api_key_release" />
</xmltask>
</target>
</project>