-
-
Notifications
You must be signed in to change notification settings - Fork 97
/
build.gradle
728 lines (632 loc) · 24.4 KB
/
build.gradle
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
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
plugins {
id "com.jetbrains.python.envs" version "0.0.31"
}
apply plugin: 'com.android.application'
apply from: "$project.rootDir/tools/gradle/versionCode.gradle"
apply plugin: 'kotlin-android'
apply plugin: "org.mozilla.telemetry.glean-gradle-plugin"
// Apply AGConnect plugin only for Hvr builds
if (getGradle().getStartParameter().getTaskRequests().toString() =~ /(h|H)vr/) {
apply plugin: 'com.huawei.agconnect'
}
deps.telemetry.glean_unittests = "org.mozilla.telemetry:glean-native-forUnitTests:$project.ext.glean_version"
def getGitHash = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = stdout
}
return stdout.toString().trim()
}
def getCrashRestartDisabled = { ->
if (gradle.hasProperty("userProperties.disableCrashRestart")) {
return gradle."userProperties.disableCrashRestart"
}
return "false"
}
def getDevApplicationIdSuffix = { ->
if (gradle.hasProperty("userProperties.simultaneousDevProduction")) {
return gradle."userProperties.simultaneousDevProduction" == "true" ? "dev" : ""
}
return ""
}
def getUseDebugSigningOnRelease = { ->
if (gradle.hasProperty("userProperties.useDebugSigningOnRelease")) {
return gradle."userProperties.useDebugSigningOnRelease" == "true"
}
return false
}
def getOpenXRFlags = { ->
if (gradle.hasProperty("userProperties.openxr")) {
return gradle."userProperties.openxr" == "true" ? " -DOPENXR" : ""
}
return ""
}
def getOpenXRCMakeFlags = { ->
if (gradle.hasProperty("userProperties.openxr")) {
return gradle."userProperties.openxr" == "true" ? "-DOPENXR=ON" : "-DOPENXR=OFF"
}
return "-DOPENXR=OFF"
}
def getHVRAppId = { ->
if (gradle.hasProperty("userProperties.HVR_APP_ID")) {
return gradle."userProperties.HVR_APP_ID"
}
return ""
}
def getHVRApiKey = { ->
if (gradle.hasProperty("userProperties.HVR_API_KEY")) {
return gradle."userProperties.HVR_API_KEY"
}
return ""
}
def getHVRMLSpeechServices = { ->
if (getHVRApiKey().isEmpty()) {
return "{ com.igalia.wolvic.speech.SpeechServices.MEETKAI }"
} else {
return "{ com.igalia.wolvic.speech.SpeechServices.MEETKAI, " +
" com.igalia.wolvic.speech.SpeechServices.HUAWEI_ASR }";
}
}
def getMKApiKey = { ->
if (gradle.hasProperty("userProperties.MK_API_KEY")) {
return gradle."userProperties.MK_API_KEY"
}
return ""
}
def isChromiumAvailable = {
if (gradle.hasProperty("localProperties.chromium_aar")) {
return true
}
return false
}
def isWebKitAvailable = {
if (gradle.hasProperty("localProperties.webkit_aar")) {
return true
}
return false
}
// Glean: Generate markdown docs for the collected metrics.
ext.gleanGenerateMarkdownDocs = true
ext.gleanDocsDirectory = "$rootDir/docs"
android {
compileSdkVersion build_versions.compile_sdk
defaultConfig {
applicationId "com.igalia.wolvic"
minSdkVersion build_versions.min_sdk
targetSdkVersion build_versions.target_sdk
versionCode 110
versionName "1.5"
buildConfigField "String", "GIT_HASH", "\"${getGitHash()}\""
buildConfigField "Boolean", "DISABLE_CRASH_RESTART", getCrashRestartDisabled()
buildConfigField "String", "AMO_COLLECTION", "\"fxr\""
buildConfigField "Boolean", "WEBVIEW_IN_PHONE_UI", "false"
buildConfigField "Boolean", "CN_FIRST_RUN_IN_PHONE_UI", "false"
buildConfigField "Boolean", "FXA_USE_CHINA_SERVER", "false"
buildConfigField "String[]", "SPEECH_SERVICES", "{ com.igalia.wolvic.speech.SpeechServices.MEETKAI }"
buildConfigField "Boolean", "SUPPORTS_SYSTEM_NOTIFICATIONS", "false"
buildConfigField "Boolean", "KIOSK_MODE_ALWAYS", "false"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags "-std=c++14 -fexceptions -frtti -Werror" +
" -I" + file("src/main/cpp").absolutePath +
" -I" + file("src/main/cpp/vrb/include").absolutePath +
// CMake 3.10+ needs "-DANDROID" flag, since ANDROID
// flag has been removed in favor of __ANDROID__. But
// vrb still uses "#if defined(ANDROID)"
" -DANDROID"
arguments "-DANDROID_STL=c++_shared"
}
}
javaCompileOptions {
annotationProcessorOptions {
arguments = [
"room.schemaLocation":"$projectDir/schemas".toString(),
"room.incremental":"true",
"room.expandProjection":"true"]
}
}
vectorDrawables.useSupportLibrary = true
}
project.archivesBaseName = "Wolvic"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
jniLibs {
useLegacyPackaging = true
pickFirsts += ['**/libxul.so']
}
}
kotlinOptions {
jvmTarget = '1.8'
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig getUseDebugSigningOnRelease() ? debug.signingConfig : release.signingConfig
buildConfigField 'String', 'PROPS_ENDPOINT', '"https://igalia.github.io/wolvic/props.json"'
buildConfigField "String", "MK_API_KEY", "\"${getMKApiKey()}\""
}
debug {
applicationIdSuffix getDevApplicationIdSuffix()
pseudoLocalesEnabled true
buildConfigField 'String', 'PROPS_ENDPOINT', '"https://igalia.github.io/wolvic/props.json"'
buildConfigField "String", "MK_API_KEY", "\"\""
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
flavorDimensions "platform", "abi", "backend", "store"
productFlavors {
// Supported platforms
oculusvr {
dimension "platform"
targetSdkVersion build_versions.target_sdk_oculusvr
externalNativeBuild {
cmake {
cppFlags "-DOCULUSVR" + getOpenXRFlags()
arguments "-DVR_SDK_LIB=oculusvr-lib", "-DVR_SDK_EXTRA_LIB=ovrplatform-lib", "-DOCULUSVR=ON", getOpenXRCMakeFlags()
}
}
manifestPlaceholders = [ headtrackingRequired:"false", permissionToRemove:"android.permission.RECEIVE_BOOT_COMPLETED" ]
}
wavevr {
minSdkVersion build_versions.min_sdk_wave
targetSdkVersion build_versions.target_sdk_wave
dimension "platform"
externalNativeBuild {
cmake {
cppFlags " -I" + file("${project.rootDir}/third_party/wavesdk/build/wvr_client-${versions.wavevr}/include").absolutePath +
" -DWAVEVR"
arguments "-DVR_SDK_LIB=wavevr-lib", "-DWAVEVR=ON", "-DWAVE_SDK_VERSION=${versions.wavevr}"
}
}
applicationIdSuffix ".internal"
}
wavevrStore {
minSdkVersion build_versions.min_sdk_wave
targetSdkVersion build_versions.target_sdk_wave
dimension "platform"
externalNativeBuild {
cmake {
cppFlags " -I" + file("${project.rootDir}/third_party/wavesdk/build/wvr_client-${versions.wavevr}/include").absolutePath +
" -DWAVEVR"
arguments "-DVR_SDK_LIB=wavevr-lib", "-DWAVEVR=ON", "-DWAVE_SDK_VERSION=${versions.wavevr}"
}
}
}
picoxr {
dimension "platform"
externalNativeBuild {
cmake {
cppFlags " -DPICOXR -DOPENXR -I" + file("src/openxr/cpp").absolutePath
arguments "-DVR_SDK_LIB=picoxr-lib", "-DPICOXR=ON", "-DOPENXR=ON"
}
}
}
lynx {
dimension "platform"
externalNativeBuild {
cmake {
cppFlags " -DLYNX -DOPENXR -I" + file("src/openxr/cpp").absolutePath
arguments "-DLYNX=ON", "-DOPENXR=ON"
}
}
}
spaces {
dimension "platform"
targetSdkVersion build_versions.target_sdk_spaces
externalNativeBuild {
cmake {
cppFlags " -DSPACES -DOPENXR -I" + file("src/openxr/cpp").absolutePath
arguments "-DSPACES=ON", "-DOPENXR=ON"
}
}
}
aosp {
dimension "platform"
targetSdkVersion build_versions.target_sdk_aosp
externalNativeBuild {
cmake {
cppFlags " -DAOSP -DOPENXR -I" + file("src/openxr/cpp").absolutePath
arguments "-DAOSP=ON", "-DOPENXR=ON"
}
}
}
hvr {
dimension "platform"
externalNativeBuild {
cmake {
cppFlags " -DHVR -DOPENXR -I" + file("src/openxr/cpp").absolutePath
arguments "-DVR_SDK_LIB=hvr-lib", "-DHVR=ON", "-DOPENXR=ON"
}
}
buildConfigField "String", "HVR_APP_ID", "\"${getHVRAppId()}\""
buildConfigField "String", "HVR_API_KEY", "\"${getHVRApiKey()}\""
buildConfigField "String", "MK_API_KEY", "\"\""
buildConfigField "String[]", "SPEECH_SERVICES", "${getHVRMLSpeechServices()}"
buildConfigField "Boolean", "SUPPORTS_SYSTEM_NOTIFICATIONS", "true"
buildConfigField "Boolean", "WEBVIEW_IN_PHONE_UI", "true"
}
noapi {
dimension "platform"
externalNativeBuild {
cmake {
cppFlags " -DVRBROWSER_NO_VR_API"
arguments "-DNOAPI=ON"
}
}
}
// Supported ABIs
arm64 {
dimension "abi"
ndk {
abiFilters "arm64-v8a"
}
}
x64 {
dimension "abi"
ndk {
abiFilters "x86_64"
}
}
// Supported Backends
gecko {
dimension "backend"
externalNativeBuild {
cmake {
cppFlags " -DGECKO"
arguments "-DGECKO=ON"
}
}
}
chromium {
dimension "backend"
externalNativeBuild {
cmake {
cppFlags " -DCHROMIUM"
arguments "-DCHROMIUM=ON"
}
}
}
webkit {
dimension "backend"
}
// Stores flavor
generic {
dimension "store"
}
appLab {
dimension "store"
externalNativeBuild {
cmake {
cppFlags "-DSTORE_BUILD", "-DMETA_APP_ID=4812663595466206"
}
}
}
metaStore {
dimension "store"
applicationIdSuffix ".metastore"
externalNativeBuild {
cmake {
cppFlags "-DSTORE_BUILD", "-DMETA_APP_ID=5917120145021341"
}
}
}
mainlandChina {
applicationId "com.cn.igalia.wolvic"
dimension "store"
buildConfigField "Boolean", "FXA_USE_CHINA_SERVER", "true"
buildConfigField "Boolean", "WEBVIEW_IN_PHONE_UI", "true"
buildConfigField "Boolean", "CN_FIRST_RUN_IN_PHONE_UI", "true"
}
}
variantFilter { variant ->
def platform = variant.getFlavors().get(0).name
def abi = variant.getFlavors().get(1).name
def backend = variant.getFlavors().get(2).name
def store = variant.getFlavors().get(3).name
// Create x64 variants only for noapi and aosp platforms
if (abi == 'x64')
variant.setIgnore(platform != 'noapi' && platform !='aosp');
// Create variants for China only for HVR platforms
if (store == 'mainlandChina' && !platform.startsWith('hvr'))
variant.setIgnore(true);
// Create variants for chromium/webkit, only when they are available
if (backend == 'chromium' && !isChromiumAvailable())
variant.setIgnore(true);
if (backend == 'webkit' && !isWebKitAvailable())
variant.setIgnore(true);
// MetaStore and AppLab only apply to oculusvr builds.
if ((store == 'metaStore' || store == "appLab") && !platform.startsWith('oculusvr'))
variant.setIgnore(true);
}
sourceSets {
main {
java.srcDirs = [
'app',
'src/common/shared',
'src/main/cpp/vrb/android/java'
]
}
release {
manifest.srcFile getUseDebugSigningOnRelease() ? "src/debug/AndroidManifest.xml"
: manifest.srcFile
}
oculusvr {
java.srcDirs = [
'src/oculusvr/java'
]
}
wavevr {
java.srcDirs = [
'src/wavevr/java'
]
res.srcDirs = [
'src/wavevr/res'
]
jniLibs.srcDirs = ["${project.rootDir}/third_party/wavesdk/build/wvr_client-${versions.wavevr}/jni"]
}
wavevrStore {
java.srcDirs = [
'src/wavevr/java'
]
res.srcDirs = [
'src/wavevr/res'
]
assets.srcDirs = [
'src/wavevr/assets'
]
jniLibs.srcDirs = ["${project.rootDir}/third_party/wavesdk/build/wvr_client-${versions.wavevr}/jni"]
manifest.srcFile "src/wavevr/AndroidManifest.xml"
}
hvr {
java.srcDirs = [
'src/hvr/java'
]
assets.srcDirs = [
'src/hvr/assets'
]
res.srcDirs = [
'src/hvr/res'
]
}
lynx {
manifest.srcFile "src/lynx/AndroidManifest.xml"
}
spaces {
manifest.srcFile "src/spaces/AndroidManifest.xml"
}
aosp {
manifest.srcFile "src/aosp/AndroidManifest.xml"
}
noapi {
java.srcDirs = [
'src/noapi/java'
]
}
gecko {
java.srcDirs = [
'src/common/gecko'
]
}
chromium {
java.srcDirs = [
'src/common/chromium'
]
}
webkit {
java.srcDirs = [
'src/common/webkit'
]
}
}
sourceSets.all {
// oculusvr needs a specific manifest file by its buildtype.
if (name.startsWith('oculusvr')) {
if (name.toLowerCase().contains('debug')) {
manifest.srcFile "src/oculusvrArmDebug/AndroidManifest.xml"
}
if (name.toLowerCase().contains('release')) {
manifest.srcFile getUseDebugSigningOnRelease()
? "src/oculusvrArmDebug/AndroidManifest.xml"
: "src/oculusvrArmRelease/AndroidManifest.xml"
}
}
}
testOptions {
unitTests.includeAndroidResources = true
}
buildFeatures {
viewBinding true
prefab true // enable prefab support for various SDK AAR
dataBinding true
}
namespace 'com.igalia.wolvic'
androidResources {
noCompress 'ja'
// TODO: This statement should be moved under 'chromium' dimension or removed. So far, these
// options are affected to every variants when`isChromiumAvailable()` is true.
if (isChromiumAvailable()) {
noCompress 'dat'
noCompress 'bin'
noCompress 'pak'
}
}
lint {
disable 'ExtraTranslation'
}
}
configurations {
jnaForTest
armImplementation
x86Implementation
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
// Common
implementation deps.lifecycle.runtime
implementation deps.lifecycle.viewmodel
implementation deps.lifecycle.java8
implementation deps.lifecycle.process
implementation deps.support.annotations
implementation deps.support.app_compat
implementation deps.support.recyclerview
implementation deps.support.cardview
implementation deps.support.design
implementation deps.support.vector_drawable
implementation deps.support.viewpager2
implementation deps.constraint_layout
implementation deps.gson
implementation deps.room.runtime
annotationProcessor deps.room.compiler
// Android Components
implementation deps.android_components.browser_errorpages
implementation deps.android_components.browser_search
implementation deps.android_components.browser_state
implementation deps.android_components.browser_storage
implementation deps.android_components.browser_domains
implementation deps.android_components.browser_icons
implementation deps.android_components.feature_toolbar
implementation deps.android_components.service_accounts
implementation deps.android_components.service_sync_logins
implementation deps.android_components.mozilla_service_location
implementation deps.android_components.ui_autocomplete
implementation deps.android_components.concept_engine
implementation deps.android_components.concept_fetch
implementation deps.android_components.lib_fetch
implementation deps.android_components.lib_dataprotect
implementation deps.android_components.support_rustlog
implementation deps.android_components.support_rusthttp
implementation deps.android_components.support_webextensions
implementation deps.android_components.support_ktx
implementation deps.android_components.feature_accounts
implementation deps.android_components.feature_webcompat
implementation deps.android_components.feature_webcompat_reporter
implementation deps.android_components.feature_addons
implementation deps.android_components.glean
implementation deps.android_components.preference
implementation deps.app_services.rustlog
// Kotlin dependency
implementation deps.kotlin.stdlib
implementation deps.kotlin.coroutines
implementation deps.kotlin.coroutines_jdk8
// SQLite helper to handle DBs from assets
implementation deps.sqlite.sqlite
// DiskLRUCache used to cache snapshots
implementation deps.disklrucache.disklrucache
// Color picker library
implementation deps.colorpicker
// Required for targeting S+
implementation deps.work.runtime
implementation deps.work.runtime_ktx
// Testing
androidTestImplementation deps.atsl.runner
androidTestImplementation deps.atsl.junit
androidTestImplementation deps.espresso.core
testImplementation deps.junit
testImplementation deps.atsl.core
testImplementation deps.robolectric
testImplementation deps.app_services.rustlog
testImplementation deps.android_components.support_test
testImplementation deps.android_components.support_test_appservices
jnaForTest deps.jna
testImplementation files(configurations.jnaForTest.copyRecursive().files)
testImplementation deps.telemetry.glean_unittests
testImplementation deps.work.testing
// MeetKai
implementation fileTree(dir: "${project.rootDir}/libs/meetkai/", include: ['*.aar'])
implementation 'com.squareup.okhttp3:okhttp:4.11.0'
implementation 'net.lingala.zip4j:zip4j:2.11.5'
implementation 'org.apache.commons:commons-math3:3.6.1'
// HVR
hvrImplementation fileTree(dir: "${project.rootDir}/third_party/hvr", include: ['*.jar'])
hvrImplementation 'com.huawei.agconnect:agconnect-core-harmony:1.1.0.300'
hvrImplementation 'com.huawei.agconnect:agconnect-core:1.6.5.300'
hvrImplementation 'com.huawei.hms:hianalytics:6.3.2.300'
hvrImplementation 'com.huawei.hms:ml-computer-voice-asr:3.1.0.300'
hvrImplementation 'com.huawei.hms:location:6.2.0.300'
hvrImplementation 'com.huawei.hms:push:6.5.0.300'
// Lynx
lynxImplementation fileTree(dir: "${project.rootDir}/third_party/lynx", include: ['*.aar'])
// Snapdragon Spaces
spacesImplementation fileTree(dir: "${project.rootDir}/third_party/spaces", include: ['*.aar'])
// gecko
def branch = "release" // "release", "nightly" or "beta"
geckoImplementation deps.gecko_view."${branch}_x86_64"
geckoImplementation deps.gecko_view."${branch}_arm64"
configurations.all {
resolutionStrategy.capabilitiesResolution.withCapability('org.mozilla.geckoview:geckoview') {
def abi = getName().toLowerCase().contains('x64') ? 'x86_64' : 'arm64'
def candidate = branch == "release" ? "geckoview-${abi}" : "geckoview-${branch}-${abi}"
select(candidates.find { it.id.module.contains(candidate) })
}
}
// chromium
if (isChromiumAvailable()) {
chromiumImplementation fileTree(dir: gradle."localProperties.chromium_aar", include: ['*.aar'])
chromiumImplementation 'androidx.fragment:fragment:1.4.1'
}
// webkit
if (isWebKitAvailable()) {
webkitImplementation fileTree(dir: gradle."localProperties.webkit_aar", include: ['*.aar'])
}
// openwnn (bundled because it is not published outside of JCenter, which is deprecated)
implementation fileTree(dir: "${project.rootDir}/libs/openwnn/", include: ['*.aar'])
}
if (findProject(':servo')) {
dependencies {
oculusvrImplementation project(':servo')
}
}
if (findProject(':wavesdk')) {
dependencies {
wavevrImplementation fileTree(dir: "${project.rootDir}/third_party/wavesdk/", include: ['*.aar'])
wavevrStoreImplementation fileTree(dir: "${project.rootDir}/third_party/wavesdk/", include: ['*.aar'])
}
}
if (gradle.hasProperty('geckoViewLocalArm') || gradle.hasProperty('geckoViewLocalX86')) {
throw new GradleException("geckoViewLocal{Arm,X86} are deprecated: use geckoViewLocalTopsrcdir and geckoViewLocalTopobjdir")
}
if(gradle.hasProperty("userProperties.openxr") && !gradle.startParameter.taskNames.isEmpty()){
if (!(gradle.startParameter.taskNames.any { it.contains("Generic") }) && gradle."userProperties.openxr" == "false") {
throw new GradleException('Cannot build a store flavor with openxr=false ')
}
}
if (gradle.hasProperty('localProperties.dependencySubstitutions.geckoviewTopsrcdir')) {
if (getGradle().getStartParameter().getTaskRequests().toString().toLowerCase().contains('x64')
&& gradle.hasProperty('localProperties.dependencySubstitutions.geckoviewTopobjdirX64')) {
ext.topobjdir = gradle."localProperties.dependencySubstitutions.geckoviewTopobjdirX64"
} else if (gradle.hasProperty('localProperties.dependencySubstitutions.geckoviewTopobjdir')) {
ext.topobjdir = gradle."localProperties.dependencySubstitutions.geckoviewTopobjdir"
}
ext.topsrcdir = gradle."localProperties.dependencySubstitutions.geckoviewTopsrcdir"
apply from: "${topsrcdir}/substitute-local-geckoview.gradle"
}
// -------------------------------------------------------------------------------------------------
// MLS: Read token from local file if it exists
// -------------------------------------------------------------------------------------------------
android.applicationVariants.all { variant ->
print("MLS token: ")
try {
def token = new File("${rootDir}/.mls_token").text.trim()
buildConfigField 'String', 'MLS_TOKEN', '"' + token + '"'
println "(Added from .mls_token file)"
} catch (FileNotFoundException ignored) {
buildConfigField 'String', 'MLS_TOKEN', '""'
println("X_X")
}
// HVR packages for mainland china must only use HVR speech recognition system.
def platform = variant.productFlavors.get(0).name
def store = variant.productFlavors.get(3).name
if (platform.toLowerCase().startsWith('hvr') && store == "mainlandChina") {
variant.buildConfigField "String[]", "SPEECH_SERVICES", "{ com.igalia.wolvic.speech.SpeechServices.HUAWEI_ASR }"
}
}