forked from dankoman30/slim_gapps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
270 lines (247 loc) · 13.4 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
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE project>
<!--=========================================================================-->
<!-- -->
<!-- PROJECT: buildGapps -->
<!-- Slimroms (www.slimroms.net) -->
<!-- -->
<!-- FILE: build.xml -->
<!-- -->
<!-- DESCRIPTION: -->
<!-- -->
<!-- builds the gapps -->
<!-- -->
<!-- AUTHORS: -->
<!-- -->
<!-- tortureduck: Manfred Hofbauer -->
<!-- dankoman : Daniel Koman -->
<!-- victorlapin: Victor Lapin -->
<!-- raulx222 : Raul Petru -->
<!-- uzen : Dmitry Popov -->
<!-- mohit310 : Mohit Keswani -->
<!-- -->
<!--=========================================================================-->
<project name="buildGapps"
default="buildAll"
basedir=".">
<property file="build.properties"/>
<description>
This file list is used by ant to build the Slim Gapps project
</description>
<!--=======================================================================-->
<!-- some variables -->
<!--=======================================================================-->
<property name="app.name" value="buildGapps"/>
<property name="app.dir" value="${basedir}"/>
<property name="work.dir" value="${app.dir}/work"/>
<property name="build.dir" value="${app.dir}/build"/>
<property name="structure.dir" value="${app.dir}/structure"/>
<property name="sign.jar" value="${app.dir}/tools/signapk.jar"/>
<property name="sign.pem" value="${app.dir}/tools/testkey.x509.pem"/>
<property name="sign.pk8" value="${app.dir}/tools/testkey.pk8"/>
<property name="extra.dir" value="${app.dir}/extras"/>
<tstamp>
<format property="build.today" pattern="yyyyMMdd"/>
</tstamp>
<!--=======================================================================-->
<!-- complete build -->
<!--=======================================================================-->
<target name="buildAll"
depends="cleanupBefore,initit,generateCleanUpList,buildZero,buildMini,cleanupAfter"
description="execute complete build"/>
<!--=======================================================================-->
<!-- zero -->
<!--=======================================================================-->
<target name="buildZero"
description="execute zero gapps build">
<!-- preparations -->
<property environment="env"/>
<property name="file.name.zero" value="${build.dir}/Slim_zero_gapps.BETA.${PRODUCT_VERSION_MAJOR}.${PRODUCT_VERSION_MINOR}.${PRODUCT_VERSION_MAINTENANCE}-${build.today}.zip"/>
<delete dir="${work.dir}"/>
<propertyfile file="${build.dir}/gapps.filenames">
<entry key="zerofilename" value="${file.name.zero}"/>
</propertyfile>
<!-- copy files -->
<copy todir="${work.dir}">
<fileset dir="${structure.dir}">
<exclude name="system/app/ConfigUpdater/**"/>
<exclude name="system/app/ExchangeServices/**"/>
<exclude name="system/priv-app/talkback/**"/>
<exclude name="system/tts/**"/>
<exclude name="dynamic/FaceLock/**"/>
<exclude name="dynamic/Velvet/**"/>
<exclude name="dynamic.sh"/>
</fileset>
</copy>
<copy file="${app.dir}/extras/updater-script" todir="${work.dir}/META-INF/com/google/android">
<filterchain>
<replaceregex pattern="@package@" replace="zero" flags="i"/>
<replaceregex pattern="@cleanup.list@" replace="${cleanup.list}" flags="i"/>
</filterchain>
</copy>
<copy file="${app.dir}/structure/dynamic.sh" todir="${work.dir}">
<filterchain>
<linecontains negate="true">
<contains value="#mini"/>
</linecontains>
</filterchain>
</copy>
<!-- generate backup script -->
<fileset id="item.file" dir="${work.dir}/system" includes="**/*"/>
<pathconvert refid="item.file" property="file.list.zero" pathsep=" " dirsep="/">
<map from="${work.dir}/system/" to=''/>
</pathconvert>
<copy file="${app.dir}/extras/80-gapps.sh" todir="${work.dir}/system/addon.d">
<filterchain>
<replaceregex pattern="@file.list@" replace="${file.list.zero}" flags="i"/>
</filterchain>
</copy>
<!-- fill in g.prop values -->
<length property="length.zero" mode="all">
<fileset dir="${work.dir}"/>
</length>
<propertyfile file="${work.dir}/system/etc/g.prop">
<entry key="ro.addon.type" value="gapps"/>
<entry key="ro.addon.platform" value="lp"/>
<entry key="ro.addon.version" value="slim.zero.${build.today}"/>
<entry key="ro.addon.minimumversion" value="${PRODUCT_VERSION_MAJOR}"/>
<entry key="ro.addon.size" value="${length.zero}"/>
</propertyfile>
<!-- copy space.sh and fill in values -->
<copy file="${app.dir}/extras/space.sh" todir="${work.dir}">
<filterchain>
<replaceregex pattern="@version@" replace="${PRODUCT_VERSION_MAJOR}" flags="i"/>
<replaceregex pattern="@space_needed@" replace="${length.zero}" flags="i"/>
</filterchain>
</copy>
<!-- zip and sign it -->
<antcall target="ZipAndSigning">
<param name="hfile.name" value="${file.name.zero}"/>
</antcall>
</target>
<!--=======================================================================-->
<!-- mini -->
<!--=======================================================================-->
<target name="buildMini"
description="execute mini gapps build">
<!-- preparations -->
<property environment="env"/>
<property name="file.name.mini" value="${build.dir}/Slim_mini_gapps.BETA.${PRODUCT_VERSION_MAJOR}.${PRODUCT_VERSION_MINOR}.${PRODUCT_VERSION_MAINTENANCE}-${build.today}.zip"/>
<delete dir="${work.dir}"/>
<propertyfile file="${build.dir}/gapps.filenames">
<entry key="minifilename" value="${file.name.mini}"/>
</propertyfile>
<!-- copy files -->
<copy todir="${work.dir}">
<fileset dir="${structure.dir}"/>
</copy>
<copy file="${app.dir}/extras/updater-script" todir="${work.dir}/META-INF/com/google/android">
<filterchain>
<replaceregex pattern="@package@" replace="mini" flags="i"/>
<replaceregex pattern="@cleanup.list@" replace="${cleanup.list}" flags="i"/>
</filterchain>
</copy>
<!-- generate backup script -->
<fileset id="item.file" dir="${work.dir}/system" includes="**/*"/>
<pathconvert refid="item.file" property="file.list.mini" pathsep=" " dirsep="/">
<map from="${work.dir}/system/" to=''/>
</pathconvert>
<copy file="${app.dir}/extras/80-gapps.sh" todir="${work.dir}/system/addon.d">
<filterchain>
<replaceregex pattern="@file.list@" replace="${file.list.mini}" flags="i"/>
</filterchain>
</copy>
<!-- fill in g.prop values -->
<length property="length.mini" mode="all">
<fileset dir="${work.dir}"/>
</length>
<propertyfile file="${work.dir}/system/etc/g.prop">
<entry key="ro.addon.type" value="gapps"/>
<entry key="ro.addon.platform" value="lp"/>
<entry key="ro.addon.version" value="slim.mini.${build.today}"/>
<entry key="ro.addon.minimumversion" value="${PRODUCT_VERSION_MAJOR}"/>
<entry key="ro.addon.size" value="${length.mini}"/>
</propertyfile>
<!-- copy space.sh and fill in values -->
<copy file="${app.dir}/extras/space.sh" todir="${work.dir}">
<filterchain>
<replaceregex pattern="@version@" replace="${PRODUCT_VERSION_MAJOR}" flags="i"/>
<replaceregex pattern="@space_needed@" replace="${length.mini}" flags="i"/>
</filterchain>
</copy>
<!-- zip and sign it -->
<antcall target="ZipAndSigning">
<param name="hfile.name" value="${file.name.mini}"/>
</antcall>
</target>
<!--=======================================================================-->
<!-- generate clean up list -->
<!--=======================================================================-->
<target name="generateCleanUpList">
<path id="cleanup.file">
<fileset dir="${extra.dir}">
<include name="*.sh"/>
</fileset>
<fileset dir="${structure.dir}/system"/>
<fileset dir="${structure.dir}/optional/"/>
</path>
<pathconvert refid="cleanup.file" property="cleanup.list" pathsep="", "" dirsep="/">
<map from="${extra.dir}" to="/system/addon.d"/>
<map from="${structure.dir}/system/" to="/system/"/>
<map from="${structure.dir}/optional/common/" to="/system/"/>
<map from="${structure.dir}/optional/face/" to="/system/"/>
<map from="${structure.dir}/optional/hammerhead/" to="/system/"/>
<map from="${structure.dir}/optional/manta/" to="/system/"/>
<map from="${structure.dir}/optional/shamu/" to="/system/"/>
<map from="${structure.dir}/optional/tuna/" to="/system/"/>
</pathconvert>
</target>
<!--=======================================================================-->
<!-- zip and sign it -->
<!--=======================================================================-->
<target name="ZipAndSigning">
<zip destfile="${build.dir}/unsigned.zip" basedir="${work.dir}"/>
<echo message="Signing gapps"/>
<java dir="${build.dir}" fork="true" failonerror="true" maxmemory="1536m" jar="${sign.jar}">
<arg value="-w"/>
<arg value="${sign.pem}"/>
<arg value="${sign.pk8}"/>
<arg value="${build.dir}/unsigned.zip"/>
<arg value="${hfile.name}"/>
</java>
</target>
<!--=======================================================================-->
<!-- cleanupBefore new build -->
<!--=======================================================================-->
<target name="cleanupBefore"
description="delete old directories">
<delete dir="${build.dir}"/>
<delete dir="${work.dir}"/>
</target>
<!--=======================================================================-->
<!-- cleanupAfter build is done -->
<!--=======================================================================-->
<target name="cleanupAfter"
description="delete unnecessary build files">
<echo message="Cleaning up"/>
<delete file="${build.dir}/unsigned.zip"/>
<delete file="${build.dir}/gapps.filenames"/>
</target>
<!--=======================================================================-->
<!-- initiating build -->
<!--=======================================================================-->
<target name ="initit"
description="initiating-steps">
<mkdir dir="${build.dir}"/>
<mkdir dir="${work.dir}"/>
</target>
<!--=======================================================================-->
<!-- test build -->
<!--=======================================================================-->
<target name ="testit"
description="testtest">
<echo message="${x.dir}"/>
<property name="x.dir" value="test9899"/>
<echo message="${x.dir}"/>
</target>
</project>