2021-11-24 17:52:02 +00:00
|
|
|
import org.mozilla.fenix.gradle.tasks.ApkSizeTask
|
|
|
|
|
2019-01-31 16:27:36 +00:00
|
|
|
plugins {
|
|
|
|
id "com.jetbrains.python.envs" version "0.0.26"
|
2022-09-16 14:14:03 +00:00
|
|
|
id "com.google.protobuf" version "0.8.19"
|
2019-01-31 16:27:36 +00:00
|
|
|
}
|
|
|
|
|
2018-12-07 20:11:50 +00:00
|
|
|
apply plugin: 'com.android.application'
|
|
|
|
apply plugin: 'kotlin-android'
|
2021-08-19 13:46:47 +00:00
|
|
|
apply plugin: 'kotlin-parcelize'
|
2019-08-09 00:09:54 +00:00
|
|
|
apply plugin: 'jacoco'
|
2019-03-15 03:47:48 +00:00
|
|
|
apply plugin: 'androidx.navigation.safeargs.kotlin'
|
2019-08-07 16:37:56 +00:00
|
|
|
apply plugin: 'com.google.android.gms.oss-licenses-plugin'
|
2019-11-06 01:30:04 +00:00
|
|
|
|
|
|
|
import com.android.build.OutputFile
|
2020-08-04 17:56:28 +00:00
|
|
|
import groovy.json.JsonOutput
|
2019-07-26 15:56:13 +00:00
|
|
|
import org.gradle.internal.logging.text.StyledTextOutput.Style
|
|
|
|
import org.gradle.internal.logging.text.StyledTextOutputFactory
|
2019-11-06 01:30:04 +00:00
|
|
|
|
2019-07-26 15:56:13 +00:00
|
|
|
import static org.gradle.api.tasks.testing.TestResult.ResultType
|
2019-05-06 17:09:29 +00:00
|
|
|
|
2021-06-09 23:48:14 +00:00
|
|
|
apply from: 'benchmark.gradle'
|
|
|
|
|
2018-12-07 20:11:50 +00:00
|
|
|
android {
|
2020-07-09 17:50:51 +00:00
|
|
|
compileSdkVersion Config.compileSdkVersion
|
2020-11-30 14:09:15 +00:00
|
|
|
|
2021-06-09 23:48:14 +00:00
|
|
|
project.maybeConfigForJetpackBenchmark(it)
|
2020-11-30 14:09:15 +00:00
|
|
|
if (project.hasProperty("testBuildType")) {
|
|
|
|
// Allowing to configure the test build type via command line flag (./gradlew -PtestBuildType=beta ..)
|
|
|
|
// in order to run UI tests against other build variants than debug in automation.
|
|
|
|
testBuildType project.property("testBuildType")
|
|
|
|
}
|
|
|
|
|
2023-03-27 15:25:18 +00:00
|
|
|
// This allows overriding the target activity for MozillaOnline builds, which happens
|
|
|
|
// as part of the defaultConfig below, and applies to all other configurations (Nightly,
|
|
|
|
// Beta, and Release.)
|
|
|
|
def targetActivity = "HomeActivity"
|
|
|
|
|
2018-12-07 20:11:50 +00:00
|
|
|
defaultConfig {
|
2019-08-23 12:44:23 +00:00
|
|
|
applicationId "org.mozilla"
|
2019-02-12 19:13:09 +00:00
|
|
|
minSdkVersion Config.minSdkVersion
|
|
|
|
targetSdkVersion Config.targetSdkVersion
|
2019-05-06 17:09:29 +00:00
|
|
|
versionCode 1
|
|
|
|
versionName Config.generateDebugVersionName()
|
2019-06-18 23:38:56 +00:00
|
|
|
vectorDrawables.useSupportLibrary = true
|
2019-04-10 16:59:38 +00:00
|
|
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
|
|
testInstrumentationRunnerArguments clearPackageData: 'true'
|
2019-06-03 14:32:38 +00:00
|
|
|
resValue "bool", "IS_DEBUG", "false"
|
|
|
|
buildConfigField "boolean", "USE_RELEASE_VERSIONING", "false"
|
2021-11-05 00:00:24 +00:00
|
|
|
buildConfigField "String", "GIT_HASH", "\"\"" // see override in release builds for why it's blank.
|
2021-01-21 17:49:19 +00:00
|
|
|
// This should be the "public" base URL of AMO.
|
|
|
|
buildConfigField "String", "AMO_BASE_URL", "\"https://addons.mozilla.org\""
|
2022-12-13 16:25:32 +00:00
|
|
|
buildConfigField "String", "AMO_COLLECTION_NAME", "\"Extensions-for-Android\""
|
2021-01-21 17:49:19 +00:00
|
|
|
buildConfigField "String", "AMO_COLLECTION_USER", "\"mozilla\""
|
2021-02-01 05:02:44 +00:00
|
|
|
// These add-ons should be excluded for Mozilla Online builds.
|
|
|
|
buildConfigField "String[]", "MOZILLA_ONLINE_ADDON_EXCLUSIONS",
|
|
|
|
"{" +
|
|
|
|
"\"uBlock0@raymondhill.net\"," +
|
|
|
|
"\"firefox@ghostery.com\"," +
|
|
|
|
"\"jid1-MnnxcxisBPnSXQ@jetpack\"," +
|
|
|
|
"\"adguardadblocker@adguard.com\"," +
|
|
|
|
"\"foxyproxy@eric.h.jung\"," +
|
|
|
|
"\"{73a6fe31-595d-460b-a920-fcc0f8843232}\"," +
|
|
|
|
"\"jid1-BoFifL9Vbdl2zQ@jetpack\"," +
|
2022-12-19 03:12:19 +00:00
|
|
|
"\"woop-NoopscooPsnSXQ@jetpack\"," +
|
|
|
|
"\"adnauseam@rednoise.org\"" +
|
2021-02-01 05:02:44 +00:00
|
|
|
"}"
|
2021-01-21 17:49:19 +00:00
|
|
|
// This should be the base URL used to call the AMO API.
|
|
|
|
buildConfigField "String", "AMO_SERVER_URL", "\"https://services.addons.mozilla.org\""
|
2020-04-17 20:24:20 +00:00
|
|
|
def deepLinkSchemeValue = "fenix-dev"
|
|
|
|
buildConfigField "String", "DEEP_LINK_SCHEME", "\"$deepLinkSchemeValue\""
|
2020-11-02 10:10:18 +00:00
|
|
|
|
|
|
|
// Build flag for "Mozilla Online" variants. See `Config.isMozillaOnline`.
|
|
|
|
if (project.hasProperty("mozillaOnline") || gradle.hasProperty("localProperties.mozillaOnline")) {
|
|
|
|
buildConfigField "boolean", "MOZILLA_ONLINE", "true"
|
2023-03-27 15:25:18 +00:00
|
|
|
targetActivity = "MozillaOnlineHomeActivity"
|
2020-11-02 10:10:18 +00:00
|
|
|
} else {
|
|
|
|
buildConfigField "boolean", "MOZILLA_ONLINE", "false"
|
|
|
|
}
|
2023-03-27 15:25:18 +00:00
|
|
|
manifestPlaceholders = [
|
|
|
|
"targetActivity": targetActivity,
|
|
|
|
"deepLinkScheme": deepLinkSchemeValue
|
|
|
|
]
|
2019-04-22 18:02:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
def releaseTemplate = {
|
2020-11-30 13:54:46 +00:00
|
|
|
// We allow disabling optimization by passing `-PdisableOptimization` to gradle. This is used
|
|
|
|
// in automation for UI testing non-debug builds.
|
|
|
|
shrinkResources !project.hasProperty("disableOptimization")
|
|
|
|
minifyEnabled !project.hasProperty("disableOptimization")
|
2021-08-04 21:53:00 +00:00
|
|
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
2019-04-22 18:02:39 +00:00
|
|
|
matchingFallbacks = ['release'] // Use on the "release" build type in dependencies (AARs)
|
2020-07-09 22:26:13 +00:00
|
|
|
|
2021-11-05 00:00:24 +00:00
|
|
|
// Changing the build config can cause files that depend on BuildConfig.java to recompile
|
|
|
|
// so we only set the git hash in release builds to avoid possible recompilation in debug builds.
|
|
|
|
buildConfigField "String", "GIT_HASH", "\"${Config.getGitHash()}\""
|
|
|
|
|
2020-07-09 22:26:13 +00:00
|
|
|
if (gradle.hasProperty("localProperties.autosignReleaseWithDebugKey")) {
|
|
|
|
signingConfig signingConfigs.debug
|
|
|
|
}
|
2020-07-22 13:07:28 +00:00
|
|
|
|
|
|
|
if (gradle.hasProperty("localProperties.debuggable")) {
|
|
|
|
debuggable true
|
|
|
|
}
|
2018-12-07 20:11:50 +00:00
|
|
|
}
|
2019-03-28 15:30:55 +00:00
|
|
|
|
2018-12-07 20:11:50 +00:00
|
|
|
buildTypes {
|
2019-01-28 17:00:21 +00:00
|
|
|
debug {
|
2019-02-11 01:30:37 +00:00
|
|
|
shrinkResources false
|
|
|
|
minifyEnabled false
|
2019-08-23 12:44:23 +00:00
|
|
|
applicationIdSuffix ".fenix.debug"
|
2019-06-03 14:32:38 +00:00
|
|
|
resValue "bool", "IS_DEBUG", "true"
|
2019-06-14 18:44:36 +00:00
|
|
|
pseudoLocalesEnabled true
|
2019-01-28 17:00:21 +00:00
|
|
|
}
|
2020-07-22 13:07:28 +00:00
|
|
|
nightly releaseTemplate >> {
|
2019-08-23 12:44:23 +00:00
|
|
|
applicationIdSuffix ".fenix"
|
2019-06-05 15:48:10 +00:00
|
|
|
buildConfigField "boolean", "USE_RELEASE_VERSIONING", "true"
|
2020-07-28 02:27:06 +00:00
|
|
|
def deepLinkSchemeValue = "fenix-nightly"
|
2020-04-17 20:24:20 +00:00
|
|
|
buildConfigField "String", "DEEP_LINK_SCHEME", "\"$deepLinkSchemeValue\""
|
2023-03-27 15:25:18 +00:00
|
|
|
manifestPlaceholders = [
|
|
|
|
"deepLinkScheme": deepLinkSchemeValue,
|
|
|
|
"targetActivity": targetActivity
|
|
|
|
]
|
2019-06-05 15:48:10 +00:00
|
|
|
}
|
2020-07-22 13:07:28 +00:00
|
|
|
beta releaseTemplate >> {
|
2019-08-22 09:10:23 +00:00
|
|
|
buildConfigField "boolean", "USE_RELEASE_VERSIONING", "true"
|
2020-07-22 13:07:28 +00:00
|
|
|
applicationIdSuffix ".firefox_beta"
|
|
|
|
def deepLinkSchemeValue = "fenix-beta"
|
2020-04-17 20:24:20 +00:00
|
|
|
buildConfigField "String", "DEEP_LINK_SCHEME", "\"$deepLinkSchemeValue\""
|
2019-08-26 15:02:11 +00:00
|
|
|
manifestPlaceholders = [
|
2020-07-22 13:07:28 +00:00
|
|
|
// This release type is meant to replace Firefox (Beta channel) and therefore needs to inherit
|
2019-11-20 00:30:56 +00:00
|
|
|
// its sharedUserId for all eternity. See:
|
|
|
|
// https://searchfox.org/mozilla-central/search?q=moz_android_shared_id&case=false®exp=false&path=
|
|
|
|
// Shipping an app update without sharedUserId can have
|
|
|
|
// fatal consequences. For example see:
|
|
|
|
// - https://issuetracker.google.com/issues/36924841
|
|
|
|
// - https://issuetracker.google.com/issues/36905922
|
2020-03-25 16:49:53 +00:00
|
|
|
"sharedUserId": "org.mozilla.firefox.sharedID",
|
2023-03-27 15:25:18 +00:00
|
|
|
"deepLinkScheme": deepLinkSchemeValue,
|
|
|
|
"targetActivity": targetActivity
|
2019-08-26 15:02:11 +00:00
|
|
|
]
|
2019-08-22 09:10:23 +00:00
|
|
|
}
|
2020-07-22 13:07:28 +00:00
|
|
|
release releaseTemplate >> {
|
2019-11-15 17:21:11 +00:00
|
|
|
buildConfigField "boolean", "USE_RELEASE_VERSIONING", "true"
|
2020-07-22 13:07:28 +00:00
|
|
|
applicationIdSuffix ".firefox"
|
|
|
|
def deepLinkSchemeValue = "fenix"
|
2020-04-17 20:24:20 +00:00
|
|
|
buildConfigField "String", "DEEP_LINK_SCHEME", "\"$deepLinkSchemeValue\""
|
2019-11-15 17:21:11 +00:00
|
|
|
manifestPlaceholders = [
|
|
|
|
// This release type is meant to replace Firefox (Release channel) and therefore needs to inherit
|
|
|
|
// its sharedUserId for all eternity. See:
|
|
|
|
// https://searchfox.org/mozilla-central/search?q=moz_android_shared_id&case=false®exp=false&path=
|
|
|
|
// Shipping an app update without sharedUserId can have
|
|
|
|
// fatal consequences. For example see:
|
|
|
|
// - https://issuetracker.google.com/issues/36924841
|
|
|
|
// - https://issuetracker.google.com/issues/36905922
|
2020-03-25 16:49:53 +00:00
|
|
|
"sharedUserId": "org.mozilla.firefox.sharedID",
|
2023-03-27 15:25:18 +00:00
|
|
|
"deepLinkScheme": deepLinkSchemeValue,
|
|
|
|
"targetActivity": targetActivity,
|
2019-11-15 17:21:11 +00:00
|
|
|
]
|
|
|
|
}
|
2023-02-16 10:39:38 +00:00
|
|
|
benchmark releaseTemplate >> {
|
|
|
|
initWith buildTypes.nightly
|
|
|
|
applicationIdSuffix ".fenix"
|
|
|
|
debuggable false
|
|
|
|
}
|
2019-04-22 18:02:39 +00:00
|
|
|
}
|
|
|
|
|
2021-07-06 13:02:57 +00:00
|
|
|
buildFeatures {
|
|
|
|
viewBinding true
|
|
|
|
}
|
|
|
|
|
2023-02-14 13:57:40 +00:00
|
|
|
androidResources {
|
2020-03-24 14:48:32 +00:00
|
|
|
// All JavaScript code used internally by GeckoView is packaged in a
|
|
|
|
// file called omni.ja. If this file is compressed in the APK,
|
|
|
|
// GeckoView must uncompress it before it can do anything else which
|
|
|
|
// causes a significant delay on startup.
|
|
|
|
noCompress 'ja'
|
2020-06-04 17:18:37 +00:00
|
|
|
|
|
|
|
// manifest.template.json is converted to manifest.json at build time.
|
|
|
|
// No need to package the template in the APK.
|
|
|
|
ignoreAssetsPattern "manifest.template.json"
|
2020-03-24 14:48:32 +00:00
|
|
|
}
|
|
|
|
|
2019-04-10 16:59:38 +00:00
|
|
|
testOptions {
|
|
|
|
execution 'ANDROIDX_TEST_ORCHESTRATOR'
|
2019-05-07 21:36:37 +00:00
|
|
|
unitTests.includeAndroidResources = true
|
2020-02-11 20:24:10 +00:00
|
|
|
animationsDisabled = true
|
2019-04-10 16:59:38 +00:00
|
|
|
}
|
|
|
|
|
2019-08-21 15:32:01 +00:00
|
|
|
flavorDimensions "engine"
|
2019-02-13 12:48:11 +00:00
|
|
|
|
2023-01-12 17:54:17 +00:00
|
|
|
flavorDimensions "product"
|
|
|
|
|
|
|
|
productFlavors {
|
|
|
|
fenix {
|
|
|
|
dimension "product"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-11 14:23:35 +00:00
|
|
|
sourceSets {
|
|
|
|
androidTest {
|
2019-11-20 00:30:56 +00:00
|
|
|
resources.srcDirs += ['src/androidTest/resources']
|
2019-07-11 14:23:35 +00:00
|
|
|
}
|
2019-08-21 15:32:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
splits {
|
|
|
|
abi {
|
|
|
|
enable true
|
|
|
|
|
|
|
|
reset()
|
|
|
|
|
|
|
|
include "x86", "armeabi-v7a", "arm64-v8a", "x86_64"
|
2019-02-13 12:48:11 +00:00
|
|
|
}
|
2019-04-02 16:24:43 +00:00
|
|
|
}
|
|
|
|
|
2019-01-07 21:47:47 +00:00
|
|
|
compileOptions {
|
2023-02-08 11:13:35 +00:00
|
|
|
sourceCompatibility JavaVersion.VERSION_11
|
|
|
|
targetCompatibility JavaVersion.VERSION_11
|
2019-01-07 21:47:47 +00:00
|
|
|
}
|
2019-01-29 16:42:10 +00:00
|
|
|
|
2023-02-08 15:28:56 +00:00
|
|
|
lint {
|
2019-01-29 16:42:10 +00:00
|
|
|
lintConfig file("lint.xml")
|
2020-10-05 22:14:02 +00:00
|
|
|
baseline file("lint-baseline.xml")
|
2019-01-29 16:42:10 +00:00
|
|
|
}
|
2019-04-11 17:34:27 +00:00
|
|
|
packagingOptions {
|
2023-02-14 15:53:17 +00:00
|
|
|
resources {
|
|
|
|
excludes += ['META-INF/atomicfu.kotlin_module', 'META-INF/AL2.0', 'META-INF/LGPL2.1']
|
|
|
|
}
|
2019-04-11 17:34:27 +00:00
|
|
|
}
|
2019-08-09 18:11:08 +00:00
|
|
|
|
2023-02-14 15:53:17 +00:00
|
|
|
|
2019-08-09 18:11:08 +00:00
|
|
|
testOptions {
|
|
|
|
unitTests.returnDefaultValues = true
|
2020-11-12 16:09:27 +00:00
|
|
|
|
|
|
|
unitTests.all {
|
|
|
|
// We keep running into memory issues when running our tests. With this config we
|
|
|
|
// reserve more memory and also create a new process after every 80 test classes. This
|
|
|
|
// is a band-aid solution and eventually we should try to find and fix the leaks
|
|
|
|
// instead. :)
|
|
|
|
forkEvery = 80
|
2021-04-29 17:36:58 +00:00
|
|
|
maxHeapSize = "3072m"
|
2020-11-12 16:09:27 +00:00
|
|
|
minHeapSize = "1024m"
|
|
|
|
}
|
2019-08-09 18:11:08 +00:00
|
|
|
}
|
2021-07-26 13:20:52 +00:00
|
|
|
|
|
|
|
buildFeatures {
|
|
|
|
compose true
|
|
|
|
}
|
|
|
|
|
|
|
|
composeOptions {
|
2022-12-11 23:23:38 +00:00
|
|
|
kotlinCompilerExtensionVersion = FenixVersions.androidx_compose_compiler
|
2021-07-26 13:20:52 +00:00
|
|
|
}
|
2021-11-05 00:00:24 +00:00
|
|
|
|
2023-02-09 07:33:54 +00:00
|
|
|
namespace 'org.mozilla.fenix'
|
2019-01-07 20:23:30 +00:00
|
|
|
}
|
|
|
|
|
2021-08-11 18:49:22 +00:00
|
|
|
android.applicationVariants.all { variant ->
|
2019-02-20 02:10:17 +00:00
|
|
|
|
2019-02-28 17:12:47 +00:00
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
// Generate version codes for builds
|
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
|
2022-09-23 14:19:30 +00:00
|
|
|
def isDebug = variant.buildType.resValues['bool/IS_DEBUG']?.value ?: false
|
2019-06-03 14:32:38 +00:00
|
|
|
def useReleaseVersioning = variant.buildType.buildConfigFields['USE_RELEASE_VERSIONING']?.value ?: false
|
2019-08-23 12:08:37 +00:00
|
|
|
|
2019-08-23 12:44:23 +00:00
|
|
|
println("----------------------------------------------")
|
|
|
|
println("Variant name: " + variant.name)
|
2023-02-14 17:15:14 +00:00
|
|
|
println("Application ID: " + [variant.applicationId, variant.buildType.applicationIdSuffix].findAll().join())
|
2019-08-23 12:44:23 +00:00
|
|
|
println("Build type: " + variant.buildType.name)
|
|
|
|
println("Flavor: " + variant.flavorName)
|
|
|
|
println("Telemetry enabled: " + !isDebug)
|
|
|
|
|
2019-06-03 14:32:38 +00:00
|
|
|
if (useReleaseVersioning) {
|
2019-01-07 20:23:30 +00:00
|
|
|
// The Google Play Store does not allow multiple APKs for the same app that all have the
|
|
|
|
// same version code. Therefore we need to have different version codes for our ARM and x86
|
|
|
|
// builds.
|
|
|
|
|
2022-05-19 14:47:37 +00:00
|
|
|
def versionName = variant.buildType.name == 'nightly' ? Config.nightlyVersionName() : Config.releaseVersionName(project)
|
2021-04-28 09:50:57 +00:00
|
|
|
println("versionName override: $versionName")
|
|
|
|
|
2019-08-21 15:32:01 +00:00
|
|
|
variant.outputs.each { output ->
|
2021-08-31 19:34:21 +00:00
|
|
|
def isMozillaOnline = project.hasProperty("mozillaOnline") || gradle.hasProperty("localProperties.mozillaOnline")
|
2019-08-21 15:32:01 +00:00
|
|
|
def abi = output.getFilter(OutputFile.ABI)
|
2021-08-20 03:19:47 +00:00
|
|
|
// If it is a Mozilla Online build, use a unified version code of armeabi-v7a
|
2021-08-31 19:34:21 +00:00
|
|
|
def arch = (isMozillaOnline) ? "armeabi-v7a" : abi
|
2020-07-22 13:07:28 +00:00
|
|
|
// We use the same version code generator, that we inherited from Fennec, across all channels - even on
|
|
|
|
// channels that never shipped a Fennec build.
|
2021-08-20 03:19:47 +00:00
|
|
|
def versionCodeOverride = Config.generateFennecVersionCode(arch)
|
2019-08-21 15:32:01 +00:00
|
|
|
|
2021-08-31 19:34:21 +00:00
|
|
|
println("versionCode for $abi = $versionCodeOverride, isMozillaOnline = $isMozillaOnline")
|
2019-08-23 12:08:37 +00:00
|
|
|
|
|
|
|
output.versionNameOverride = versionName
|
|
|
|
output.versionCodeOverride = versionCodeOverride
|
2019-05-06 17:09:29 +00:00
|
|
|
}
|
2022-05-19 14:47:37 +00:00
|
|
|
} else if (gradle.hasProperty("localProperties.branchBuild.fenix.version")) {
|
|
|
|
def versionName = gradle.getProperty("localProperties.branchBuild.fenix.version")
|
|
|
|
println("versionName override: $versionName")
|
|
|
|
variant.outputs.each { output ->
|
|
|
|
output.versionNameOverride = versionName
|
|
|
|
}
|
2019-01-07 20:23:30 +00:00
|
|
|
}
|
|
|
|
|
2019-02-28 17:12:47 +00:00
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
// BuildConfig: Set variables for Sentry, Crash Reporting, and Telemetry
|
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
|
2019-06-03 14:32:38 +00:00
|
|
|
buildConfigField 'String', 'SENTRY_TOKEN', 'null'
|
|
|
|
if (!isDebug) {
|
2019-02-28 17:12:47 +00:00
|
|
|
buildConfigField 'boolean', 'CRASH_REPORTING', 'true'
|
2019-06-03 14:32:38 +00:00
|
|
|
// Reading sentry token from local file (if it exists). In a release task on taskcluster it will be available.
|
|
|
|
try {
|
|
|
|
def token = new File("${rootDir}/.sentry_token").text.trim()
|
|
|
|
buildConfigField 'String', 'SENTRY_TOKEN', '"' + token + '"'
|
|
|
|
} catch (FileNotFoundException ignored) {}
|
2019-02-28 17:12:47 +00:00
|
|
|
} else {
|
|
|
|
buildConfigField 'boolean', 'CRASH_REPORTING', 'false'
|
|
|
|
}
|
|
|
|
|
2019-06-03 14:32:38 +00:00
|
|
|
if (!isDebug) {
|
2019-02-28 17:12:47 +00:00
|
|
|
buildConfigField 'boolean', 'TELEMETRY', 'true'
|
|
|
|
} else {
|
|
|
|
buildConfigField 'boolean', 'TELEMETRY', 'false'
|
|
|
|
}
|
|
|
|
|
|
|
|
def buildDate = Config.generateBuildDate()
|
2020-05-21 02:41:00 +00:00
|
|
|
// Setting buildDate with every build changes the generated BuildConfig, which slows down the
|
|
|
|
// build. Only do this for non-debug builds, to speed-up builds produced during local development.
|
|
|
|
if (isDebug) {
|
|
|
|
buildConfigField 'String', 'BUILD_DATE', '"debug build"'
|
|
|
|
} else {
|
|
|
|
buildConfigField 'String', 'BUILD_DATE', '"' + buildDate + '"'
|
|
|
|
}
|
2019-03-07 07:19:31 +00:00
|
|
|
|
2019-02-28 17:12:47 +00:00
|
|
|
// -------------------------------------------------------------------------------------------------
|
2019-03-07 07:19:31 +00:00
|
|
|
// Adjust: Read token from local file if it exists (Only release builds)
|
2019-02-28 17:12:47 +00:00
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
print("Adjust token: ")
|
|
|
|
|
2019-06-03 14:32:38 +00:00
|
|
|
if (!isDebug) {
|
2019-02-28 17:12:47 +00:00
|
|
|
try {
|
|
|
|
def token = new File("${rootDir}/.adjust_token").text.trim()
|
|
|
|
buildConfigField 'String', 'ADJUST_TOKEN', '"' + token + '"'
|
|
|
|
println "(Added from .adjust_token file)"
|
|
|
|
} catch (FileNotFoundException ignored) {
|
|
|
|
buildConfigField 'String', 'ADJUST_TOKEN', 'null'
|
|
|
|
println("X_X")
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
buildConfigField 'String', 'ADJUST_TOKEN', 'null'
|
|
|
|
println("--")
|
|
|
|
}
|
2019-03-07 07:19:31 +00:00
|
|
|
|
2020-01-16 21:12:54 +00:00
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
// MLS: Read token from local file if it exists
|
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
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")
|
|
|
|
}
|
2020-12-03 16:30:20 +00:00
|
|
|
|
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
// Nimbus: Read endpoint from local.properties of a local file if it exists
|
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
print("Nimbus endpoint: ")
|
|
|
|
|
|
|
|
if (!isDebug) {
|
|
|
|
try {
|
|
|
|
def url = new File("${rootDir}/.nimbus").text.trim()
|
|
|
|
buildConfigField 'String', 'NIMBUS_ENDPOINT', '"' + url + '"'
|
|
|
|
println "(Added from .nimbus file)"
|
|
|
|
} catch (FileNotFoundException ignored) {
|
|
|
|
buildConfigField 'String', 'NIMBUS_ENDPOINT', 'null'
|
|
|
|
println("X_X")
|
|
|
|
}
|
|
|
|
} else if (gradle.hasProperty("localProperties.nimbus.remote-settings.url")) {
|
|
|
|
def url=gradle.getProperty("localProperties.nimbus.remote-settings.url")
|
|
|
|
buildConfigField 'String', 'NIMBUS_ENDPOINT', '"' + url + '"'
|
|
|
|
println "(Added from local.properties file)"
|
|
|
|
} else {
|
|
|
|
buildConfigField 'String', 'NIMBUS_ENDPOINT', 'null'
|
|
|
|
println("--")
|
|
|
|
}
|
2021-01-28 11:20:07 +00:00
|
|
|
|
2022-11-07 22:36:20 +00:00
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
// Glean: Read custom server URL from local.properties of a local file if it exists
|
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
print("Glean custom server URL: ")
|
|
|
|
|
|
|
|
if (gradle.hasProperty("localProperties.glean.custom.server.url")) {
|
|
|
|
def url=gradle.getProperty("localProperties.glean.custom.server.url")
|
|
|
|
buildConfigField 'String', 'GLEAN_CUSTOM_URL', url
|
|
|
|
println "(Added from local.properties file)"
|
|
|
|
} else {
|
|
|
|
buildConfigField 'String', 'GLEAN_CUSTOM_URL', 'null'
|
|
|
|
println("--")
|
|
|
|
}
|
|
|
|
|
2021-01-28 11:20:07 +00:00
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
// BuildConfig: Set flag for official builds; similar to MOZILLA_OFFICIAL in mozilla-central.
|
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
if (project.hasProperty("official") || gradle.hasProperty("localProperties.official")) {
|
|
|
|
buildConfigField 'Boolean', 'MOZILLA_OFFICIAL', 'true'
|
|
|
|
} else {
|
|
|
|
buildConfigField 'Boolean', 'MOZILLA_OFFICIAL', 'false'
|
|
|
|
}
|
2022-02-01 21:45:55 +00:00
|
|
|
|
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
// BuildConfig: Set remote wallpaper URL using local file if it exists
|
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
print("Wallpaper URL: ")
|
|
|
|
|
|
|
|
try {
|
|
|
|
def token = new File("${rootDir}/.wallpaper_url").text.trim()
|
|
|
|
buildConfigField 'String', 'WALLPAPER_URL', '"' + token + '"'
|
|
|
|
println "(Added from .wallpaper_url file)"
|
|
|
|
} catch (FileNotFoundException ignored) {
|
|
|
|
buildConfigField 'String', 'WALLPAPER_URL', '""'
|
|
|
|
println("--")
|
|
|
|
}
|
2022-05-20 11:30:11 +00:00
|
|
|
|
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
// BuildConfig: Set the Pocket consumer key from a local file if it exists
|
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
print("Pocket consumer key: ")
|
|
|
|
|
|
|
|
try {
|
|
|
|
def token = new File("${rootDir}/.pocket_consumer_key").text.trim()
|
|
|
|
buildConfigField 'String', 'POCKET_CONSUMER_KEY', '"' + token + '"'
|
|
|
|
println "(Added from .pocket_consumer_key file)"
|
|
|
|
} catch (FileNotFoundException ignored) {
|
|
|
|
buildConfigField 'String', 'POCKET_CONSUMER_KEY', '""'
|
|
|
|
println("--")
|
|
|
|
}
|
2018-12-07 20:11:50 +00:00
|
|
|
}
|
|
|
|
|
2021-05-08 00:52:01 +00:00
|
|
|
// Generate Kotlin code for the Fenix Glean metrics.
|
2020-02-27 19:35:49 +00:00
|
|
|
apply plugin: "org.mozilla.telemetry.glean-gradle-plugin"
|
2023-02-24 22:20:46 +00:00
|
|
|
apply plugin: "org.mozilla.appservices.nimbus-gradle-plugin"
|
2022-01-28 12:48:05 +00:00
|
|
|
|
|
|
|
nimbus {
|
|
|
|
// The path to the Nimbus feature manifest file
|
|
|
|
manifestFile = "nimbus.fml.yaml"
|
|
|
|
// The fully qualified class name for the generated features.
|
|
|
|
// Map from the variant name to the channel as experimenter and nimbus understand it.
|
|
|
|
// If nimbus's channels were accurately set up well for this project, then this
|
|
|
|
// shouldn't be needed.
|
|
|
|
channels = [
|
2023-01-12 17:54:17 +00:00
|
|
|
fenixDebug: "developer",
|
|
|
|
fenixNightly: "nightly",
|
|
|
|
fenixBeta: "beta",
|
|
|
|
fenixRelease: "release",
|
2023-02-16 10:39:38 +00:00
|
|
|
fenixBenchmark: "developer",
|
2022-01-28 12:48:05 +00:00
|
|
|
]
|
|
|
|
// This is generated by the FML and should be checked into git.
|
|
|
|
// It will be fetched by Experimenter (the Nimbus experiment website)
|
|
|
|
// and used to inform experiment configuration.
|
2022-04-04 17:45:48 +00:00
|
|
|
experimenterManifest = ".experimenter.yaml"
|
2022-01-28 12:48:05 +00:00
|
|
|
}
|
2023-02-24 22:20:46 +00:00
|
|
|
|
2021-10-22 14:41:46 +00:00
|
|
|
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
|
|
|
|
kotlinOptions {
|
2023-03-20 18:18:56 +00:00
|
|
|
freeCompilerArgs += [
|
|
|
|
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
|
|
|
|
"-opt-in=com.google.accompanist.pager.ExperimentalPagerApi",
|
|
|
|
]
|
2021-10-22 14:41:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-07 20:11:50 +00:00
|
|
|
dependencies {
|
2022-12-09 06:31:12 +00:00
|
|
|
implementation project(':browser-engine-gecko')
|
2022-12-11 23:22:38 +00:00
|
|
|
|
|
|
|
implementation FenixDependencies.kotlin_coroutines
|
|
|
|
implementation FenixDependencies.kotlin_coroutines_android
|
|
|
|
testImplementation FenixDependencies.kotlin_coroutines_test
|
|
|
|
implementation FenixDependencies.androidx_appcompat
|
|
|
|
implementation FenixDependencies.androidx_constraintlayout
|
|
|
|
implementation FenixDependencies.androidx_coordinatorlayout
|
|
|
|
implementation FenixDependencies.google_accompanist_drawablepainter
|
2023-03-07 17:18:31 +00:00
|
|
|
implementation FenixDependencies.google_accompanist_pager
|
2022-12-11 23:22:38 +00:00
|
|
|
|
|
|
|
implementation FenixDependencies.sentry
|
|
|
|
|
2022-12-09 06:31:12 +00:00
|
|
|
implementation project(':compose-awesomebar')
|
|
|
|
implementation project(':compose-cfr')
|
|
|
|
|
|
|
|
implementation project(':concept-awesomebar')
|
|
|
|
implementation project(':concept-base')
|
|
|
|
implementation project(':concept-engine')
|
|
|
|
implementation project(':concept-menu')
|
|
|
|
implementation project(':concept-push')
|
|
|
|
implementation project(':concept-storage')
|
|
|
|
implementation project(':concept-sync')
|
|
|
|
implementation project(':concept-toolbar')
|
|
|
|
implementation project(':concept-tabstray')
|
|
|
|
|
|
|
|
implementation project(':browser-domains')
|
|
|
|
implementation project(':browser-icons')
|
|
|
|
implementation project(':browser-menu')
|
|
|
|
implementation project(':browser-menu2')
|
|
|
|
implementation project(':browser-session-storage')
|
|
|
|
implementation project(':browser-state')
|
|
|
|
implementation project(':browser-storage-sync')
|
|
|
|
implementation project(':browser-tabstray')
|
|
|
|
implementation project(':browser-thumbnails')
|
|
|
|
implementation project(':browser-toolbar')
|
|
|
|
|
|
|
|
implementation project(':feature-addons')
|
|
|
|
implementation project(':feature-accounts')
|
|
|
|
implementation project(':feature-app-links')
|
|
|
|
implementation project(':feature-autofill')
|
|
|
|
implementation project(':feature-awesomebar')
|
|
|
|
implementation project(':feature-contextmenu')
|
|
|
|
implementation project(':feature-customtabs')
|
|
|
|
implementation project(':feature-downloads')
|
|
|
|
implementation project(':feature-intent')
|
|
|
|
implementation project(':feature-media')
|
|
|
|
implementation project(':feature-prompts')
|
|
|
|
implementation project(':feature-push')
|
|
|
|
implementation project(':feature-privatemode')
|
|
|
|
implementation project(':feature-pwa')
|
|
|
|
implementation project(':feature-qr')
|
|
|
|
implementation project(':feature-search')
|
|
|
|
implementation project(':feature-session')
|
|
|
|
implementation project(':feature-syncedtabs')
|
|
|
|
implementation project(':feature-toolbar')
|
|
|
|
implementation project(':feature-tabs')
|
|
|
|
implementation project(':feature-findinpage')
|
|
|
|
implementation project(':feature-logins')
|
|
|
|
implementation project(':feature-sitepermissions')
|
|
|
|
implementation project(':feature-readerview')
|
|
|
|
implementation project(':feature-tab-collections')
|
|
|
|
implementation project(':feature-recentlyclosed')
|
|
|
|
implementation project(':feature-top-sites')
|
|
|
|
implementation project(':feature-share')
|
|
|
|
implementation project(':feature-accounts-push')
|
|
|
|
implementation project(':feature-webauthn')
|
|
|
|
implementation project(':feature-webcompat')
|
|
|
|
implementation project(':feature-webnotifications')
|
|
|
|
implementation project(':feature-webcompat-reporter')
|
|
|
|
|
|
|
|
implementation project(':service-pocket')
|
|
|
|
implementation project(':service-contile')
|
|
|
|
implementation project(':service-digitalassetlinks')
|
|
|
|
implementation project(':service-sync-autofill')
|
|
|
|
implementation project(':service-sync-logins')
|
|
|
|
implementation project(':service-firefox-accounts')
|
|
|
|
implementation project(':service-glean')
|
|
|
|
implementation project(':service-location')
|
|
|
|
implementation project(':service-nimbus')
|
|
|
|
|
|
|
|
implementation project(':support-webextensions')
|
|
|
|
implementation project(':support-base')
|
|
|
|
implementation project(':support-rusterrors')
|
|
|
|
implementation project(':support-images')
|
|
|
|
implementation project(':support-ktx')
|
|
|
|
implementation project(':support-rustlog')
|
|
|
|
implementation project(':support-utils')
|
|
|
|
implementation project(':support-locale')
|
|
|
|
|
|
|
|
implementation project(':ui-colors')
|
|
|
|
implementation project(':ui-icons')
|
|
|
|
implementation project(':lib-publicsuffixlist')
|
|
|
|
implementation project(':ui-widgets')
|
|
|
|
implementation project(':ui-tabcounter')
|
|
|
|
|
|
|
|
implementation project(':lib-crash')
|
|
|
|
implementation project(':lib-crash-sentry')
|
|
|
|
implementation project(':lib-push-firebase')
|
|
|
|
implementation project(':lib-state')
|
|
|
|
implementation project(':lib-dataprotect')
|
|
|
|
|
2022-12-11 23:22:38 +00:00
|
|
|
debugImplementation FenixDependencies.leakcanary
|
2023-04-17 15:13:31 +00:00
|
|
|
debugImplementation FenixDependencies.androidx_compose_ui_tooling
|
2022-12-11 23:22:38 +00:00
|
|
|
|
2023-03-16 17:59:04 +00:00
|
|
|
implementation FenixDependencies.androidx_activity_compose
|
|
|
|
implementation FenixDependencies.androidx_activity_ktx
|
2022-12-11 23:22:38 +00:00
|
|
|
implementation FenixDependencies.androidx_annotation
|
|
|
|
implementation FenixDependencies.androidx_compose_ui
|
2023-04-17 15:13:31 +00:00
|
|
|
implementation FenixDependencies.androidx_compose_ui_tooling_preview
|
2022-12-11 23:22:38 +00:00
|
|
|
implementation FenixDependencies.androidx_compose_foundation
|
|
|
|
implementation FenixDependencies.androidx_compose_material
|
|
|
|
implementation FenixDependencies.androidx_legacy
|
|
|
|
implementation FenixDependencies.androidx_biometric
|
|
|
|
implementation FenixDependencies.androidx_paging
|
|
|
|
implementation FenixDependencies.androidx_preference
|
|
|
|
implementation FenixDependencies.androidx_fragment
|
|
|
|
implementation FenixDependencies.androidx_navigation_fragment
|
|
|
|
implementation FenixDependencies.androidx_navigation_ui
|
|
|
|
implementation FenixDependencies.androidx_recyclerview
|
|
|
|
implementation FenixDependencies.androidx_lifecycle_common
|
|
|
|
implementation FenixDependencies.androidx_lifecycle_livedata
|
|
|
|
implementation FenixDependencies.androidx_lifecycle_process
|
|
|
|
implementation FenixDependencies.androidx_lifecycle_runtime
|
2023-03-14 18:29:51 +00:00
|
|
|
|
2022-12-11 23:22:38 +00:00
|
|
|
implementation FenixDependencies.androidx_lifecycle_viewmodel
|
|
|
|
implementation FenixDependencies.androidx_core
|
|
|
|
implementation FenixDependencies.androidx_core_ktx
|
|
|
|
implementation FenixDependencies.androidx_transition
|
|
|
|
implementation FenixDependencies.androidx_work_ktx
|
|
|
|
implementation FenixDependencies.androidx_datastore
|
2023-04-03 15:26:43 +00:00
|
|
|
implementation FenixDependencies.androidx_data_store_preferences
|
2022-12-11 23:22:38 +00:00
|
|
|
implementation FenixDependencies.protobuf_javalite
|
|
|
|
implementation FenixDependencies.google_material
|
|
|
|
|
|
|
|
implementation FenixDependencies.adjust
|
|
|
|
implementation FenixDependencies.installreferrer // Required by Adjust
|
|
|
|
|
|
|
|
implementation FenixDependencies.google_ads_id // Required for the Google Advertising ID
|
2019-05-03 14:40:22 +00:00
|
|
|
|
2022-10-13 23:55:09 +00:00
|
|
|
// Required for in-app reviews
|
2022-12-11 23:22:38 +00:00
|
|
|
implementation FenixDependencies.google_play_review
|
|
|
|
implementation FenixDependencies.google_play_review_ktx
|
2020-08-24 19:34:27 +00:00
|
|
|
|
2023-02-16 10:39:38 +00:00
|
|
|
implementation FenixDependencies.androidx_profileinstaller
|
|
|
|
|
2022-12-11 23:22:38 +00:00
|
|
|
androidTestImplementation FenixDependencies.uiautomator
|
2019-12-10 11:05:47 +00:00
|
|
|
androidTestImplementation "tools.fastlane:screengrab:2.0.0"
|
2021-05-25 13:22:19 +00:00
|
|
|
// This Falcon version is added to maven central now required for Screengrab
|
2023-01-12 17:05:12 +00:00
|
|
|
androidTestImplementation 'com.jraska:falcon:2.2.0'
|
2021-09-08 14:53:34 +00:00
|
|
|
|
2022-12-11 23:22:38 +00:00
|
|
|
androidTestImplementation FenixDependencies.androidx_compose_ui_test
|
2019-12-30 16:05:40 +00:00
|
|
|
|
2022-12-11 23:22:38 +00:00
|
|
|
androidTestImplementation FenixDependencies.espresso_core, {
|
2019-04-10 16:59:38 +00:00
|
|
|
exclude group: 'com.android.support', module: 'support-annotations'
|
|
|
|
}
|
|
|
|
|
2022-12-11 23:22:38 +00:00
|
|
|
androidTestImplementation(FenixDependencies.espresso_contrib) {
|
2019-04-10 16:59:38 +00:00
|
|
|
exclude module: 'appcompat-v7'
|
|
|
|
exclude module: 'support-v4'
|
|
|
|
exclude module: 'support-annotations'
|
|
|
|
exclude module: 'recyclerview-v7'
|
|
|
|
exclude module: 'design'
|
|
|
|
exclude module: 'espresso-core'
|
2022-04-27 14:53:45 +00:00
|
|
|
exclude module: 'protobuf-lite'
|
2019-04-10 16:59:38 +00:00
|
|
|
}
|
|
|
|
|
2022-12-11 23:22:38 +00:00
|
|
|
androidTestImplementation FenixDependencies.androidx_test_core
|
|
|
|
androidTestImplementation FenixDependencies.espresso_idling_resources
|
|
|
|
androidTestImplementation FenixDependencies.espresso_intents
|
2019-04-20 21:15:18 +00:00
|
|
|
|
2022-12-11 23:22:38 +00:00
|
|
|
androidTestImplementation FenixDependencies.tools_test_runner
|
|
|
|
androidTestImplementation FenixDependencies.tools_test_rules
|
|
|
|
androidTestUtil FenixDependencies.orchestrator
|
|
|
|
androidTestImplementation FenixDependencies.espresso_core, {
|
2019-04-10 16:59:38 +00:00
|
|
|
exclude group: 'com.android.support', module: 'support-annotations'
|
|
|
|
}
|
2019-02-20 02:10:17 +00:00
|
|
|
|
2022-12-11 23:22:38 +00:00
|
|
|
androidTestImplementation FenixDependencies.androidx_junit
|
|
|
|
androidTestImplementation FenixDependencies.androidx_test_extensions
|
|
|
|
androidTestImplementation FenixDependencies.androidx_work_testing
|
|
|
|
androidTestImplementation FenixDependencies.androidx_benchmark_junit4
|
|
|
|
androidTestImplementation FenixDependencies.mockwebserver
|
2022-12-09 06:31:12 +00:00
|
|
|
testImplementation project(':support-test')
|
|
|
|
testImplementation project(':support-test-libstate')
|
2022-12-11 23:22:38 +00:00
|
|
|
testImplementation FenixDependencies.androidx_junit
|
|
|
|
testImplementation FenixDependencies.androidx_test_extensions
|
|
|
|
testImplementation FenixDependencies.androidx_work_testing
|
|
|
|
testImplementation (FenixDependencies.robolectric) {
|
2019-07-26 15:08:01 +00:00
|
|
|
exclude group: 'org.apache.maven'
|
|
|
|
}
|
|
|
|
|
|
|
|
testImplementation 'org.apache.maven:maven-ant-tasks:2.1.3'
|
2022-12-09 06:31:12 +00:00
|
|
|
implementation project(':support-rusthttp')
|
2019-02-20 02:10:17 +00:00
|
|
|
|
2022-12-11 23:22:38 +00:00
|
|
|
androidTestImplementation FenixDependencies.mockk_android
|
|
|
|
testImplementation FenixDependencies.mockk
|
2019-10-22 14:17:15 +00:00
|
|
|
|
|
|
|
// For the initial release of Glean 19, we require consumer applications to
|
|
|
|
// depend on a separate library for unit tests. This will be removed in future releases.
|
2021-04-19 12:17:32 +00:00
|
|
|
testImplementation "org.mozilla.telemetry:glean-native-forUnitTests:${project.ext.glean_version}"
|
2020-03-03 18:44:54 +00:00
|
|
|
|
|
|
|
lintChecks project(":mozilla-lint-rules")
|
2018-12-07 20:11:50 +00:00
|
|
|
}
|
2019-01-29 16:42:10 +00:00
|
|
|
|
2021-10-04 07:00:38 +00:00
|
|
|
protobuf {
|
2021-11-24 18:19:32 +00:00
|
|
|
// Mac M1 workaround until we can bump the version. Dependent on A-S.
|
|
|
|
// See https://github.com/mozilla-mobile/fenix/issues/22321
|
2021-10-04 07:00:38 +00:00
|
|
|
protoc {
|
2021-11-24 18:19:32 +00:00
|
|
|
if (osdetector.os == "osx") {
|
2022-12-11 23:22:38 +00:00
|
|
|
artifact = "${FenixDependencies.protobuf_compiler}:osx-x86_64"
|
2021-11-24 18:19:32 +00:00
|
|
|
} else {
|
2022-12-11 23:22:38 +00:00
|
|
|
artifact = FenixDependencies.protobuf_compiler
|
2021-11-24 18:19:32 +00:00
|
|
|
}
|
2021-10-04 07:00:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Generates the java Protobuf-lite code for the Protobufs in this project. See
|
|
|
|
// https://github.com/google/protobuf-gradle-plugin#customizing-protobuf-compilation
|
|
|
|
// for more information.
|
|
|
|
generateProtoTasks {
|
|
|
|
all().each { task ->
|
|
|
|
task.builtins {
|
|
|
|
java {
|
|
|
|
option 'lite'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-09 00:09:54 +00:00
|
|
|
if (project.hasProperty("coverage")) {
|
2020-08-04 17:56:28 +00:00
|
|
|
tasks.withType(Test).configureEach {
|
2019-08-09 00:09:54 +00:00
|
|
|
jacoco.includeNoLocationClasses = true
|
2021-05-26 09:45:30 +00:00
|
|
|
jacoco.excludes = ['jdk.internal.*']
|
2019-08-09 00:09:54 +00:00
|
|
|
}
|
|
|
|
|
2021-07-06 16:57:18 +00:00
|
|
|
jacoco {
|
|
|
|
toolVersion = "0.8.7"
|
|
|
|
}
|
|
|
|
|
2019-08-09 00:09:54 +00:00
|
|
|
android.applicationVariants.all { variant ->
|
2020-08-05 16:17:30 +00:00
|
|
|
tasks.register("jacoco${variant.name.capitalize()}TestReport", JacocoReport) {
|
|
|
|
dependsOn "test${variant.name.capitalize()}UnitTest"
|
|
|
|
|
2019-08-09 00:09:54 +00:00
|
|
|
reports {
|
|
|
|
xml.enabled = true
|
|
|
|
html.enabled = true
|
|
|
|
}
|
|
|
|
|
|
|
|
def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*',
|
|
|
|
'**/*Test*.*', 'android/**/*.*', '**/*$[0-9].*']
|
|
|
|
def kotlinDebugTree = fileTree(dir: "$project.buildDir/tmp/kotlin-classes/${variant.name}", excludes: fileFilter)
|
|
|
|
def javaDebugTree = fileTree(dir: "$project.buildDir/intermediates/classes/${variant.flavorName}/${variant.buildType.name}",
|
|
|
|
excludes: fileFilter)
|
|
|
|
def mainSrc = "$project.projectDir/src/main/java"
|
|
|
|
|
2020-08-05 16:17:30 +00:00
|
|
|
sourceDirectories.setFrom(files([mainSrc]))
|
|
|
|
classDirectories.setFrom(files([kotlinDebugTree, javaDebugTree]))
|
|
|
|
executionData.setFrom(fileTree(dir: project.buildDir, includes: [
|
|
|
|
"jacoco/test${variant.name.capitalize()}UnitTest.exec",
|
|
|
|
'outputs/code-coverage/connected/*coverage.ec'
|
|
|
|
]))
|
2019-08-09 00:09:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
android {
|
|
|
|
buildTypes {
|
|
|
|
debug {
|
|
|
|
testCoverageEnabled true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-27 14:23:03 +00:00
|
|
|
// -------------------------------------------------------------------------------------------------
|
2019-08-21 15:32:01 +00:00
|
|
|
// Task for printing APK information for the requested variant
|
2019-09-24 14:18:45 +00:00
|
|
|
// Usage: "./gradlew printVariants
|
2019-03-27 14:23:03 +00:00
|
|
|
// -------------------------------------------------------------------------------------------------
|
2020-08-04 17:56:28 +00:00
|
|
|
tasks.register('printVariants') {
|
2019-03-27 14:23:03 +00:00
|
|
|
doLast {
|
2020-10-19 18:07:47 +00:00
|
|
|
def variants = android.applicationVariants.collect { variant -> [
|
|
|
|
apks: variant.outputs.collect { output -> [
|
|
|
|
abi: output.getFilter(com.android.build.VariantOutput.FilterType.ABI),
|
|
|
|
fileName: output.outputFile.name
|
|
|
|
]},
|
|
|
|
build_type: variant.buildType.name,
|
|
|
|
name: variant.name,
|
2019-09-24 14:18:45 +00:00
|
|
|
]}
|
2019-11-07 16:38:17 +00:00
|
|
|
// AndroidTest is a special case not included above
|
|
|
|
variants.add([
|
|
|
|
apks: [[
|
|
|
|
abi: 'noarch',
|
2020-07-22 13:07:28 +00:00
|
|
|
fileName: 'app-debug-androidTest.apk',
|
2019-11-07 16:38:17 +00:00
|
|
|
]],
|
|
|
|
build_type: 'androidTest',
|
|
|
|
name: 'androidTest',
|
|
|
|
])
|
2020-08-04 17:56:28 +00:00
|
|
|
println 'variants: ' + JsonOutput.toJson(variants)
|
2019-03-27 14:23:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-04 02:15:35 +00:00
|
|
|
task buildTranslationArray {
|
2020-08-04 17:56:28 +00:00
|
|
|
// This isn't running as a task, instead the array is build when the gradle file is parsed.
|
|
|
|
// https://github.com/mozilla-mobile/fenix/issues/14175
|
2020-01-04 02:15:35 +00:00
|
|
|
def foundLocales = new StringBuilder()
|
|
|
|
foundLocales.append("new String[]{")
|
|
|
|
|
|
|
|
fileTree("src/main/res").visit { FileVisitDetails details ->
|
2020-10-14 12:03:51 +00:00
|
|
|
if(details.file.path.endsWith("${File.separator}strings.xml")){
|
|
|
|
def languageCode = details.file.parent.tokenize(File.separator).last().replaceAll('values-','').replaceAll('-r','-')
|
2020-01-04 02:15:35 +00:00
|
|
|
languageCode = (languageCode == "values") ? "en-US" : languageCode
|
|
|
|
foundLocales.append("\"").append(languageCode).append("\"").append(",")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
foundLocales.append("}")
|
|
|
|
def foundLocalesString = foundLocales.toString().replaceAll(',}','}')
|
|
|
|
android.defaultConfig.buildConfigField "String[]", "SUPPORTED_LOCALE_ARRAY", foundLocalesString
|
|
|
|
}
|
|
|
|
|
2019-05-16 06:35:43 +00:00
|
|
|
afterEvaluate {
|
2019-07-26 15:56:13 +00:00
|
|
|
|
|
|
|
// Format test output. Ported from AC #2401
|
2020-08-04 17:56:28 +00:00
|
|
|
tasks.withType(Test).configureEach {
|
2019-07-26 15:56:13 +00:00
|
|
|
systemProperty "robolectric.logging", "stdout"
|
|
|
|
systemProperty "logging.test-mode", "true"
|
|
|
|
|
|
|
|
testLogging.events = []
|
|
|
|
|
|
|
|
def out = services.get(StyledTextOutputFactory).create("tests")
|
|
|
|
|
|
|
|
beforeSuite { descriptor ->
|
|
|
|
if (descriptor.getClassName() != null) {
|
|
|
|
out.style(Style.Header).println("\nSUITE: " + descriptor.getClassName())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
beforeTest { descriptor ->
|
|
|
|
out.style(Style.Description).println(" TEST: " + descriptor.getName())
|
|
|
|
}
|
|
|
|
|
|
|
|
onOutput { descriptor, event ->
|
|
|
|
logger.lifecycle(" " + event.message.trim())
|
|
|
|
}
|
|
|
|
|
|
|
|
afterTest { descriptor, result ->
|
|
|
|
switch (result.getResultType()) {
|
|
|
|
case ResultType.SUCCESS:
|
|
|
|
out.style(Style.Success).println(" SUCCESS")
|
|
|
|
break
|
|
|
|
|
|
|
|
case ResultType.FAILURE:
|
|
|
|
out.style(Style.Failure).println(" FAILURE")
|
|
|
|
logger.lifecycle("", result.getException())
|
|
|
|
break
|
|
|
|
|
|
|
|
case ResultType.SKIPPED:
|
|
|
|
out.style(Style.Info).println(" SKIPPED")
|
|
|
|
break
|
|
|
|
}
|
|
|
|
logger.lifecycle("")
|
|
|
|
}
|
|
|
|
}
|
2019-05-16 06:35:43 +00:00
|
|
|
}
|
2019-08-15 21:33:40 +00:00
|
|
|
|
|
|
|
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"
|
|
|
|
}
|
2019-10-04 23:01:12 +00:00
|
|
|
|
2022-05-19 14:47:37 +00:00
|
|
|
def appServicesSrcDir = null
|
2020-02-24 02:20:19 +00:00
|
|
|
if (gradle.hasProperty('localProperties.autoPublish.application-services.dir')) {
|
2022-05-19 14:47:37 +00:00
|
|
|
appServicesSrcDir = gradle.getProperty('localProperties.autoPublish.application-services.dir')
|
|
|
|
} else if (gradle.hasProperty('localProperties.branchBuild.application-services.dir')) {
|
|
|
|
appServicesSrcDir = gradle.getProperty('localProperties.branchBuild.application-services.dir')
|
|
|
|
}
|
|
|
|
if (appServicesSrcDir) {
|
|
|
|
if (appServicesSrcDir.startsWith("/")) {
|
|
|
|
apply from: "${appServicesSrcDir}/build-scripts/substitute-local-appservices.gradle"
|
|
|
|
} else {
|
|
|
|
apply from: "../${appServicesSrcDir}/build-scripts/substitute-local-appservices.gradle"
|
|
|
|
}
|
2020-02-24 02:20:19 +00:00
|
|
|
}
|
2020-06-04 17:18:37 +00:00
|
|
|
|
2022-04-21 10:26:27 +00:00
|
|
|
if (gradle.hasProperty('localProperties.autoPublish.glean.dir')) {
|
|
|
|
ext.gleanSrcDir = gradle."localProperties.autoPublish.glean.dir"
|
|
|
|
apply from: "../${gleanSrcDir}/build-scripts/substitute-local-glean.gradle"
|
|
|
|
}
|
|
|
|
|
2021-11-24 17:52:02 +00:00
|
|
|
android.applicationVariants.all { variant ->
|
|
|
|
tasks.register("apkSize${variant.name.capitalize()}", ApkSizeTask) {
|
|
|
|
variantName = variant.name
|
|
|
|
apks = variant.outputs.collect { output -> output.outputFile.name }
|
|
|
|
dependsOn "package${variant.name.capitalize()}"
|
|
|
|
}
|
|
|
|
}
|
2022-02-17 21:08:32 +00:00
|
|
|
|
|
|
|
// Enable expiration by major version.
|
2022-12-09 06:31:12 +00:00
|
|
|
ext.gleanExpireByVersion = Config.majorVersion()
|