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
|
_GRADLE_FLAGS_VALUE=
### @usage: GRADLE_FLAGS(flags...) # internal
###
### SEt additional flags for gradle
macro GRADLE_FLAGS(FLAGS...) {
SET_APPEND(_GRADLE_FLAGS_VALUE $FLAGS)
}
### @usage: PROGUARD_RULES(ProguardRuleFiles...)
###
### This macro is strictly prohibited to use outside of mapsmobi project
macro PROGUARD_RULES(RULES...) {
SET_APPEND(_PROGUARD_RULES_GLOBAL $RULES)
}
### @usage: AARS(Aars...)
###
### This macro is strictly prohibited to use outside of mapsmobi project
macro AARS(DEPS...) {
SET_APPEND(_AARS_GLOBAL $DEPS)
}
### @usage: MOBILE_DLL() # internal
module MOBILE_DLL: DLL {
.CMD=LINK_MOBILE_DLL
PEERDIR(build/external_resources/android_sdk)
PEERDIR(build/external_resources/gradle)
PEERDIR(build/platform/java/jdk)
PEERDIR($JDK_RESOURCE_PEERDIR)
SET(BIN_AAR_DIR $BINDIR/aar)
SET(BIN_TMP_DIR $BINDIR/tmp)
}
_MOBILE_TEST_APK_AAR_MANIFEST_VALUE=
### @usage: MOBILE_TEST_APK_AAR_MANIFEST(file) # internal
macro MOBILE_TEST_APK_AAR_MANIFEST(FILE) {
SET(_MOBILE_TEST_APK_AAR_MANIFEST_VALUE $FILE)
}
_MOBILE_TEST_APK_AAR_PROGUARD_RULES_VALUE=
### @usage: MOBILE_TEST_APK_AAR_PROGUARD_RULES(file) # internal
macro MOBILE_TEST_APK_AAR_PROGUARD_RULES(FILE) {
SET(_MOBILE_TEST_APK_AAR_PROGUARD_RULES_VALUE $FILE)
}
_MOBILE_TEST_APK_AAR_AARS_VALUE=
### @usage: MOBILE_TEST_APK_AAR_AARS(filenames...) # internal
macro MOBILE_TEST_APK_AAR_AARS(AARS...) {
SET_APPEND(_MOBILE_TEST_APK_AAR_AARS_VALUE $AARS)
}
_MOBILE_TEST_APK_AAR_BUNDLES_VALUE=
### @usage: MOBILE_TEST_APK_AAR_BUNDLES(filenames...) # internal
macro MOBILE_TEST_APK_AAR_BUNDLES(BUNDLES...) {
SET_APPEND(_MOBILE_TEST_APK_AAR_BUNDLES_VALUE $BUNDLES)
BUNDLE_EXTRA_INPUTS($BUNDLES)
}
_MOBILE_TEST_APK_TEMPLATE_DIR=
### @usage: MOBILE_TEST_APK_TEMPLATE(dir filenames...) # internal
macro MOBILE_TEST_APK_TEMPLATE(TEMPLATE_DIR, INPUTS...) {
SET(_MOBILE_TEST_APK_TEMPLATE_DIR $TEMPLATE_DIR)
BUNDLE_EXTRA_INPUTS(${pre=$TEMPLATE_DIR/:INPUTS})
}
_MOBILE_TEST_APK_CMDLINE=\
$FS_TOOLS md $BIN_TMP_DIR \
&& $FS_TOOLS md $BINDIR/.android \
&& $COPY_CMD $GRADLE_DEBUG_STORE_RESOURCE_GLOBAL/debug.keystore $BINDIR/.android/debug.keystore \
&& $FS_TOOLS md $BINDIR/jni_libs/$ARCH_NAME \
&& $YMAKE_PYTHON ${input:"build/scripts/extract_asrc.py"} --output $BIN_TMP_DIR --input ${suf=.asrc:PEERS} \
&& $MOVE_FILE $OUTPUT $BINDIR/jni_libs/$ARCH_NAME/${pre=lib;suf=.so:_MOBILE_TEST_APK_LIBRARY_NAME} \
&& $FS_TOOLS md $BIN_AAR_DIR \
&& $YMAKE_PYTHON ${input:"build/scripts/gen_aar_gradle_script.py"} \
${input;hide:EXTRA_INPUTS} \
--aidl-dirs $BIN_TMP_DIR/aidl \
--assets-dirs $BIN_TMP_DIR/assets \
--java-dirs $BIN_TMP_DIR/src \
--jni-libs-dirs $BINDIR/jni_libs \
--res-dirs $BIN_TMP_DIR/res \
--manifest ${input:_MOBILE_TEST_APK_AAR_MANIFEST_VALUE} \
--proguard-rules ${input:_MOBILE_TEST_APK_AAR_PROGUARD_RULES_VALUE} ${input:_PROGUARD_RULES_GLOBAL} \
--aars $_MOBILE_TEST_APK_AAR_AARS_VALUE $_AARS_GLOBAL \
--bundles $_MOBILE_TEST_APK_AAR_BUNDLES_VALUE \
--output-dir $BIN_AAR_DIR \
--bundle-name unittest \
--maven-repos ${MAPSMOBI_MAVEN_REPO_RESOURCE_GLOBAL} \
&& ${cwd:BIN_AAR_DIR} ${GRADLE_RESOURCE_GLOBAL}/bin/gradle $_GRADLE_FLAGS_VALUE --no-daemon --offline -g $BIN_GRADLE_USER_HOME_DIR assemble${_BUNDLE_BUILD_TYPE} ${env:"ANDROID_HOME=$ANDROID_SDK_RESOURCE_GLOBAL/android_sdk"} ${env:"JAVA_HOME=$JDK_RESOURCE"} ${env:"ANDROID_SDK_HOME=$BINDIR"} \
&& $FS_TOOLS md $BIN_APK_DIR \
&& $FS_TOOLS md $BIN_APK_DIR/res \
&& $COPY_CMD $_MOBILE_TEST_APK_TEMPLATE_DIR/Manifest.xml $BIN_APK_DIR/Manifest.xml \
&& $YMAKE_PYTHON ${input:"build/scripts/gen_test_apk_gradle_script.py"} \
${input;hide:EXTRA_INPUTS} \
--app-id $REALPRJNAME \
--assets-dirs $_MOBILE_TEST_APK_ASSETS_DIRS_VALUE \
--java-dirs $_MOBILE_TEST_APK_TEMPLATE_DIR/java \
--jni-libs-dirs \
--res-dirs $BIN_APK_DIR/res $_MOBILE_TEST_APK_TEMPLATE_DIR/res $BIN_TMP_DIR/res \
--manifest Manifest.xml \
--aars \
--output-dir $BIN_APK_DIR \
--bundle-name $REALPRJNAME \
--bundles $BIN_AAR_DIR/build/outputs/aar/unittest-${tolower:_BUNDLE_BUILD_TYPE}.aar $_MOBILE_TEST_APK_AAR_BUNDLES_VALUE \
--library-name $_MOBILE_TEST_APK_LIBRARY_NAME \
--maven-repos ${MAPSMOBI_MAVEN_REPO_RESOURCE_GLOBAL} \
&& ${cwd:BIN_APK_DIR} ${GRADLE_RESOURCE_GLOBAL}/bin/gradle $_GRADLE_FLAGS_VALUE --no-daemon --offline -g $BIN_GRADLE_USER_HOME_DIR assembleDebug ${env:"ANDROID_HOME=$ANDROID_SDK_RESOURCE_GLOBAL/android_sdk"} ${env:"JAVA_HOME=$JDK_RESOURCE"} ${env:"ANDROID_SDK_HOME=$BINDIR"} \
&& $COPY_CMD $BIN_APK_DIR/build/outputs/apk/${tolower:_BUNDLE_BUILD_TYPE}/$REALPRJNAME.apk ${OUTPUT}
_MOBILE_TEST_APK_EXTRA_INPUTS_VALUE=
macro _MOBILE_TEST_APK_CMD_IMPL(OUTPUT, EXTRA_INPUTS...) {
.CMD=$_MOBILE_TEST_APK_CMDLINE
}
_MOBILE_TEST_APK_CMD=$_MOBILE_TEST_APK_CMD_IMPL($TARGET $_BUNDLE_EXTRA_INPUTS_VALUE)
LINK_MOBILE_TEST_APK=$LINK_DYN_LIB && $_MOBILE_TEST_APK_CMD
### @usage: MOBILE_TEST_APK() # internal
module MOBILE_TEST_APK: DLL {
.CMD=LINK_MOBILE_TEST_APK
.GLOBAL=_AARS _PROGUARD_RULES
PEERDIR(build/external_resources/android_sdk)
PEERDIR(build/external_resources/gradle)
PEERDIR(build/platform/java/jdk)
PEERDIR($JDK_RESOURCE_PEERDIR)
SET(MODULE_PREFIX)
SET(MODULE_SUFFIX .apk)
SET(BIN_AAR_DIR $BINDIR/aar)
SET(BIN_APK_DIR $BINDIR/apk)
SET(BIN_TMP_DIR $BINDIR/tmp)
SET(BIN_GRADLE_USER_HOME_DIR $BINDIR/gradle)
SET(_MOBILE_TEST_APK_LIBRARY_NAME unittests)
when ($OS_ANDROID == "yes") {
when ($ARCH_ARM7 == "yes") {
ARCH_NAME=armeabi-v7a
}
elsewhen ($ARCH_ARM64 == "yes") {
ARCH_NAME=arm64-v8a
}
elsewhen ($ARCH_I386 == "yes") {
ARCH_NAME=x86
}
elsewhen ($ARCH_X86_64 == "yes") {
ARCH_NAME=x86_64
}
otherwise {
ARCH_NAME=unsupported
}
}
}
### @usage: MOBILE_BOOST_TEST_APK() # internal
module MOBILE_BOOST_TEST_APK: MOBILE_TEST_APK {
PEERDIR(devtools/dummy_arcadia/test/test_apk/template)
PEERDIR(build/external_resources/mapsmobi_maven_repo)
ADD_YTEST($MODULE_PREFIX$REALPRJNAME boost.test)
MOBILE_TEST_APK_TEMPLATE(${ARCADIA_ROOT}/devtools/dummy_arcadia/test/test_apk/template Manifest.xml java/com/yandex/test/unittests/RunTestsActivity.java java/com/yandex/test/unittests/CrashHandler.java res/values/strings.xml)
}
when ($BT_RELEASE) {
_BUNDLE_BUILD_TYPE=Release
}
otherwise {
_BUNDLE_BUILD_TYPE=Debug
}
_AAR_EXTRA_INPUTS_VALUE=
_AAR_MANIFEST_VALUE=
### @usage: AAR_MANIFEST(filename) # internal
macro AAR_MANIFEST(FILE) {
SET(_AAR_MANIFEST_VALUE $FILE)
}
_AAR_PROGUARD_RULES_VALUE=
### @usage: AAR_PROGUARD_RULES(filename) # internal
macro AAR_PROGUARD_RULES(FILE) {
SET(_AAR_PROGUARD_RULES_VALUE $FILE)
}
_AAR_AARS_VALUE=
### @usage: AAR_AARS(aars...) # internal
macro AAR_AARS(Aars...) {
SET_APPEND(_AAR_AARS_VALUE $Aars)
}
_AAR_COMPILE_ONLY_AARS_VALUE=
### @usage: AAR_COMPILE_ONLY_AARS(compile_only_aars...) # internal
macro AAR_COMPILE_ONLY_AARS(Aars...) {
SET_APPEND(_AAR_COMPILE_ONLY_AARS_VALUE $Aars)
}
_AAR_AIDL_DIRS_VALUE=
### @usage: AAR_AIDL_SRCS(dir filenames...) # internal
macro AAR_AIDL_SRCS(PREFIX, ABSOLUTE[], FILES...) {
SET_APPEND(_AAR_AIDL_DIRS_VALUE $PREFIX)
SET_APPEND(_AAR_EXTRA_INPUTS_VALUE ${pre=$PREFIX/:FILES} ${ABSOLUTE})
}
_AAR_ASSETS_DIRS_VALUE=
### @usage: AAR_ASSETS_SRCS(dir filenames...) # internal
macro AAR_ASSETS_SRCS(PREFIX, ABSOLUTE[], FILES...) {
SET_APPEND(_AAR_ASSETS_DIRS_VALUE $PREFIX)
SET_APPEND(_AAR_EXTRA_INPUTS_VALUE ${pre=$PREFIX/:FILES} ${ABSOLUTE})
}
_AAR_BUNDLES_VALUE=
### @usage: AAR_BUNDLES(filenames...) # internal
macro AAR_BUNDLES(BUNDLES...) {
SET_APPEND(_AAR_BUNDLES_VALUE $BUNDLES)
SET_APPEND(_AAR_EXTRA_INPUTS_VALUE $BUNDLES)
}
_AAR_JNI_LIB_DIRS_VALUE=
### @usage: AAR_JNI_LIBS(dir filenames...) # internal
macro AAR_JNI_LIBS(PREFIX, ABSOLUTE[], FILES...) {
SET_APPEND(_AAR_JNI_LIB_DIRS_VALUE $PREFIX)
SET_APPEND(_AAR_EXTRA_INPUTS_VALUE ${pre=$PREFIX/:FILES} ${ABSOLUTE})
}
_AAR_JAVA_DIRS_VALUE=
### @usage: AAR_JAVA_SRCS(dir filenames...) # internal
macro AAR_JAVA_SRCS(PREFIX, ABSOLUTE[], FILES...) {
SET_APPEND(_AAR_JAVA_DIRS_VALUE $PREFIX)
SET_APPEND(_AAR_EXTRA_INPUTS_VALUE ${pre=$PREFIX/:FILES} ${ABSOLUTE})
}
_AAR_RES_DIRS_VALUE=
### @usage: AAR_RES_SRCS(dir filenames...) # internal
macro AAR_RES_SRCS(PREFIX, ABSOLUTE[], FILES...) {
SET_APPEND(_AAR_RES_DIRS_VALUE $PREFIX)
SET_APPEND(_AAR_EXTRA_INPUTS_VALUE ${pre=$PREFIX/:FILES} ${ABSOLUTE})
}
_AAR_LOCAL_MAVEN_REPO_VALUE=
### @usage: AAR_LOCAL_MAVEN_REPO(repo...)
macro AAR_LOCAL_MAVEN_REPO(REPO...) {
SET_APPEND(_AAR_LOCAL_MAVEN_REPO_VALUE $REPO)
}
_AAR_GRADLE_SCRIPT_GENERATOR_VALUE=
### @usage: AAR_GRADLE_SCRIPT_GENERATOR(python_script)
macro AAR_GRADLE_SCRIPT_GENERATOR(GENERATOR) {
SET(_AAR_GRADLE_SCRIPT_GENERATOR_VALUE $GENERATOR)
}
when ($AAR_NO_STRIP) {
_AAR_NO_STRIP_VALUE=--do-not-strip
}
otherwise {
_AAR_NO_STRIP_VALUE=
}
_AAR_CMDLINE=\
$FS_TOOLS md $BIN_TMP_DIR \
&& $FS_TOOLS md $BINDIR/.android \
&& $COPY_CMD $GRADLE_DEBUG_STORE_RESOURCE_GLOBAL/debug.keystore $BINDIR/.android/debug.keystore \
&& $YMAKE_PYTHON ${input:"build/scripts/extract_asrc.py"} --output $BIN_TMP_DIR --input ${suf=.asrc:PEERS} \
&& $YMAKE_PYTHON ${input:_AAR_GRADLE_SCRIPT_GENERATOR_VALUE} \
${input;hide:EXTRA_INPUTS} \
--aidl-dirs $_AAR_AIDL_DIRS_VALUE $BIN_TMP_DIR/aidl \
--assets-dirs $_AAR_ASSETS_DIRS_VALUE $BIN_TMP_DIR/assets \
--java-dirs $_AAR_JAVA_DIRS_VALUE $BIN_TMP_DIR/src \
--jni-libs-dirs $_AAR_JNI_LIB_DIRS_VALUE $BIN_TMP_DIR/jni_libs \
--res-dirs $_AAR_RES_DIRS_VALUE $BIN_TMP_DIR/res \
--manifest ${input:_AAR_MANIFEST_VALUE} \
--proguard-rules ${input:_AAR_PROGUARD_RULES_VALUE} ${input:_PROGUARD_RULES_GLOBAL} \
--aars $_AAR_AARS_VALUE $_AARS_GLOBAL \
--compile-only-aars $_AAR_COMPILE_ONLY_AARS_VALUE \
--bundles $_AAR_BUNDLES_VALUE \
--output-dir $BINDIR \
--bundle-name $REALPRJNAME \
--peers $PEERS \
--maven-repos $_AAR_LOCAL_MAVEN_REPO_VALUE \
$_AAR_NO_STRIP_VALUE \
&& ${cwd:BINDIR} ${GRADLE_RESOURCE_GLOBAL}/bin/gradle $_GRADLE_FLAGS_VALUE --no-daemon --offline -g $BIN_GRADLE_USER_HOME_DIR bundle${_BUNDLE_BUILD_TYPE}Aar ${env:"ANDROID_HOME=$ANDROID_SDK_RESOURCE_GLOBAL/android_sdk"} ${env:"JAVA_HOME=$JDK_RESOURCE"} ${env:"ANDROID_SDK_HOME=$BINDIR"} $VCS_INFO_DISABLE_CACHE__NO_UID__ \
&& ${cwd:BINDIR} $COPY_CMD build/outputs/aar/${REALPRJNAME}-${tolower:_BUNDLE_BUILD_TYPE}.aar $TARGET \
&& ${cwd:BINDIR} $COPY_CMD build/${suf=-pom.xml:REALPRJNAME} ${output;suf=-pom.xml:REALPRJNAME} \
&& ${cwd:BINDIR} $COPY_CMD build/libs/${suf=-sources.jar:REALPRJNAME} ${output;suf=-sources.jar:REALPRJNAME}
macro _AAR_CMD_IMPL(EXTRA_INPUTS...) {
.CMD=$_AAR_CMDLINE && $GENERATE_MF
}
AAR_CMD=$_AAR_CMD_IMPL($_AAR_EXTRA_INPUTS_VALUE)
### @usage: AAR() # internal
module AAR: _BASE_UNIT {
.CMD=AAR_CMD
.GLOBAL=_AARS _PROGUARD_RULES
.PEERDIR_POLICY=as_build_from
.FINAL_TARGET=yes
SET(MODULE_PREFIX)
SET(MODULE_SUFFIX .aar)
SET(DONT_RESOLVE_INCLUDES yes)
SET(NEED_PLATFORM_PEERDIRS no)
NO_PLATFORM()
PEERDIR(build/external_resources/android_sdk)
PEERDIR(build/external_resources/gradle)
PEERDIR(build/platform/java/jdk)
PEERDIR($JDK_RESOURCE_PEERDIR)
SET(BIN_TMP_DIR $BINDIR/tmp)
SET(BIN_GRADLE_USER_HOME_DIR $BINDIR/gradle)
}
_SECONDARY_OUTPUT_VALUE=
### @usage: SECONDARY_OUTPUT(filename) # internal
###
### The use of this macro is strictly prohibited!!!
macro SECONDARY_OUTPUT(OUTPUT) {
SET(_SECONDARY_OUTPUT_VALUE $OUTPUT)
}
_AAR_PROXY_LIBRARY_CMD=$LINK_LIB && $COPY_CMD $_SECONDARY_OUTPUT_VALUE ${input;hide:_SECONDARY_OUTPUT_VALUE} ${output:REALPRJNAME.aar}
### @usage: AAR_PROXY_LIBRARY() # internal
###
### The use of this module is strictly prohibited!!!
module AAR_PROXY_LIBRARY: _PROXY_LIBRARY {
.ALLOWED=SECONDARY_OUTPUT
.CMD=_AAR_PROXY_LIBRARY_CMD
}
|