build.gradle (2565B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 import com.android.build.api.dsl.ManagedVirtualDevice 6 7 plugins { 8 id 'com.android.test' 9 id 'org.jetbrains.kotlin.android' 10 } 11 12 android { 13 namespace = 'org.mozilla.fenix.benchmark' 14 15 compileSdk { version = release(config.compileSdkMajorVersion) { minorApiLevel = config.compileSdkMinorVersion } } 16 17 defaultConfig { 18 minSdk config.minSdkVersion 19 targetSdk config.targetSdkVersion 20 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 21 } 22 23 buildTypes { 24 // This benchmark buildType is used for benchmarking, and should function like your 25 // release build (for example, with minification on). It's signed with a debug key 26 // for easy local testing. 27 benchmark { 28 debuggable = true 29 signingConfig = signingConfigs.debug 30 matchingFallbacks = ["release"] 31 } 32 } 33 34 targetProjectPath = ":app" 35 experimentalProperties["android.experimental.self-instrumenting"] = true 36 37 testOptions { 38 managedDevices { 39 devices { 40 pixel6Api34(ManagedVirtualDevice) { 41 device = "Pixel 6" 42 apiLevel = 34 43 systemImageSource = "google" 44 } 45 } 46 } 47 } 48 } 49 50 /** 51 * This fixes the dependency resolution issue with Glean Native. The glean gradle plugin does this 52 * and that's applied to the app module. Since there are no other uses of the glean plugin in the 53 * benchmark module, we do this manually here. 54 */ 55 configurations.configureEach { 56 resolutionStrategy.capabilitiesResolution.withCapability("org.mozilla.telemetry:glean-native") { 57 def toBeSelected = candidates.find { it.id instanceof ModuleComponentIdentifier && it.id.module.contains('geckoview') } 58 if (toBeSelected != null) { 59 select(toBeSelected) 60 } 61 because 'use GeckoView Glean instead of standalone Glean' 62 } 63 } 64 65 dependencies { 66 implementation libs.androidx.benchmark.macro.junit4 67 implementation libs.androidx.core.ktx 68 implementation libs.androidx.test.espresso.core 69 implementation libs.androidx.test.junit 70 implementation libs.androidx.test.uiautomator 71 implementation libs.mockwebserver 72 } 73 74 androidComponents { 75 beforeVariants(selector().all()) { 76 enabled = buildType == "benchmark" 77 } 78 }