-
Notifications
You must be signed in to change notification settings - Fork 215
/
build.gradle
502 lines (435 loc) · 16.5 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
plugins {
id "com.jetbrains.python.envs" version "0.0.26"
}
apply plugin: 'com.android.application'
apply from: "$project.rootDir/tools/gradle/versionCode.gradle"
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: "org.mozilla.telemetry.glean-gradle-plugin"
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
}
// Glean: Generate markdown docs for the collected metrics.
ext.gleanGenerateMarkdownDocs = true
ext.gleanDocsDirectory = "$rootDir/docs"
android {
compileSdkVersion build_versions.target_sdk
defaultConfig {
applicationId "org.mozilla.vrbrowser"
minSdkVersion build_versions.min_sdk
targetSdkVersion build_versions.target_sdk
versionCode 1
versionName "10"
buildConfigField "String", "GIT_HASH", "\"${getGitHash()}\""
buildConfigField "Boolean", "DISABLE_CRASH_RESTART", getCrashRestartDisabled()
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
arguments "-DANDROID_STL=c++_shared"
}
}
javaCompileOptions {
annotationProcessorOptions {
arguments = [
"room.schemaLocation":"$projectDir/schemas".toString(),
"room.incremental":"true",
"room.expandProjection":"true"]
}
}
}
if (gradle.hasProperty('userProperties.taskclusterBuild')) {
project.archivesBaseName = "FirefoxReality-$defaultConfig.versionName-$generatedVersionCode"
defaultConfig.versionCode = generatedVersionCode
} else {
project.archivesBaseName = "FirefoxReality"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig getUseDebugSigningOnRelease() ? debug.signingConfig : release.signingConfig
}
debug {
applicationIdSuffix getDevApplicationIdSuffix()
pseudoLocalesEnabled true
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
dataBinding {
enabled = true
}
lintOptions {
disable "ExtraTranslation"
}
flavorDimensions "platform", "abi"
productFlavors {
// Supported platforms
oculusvr {
dimension "platform"
externalNativeBuild {
cmake {
cppFlags " -I" + file("${project.rootDir}/third_party/ovr_mobile/VrApi/Include").absolutePath +
" -I" + file("${project.rootDir}/third_party/OVRPlatformSDK/Include").absolutePath +
" -I" + file("${project.rootDir}/app/src/oculusvr/cpp").absolutePath +
" -DOCULUSVR -DSTORE_BUILD=0"
arguments "-DVR_SDK_LIB=oculusvr-lib", "-DVR_SDK_EXTRA_LIB=ovrplatform-lib", "-DOCULUSVR=ON"
}
}
manifestPlaceholders = [ headtrackingRequired:"false", permissionToRemove:"android.permission.RECEIVE_BOOT_COMPLETED" ]
}
oculusvrStore {
dimension "platform"
externalNativeBuild {
cmake {
cppFlags " -I" + file("${project.rootDir}/third_party/ovr_mobile/VrApi/Include").absolutePath +
" -I" + file("${project.rootDir}/third_party/OVRPlatformSDK/Include").absolutePath +
" -I" + file("${project.rootDir}/app/src/oculusvr/cpp").absolutePath +
" -DOCULUSVR -DSTORE_BUILD=1"
arguments "-DVR_SDK_LIB=oculusvr-lib", "-DVR_SDK_EXTRA_LIB=ovrplatform-lib", "-DOCULUSVR=ON"
}
}
manifestPlaceholders = [ headtrackingRequired:"false", permissionToRemove:"android.permission.RECEIVE_BOOT_COMPLETED" ]
}
oculusvr3dofStore {
dimension "platform"
externalNativeBuild {
cmake {
cppFlags " -I" + file("${project.rootDir}/third_party/ovr_mobile/VrApi/Include").absolutePath +
" -I" + file("${project.rootDir}/third_party/OVRPlatformSDK/Include").absolutePath +
" -I" + file("${project.rootDir}/app/src/oculusvr/cpp").absolutePath +
" -DOCULUSVR -DSTORE_BUILD=1"
arguments "-DVR_SDK_LIB=oculusvr-lib", "-DVR_SDK_EXTRA_LIB=ovrplatform-lib", "-DOCULUSVR=ON"
}
}
manifestPlaceholders = [ headtrackingRequired:"false", permissionToRemove:"android.permission.CAMERA" ]
}
wavevr {
minSdkVersion build_versions.min_sdk_wave
dimension "platform"
externalNativeBuild {
cmake {
cppFlags " -I" + file("${project.rootDir}/third_party/wavesdk/build/wvr_client/include").absolutePath +
" -DWAVEVR"
arguments "-DVR_SDK_LIB=wavevr-lib", "-DWAVEVR=ON"
}
}
applicationIdSuffix ".wavevr"
}
wavevrStore {
minSdkVersion build_versions.min_sdk_wave
dimension "platform"
externalNativeBuild {
cmake {
cppFlags " -I" + file("${project.rootDir}/third_party/wavesdk/build/wvr_client/include").absolutePath +
" -DWAVEVR"
arguments "-DVR_SDK_LIB=wavevr-lib", "-DWAVEVR=ON"
}
}
}
picovr {
dimension "platform"
externalNativeBuild {
cmake {
cppFlags " -DPICOVR"
arguments "-DVR_SDK_LIB=picovr-lib", "-DPICOVR=ON"
}
}
}
noapi {
dimension "platform"
externalNativeBuild {
cmake {
cppFlags " -DVRBROWSER_NO_VR_API"
arguments "-DNOAPI=ON"
}
}
}
// Supported ABIs
arm64 {
dimension "abi"
ndk {
abiFilters "arm64-v8a"
}
}
x86_64 {
dimension "abi"
ndk {
abiFilters "x86_64"
}
}
}
variantFilter { variant ->
def needed = variant.name in [
'oculusvrArm64Debug',
'oculusvrArm64Release',
'oculusvrStoreArm64Debug',
'oculusvrStoreArm64Release',
'oculusvr3dofStoreArm64Debug',
'oculusvr3dofStoreArm64Release',
'picovrArm64Debug',
'picovrArm64Release',
'wavevrArm64Debug',
'wavevrArm64Release',
'wavevrStoreArm64Debug',
'wavevrStoreArm64Release',
'noapiArm64Debug',
'noapiArm64Release',
'noapiX86_64Debug',
'noapiX86_64Release'
]
variant.setIgnore(!needed)
}
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'
]
}
oculusvrStore {
java.srcDirs = [
'src/oculusvr/java'
]
assets.srcDirs = [
'src/oculusvr/assets'
]
res.srcDirs = [
'src/oculusvr/res'
]
}
oculusvr3dofStore {
java.srcDirs = [
'src/oculusvr/java'
]
assets.srcDirs = [
'src/oculusvr/assets'
]
res.srcDirs = [
'src/oculusvr/res'
]
}
oculusvrArm64Debug {
manifest.srcFile "src/oculusvrArmDebug/AndroidManifest.xml"
}
oculusvrArm64Release {
manifest.srcFile getUseDebugSigningOnRelease() ? "src/oculusvrArmDebug/AndroidManifest.xml"
: "src/oculusvrArmRelease/AndroidManifest.xml"
}
oculusvrStoreArm64Debug {
manifest.srcFile "src/oculusvrArmDebug/AndroidManifest.xml"
}
oculusvrStoreArm64Release {
manifest.srcFile getUseDebugSigningOnRelease() ? "src/oculusvrArmDebug/AndroidManifest.xml"
: "src/oculusvrArmRelease/AndroidManifest.xml"
}
oculusvr3dofStoreArm64Debug {
manifest.srcFile "src/oculusvrArmDebug/AndroidManifest.xml"
}
oculusvr3dofStoreArm64Release {
manifest.srcFile getUseDebugSigningOnRelease() ? "src/oculusvrArmDebug/AndroidManifest.xml"
: "src/oculusvrArmRelease/AndroidManifest.xml"
}
wavevr {
java.srcDirs = [
'src/wavevr/java'
]
res.srcDirs = [
'src/wavevr/res'
]
jniLibs.srcDirs = ["${project.rootDir}/third_party/wavesdk/build/wvr_client/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/jni"]
manifest.srcFile "src/wavevr/AndroidManifest.xml"
}
picovr {
java.srcDirs = [
'src/picovr/java'
]
jniLibs.srcDirs = ["${project.rootDir}/third_party/picovr"]
}
noapi {
java.srcDirs = [
'src/noapi/java'
]
}
}
testOptions {
unitTests.includeAndroidResources = true
}
aaptOptions {
noCompress 'ja'
}
}
configurations {
armImplementation
x86Implementation
all*.exclude group: 'androidx.appcompat', module: 'appcompat'
}
repositories {
flatDir {
dirs 'aars'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation deps.openwnn
// Common
implementation deps.lifecycle.runtime
implementation deps.lifecycle.viewmodel
implementation deps.support.cardview
//implementation deps.support.app_compat
implementation(name:'appcompat', ext:'aar')
implementation deps.support.vector_drawable
implementation deps.support.annotations
implementation deps.constraint_layout
implementation deps.gson
implementation deps.room.runtime
annotationProcessor deps.room.compiler
// Android Components
implementation deps.mozilla_speech
implementation deps.android_components.telemetry
implementation deps.android_components.browser_errorpages
implementation deps.android_components.browser_search
implementation deps.android_components.browser_storage
implementation deps.android_components.browser_domains
implementation deps.android_components.service_accounts
implementation deps.android_components.mozilla_service_location
implementation deps.android_components.ui_autocomplete
implementation deps.android_components.concept_fetch
implementation deps.android_components.lib_fetch
implementation deps.android_components.support_rustlog
implementation deps.android_components.support_rusthttp
implementation deps.android_components.glean
implementation deps.app_services.rustlog
// TODO this should not be necessary at all, see Services.kt
implementation deps.work.runtime
// TODO this should not be necessary at all, see Services.kt
implementation deps.work.runtime
// 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
// Testing
androidTestImplementation deps.atsl.runner
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
testImplementation deps.telemetry.glean_unittests
testImplementation deps.work.testing
// Pico
picovrImplementation fileTree(dir: "${project.rootDir}/third_party/picovr/", include: ['*.jar'])
}
if (findProject(':servo')) {
dependencies {
oculusvrImplementation project(':servo')
}
}
if (findProject(':wavesdk')) {
dependencies {
wavevrImplementation project(':wavesdk')
wavevrStoreImplementation project(':wavesdk')
}
}
dependencies {
// To see what the latest geckoview-nightly version is go here:
// https://maven.mozilla.org/?prefix=maven2/org/mozilla/geckoview/geckoview-nightly-armeabi-v7a/
armImplementation deps.gecko_view.nightly_armv7a
arm64Implementation deps.gecko_view.nightly_arm64
x86_64Implementation deps.gecko_view.nightly_x86_64
}
if (gradle.hasProperty('geckoViewLocalArm') || gradle.hasProperty('geckoViewLocalX86')) {
throw new GradleException("geckoViewLocal{Arm,X86} are deprecated: use geckoViewLocalTopsrcdir and geckoViewLocalTopobjdir")
}
if (gradle.hasProperty('localProperties.dependencySubstitutions.geckoviewTopsrcdir')) {
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")
}
}
// -------------------------------------------------------------------------------------------------
// Dynamically set versionCode (See tools/build/versionCode.gradle
// -------------------------------------------------------------------------------------------------
android.applicationVariants.all { variant ->
if (gradle.hasProperty('userProperties.taskclusterBuild')) {
variant.outputs.each { output ->
output.versionCodeOverride = generatedVersionCode
}
}
}