2019-01-31 16:27:36 +00:00
|
|
|
plugins {
|
|
|
|
id "com.jetbrains.python.envs" version "0.0.26"
|
2021-10-04 07:00:38 +00:00
|
|
|
id "com.google.protobuf" version "0.8.17"
|
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'
|
2021-06-09 23:48:14 +00:00
|
|
|
apply plugin: 'androidx.benchmark'
|
2018-12-07 20:11:50 +00:00
|
|
|
|
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")
|
|
|
|
}
|
|
|
|
|
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-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\""
|
|
|
|
buildConfigField "String", "AMO_COLLECTION_NAME", "\"7dfae8669acc4312a65e8ba5553036\""
|
|
|
|
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\"," +
|
|
|
|
"\"woop-NoopscooPsnSXQ@jetpack\"" +
|
|
|
|
"}"
|
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-02-27 15:43:43 +00:00
|
|
|
manifestPlaceholders = [
|
2021-02-03 21:24:53 +00:00
|
|
|
"deepLinkScheme": deepLinkSchemeValue
|
2020-02-27 15:43:43 +00:00
|
|
|
]
|
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"
|
|
|
|
} else {
|
|
|
|
buildConfigField "boolean", "MOZILLA_ONLINE", "false"
|
|
|
|
}
|
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
|
|
|
|
|
|
|
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\""
|
2021-02-03 21:24:53 +00:00
|
|
|
manifestPlaceholders = ["deepLinkScheme": deepLinkSchemeValue]
|
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",
|
2021-02-03 21:24:53 +00:00
|
|
|
"deepLinkScheme": deepLinkSchemeValue
|
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",
|
2021-02-03 21:24:53 +00:00
|
|
|
"deepLinkScheme": deepLinkSchemeValue
|
2019-11-15 17:21:11 +00:00
|
|
|
]
|
|
|
|
}
|
2019-04-22 18:02:39 +00:00
|
|
|
}
|
|
|
|
|
2021-07-06 13:02:57 +00:00
|
|
|
buildFeatures {
|
|
|
|
viewBinding true
|
|
|
|
}
|
|
|
|
|
2020-03-24 14:48:32 +00:00
|
|
|
aaptOptions {
|
|
|
|
// 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
|
|
|
|
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
|
|
|
}
|
2020-07-22 13:07:28 +00:00
|
|
|
beta {
|
2021-04-20 15:50:57 +00:00
|
|
|
java.srcDirs = ['src/migration/java']
|
2021-08-30 16:12:48 +00:00
|
|
|
manifest.srcFile "src/migration/AndroidManifest.xml"
|
2020-02-21 12:58:41 +00:00
|
|
|
}
|
2020-07-22 13:07:28 +00:00
|
|
|
release {
|
2021-04-20 15:50:57 +00:00
|
|
|
java.srcDirs = ['src/migration/java']
|
2020-07-22 13:07:28 +00:00
|
|
|
manifest.srcFile "src/migration/AndroidManifest.xml"
|
2019-01-30 00:26:03 +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 {
|
|
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
|
|
}
|
2019-01-29 16:42:10 +00:00
|
|
|
|
|
|
|
lintOptions {
|
|
|
|
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 {
|
|
|
|
exclude 'META-INF/atomicfu.kotlin_module'
|
2021-09-08 14:53:34 +00:00
|
|
|
exclude 'META-INF/AL2.0'
|
|
|
|
exclude 'META-INF/LGPL2.1'
|
2019-04-11 17:34:27 +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 {
|
|
|
|
kotlinCompilerExtensionVersion = Versions.androidx_compose
|
|
|
|
}
|
2019-01-07 20:23:30 +00:00
|
|
|
}
|
|
|
|
|
2019-02-28 17:12:47 +00:00
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
// Set up kotlin-allopen plugin for writing tests
|
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
|
2021-08-11 18:49:22 +00:00
|
|
|
boolean hasTest = gradle.startParameter.taskNames.find { it.contains("test") || it.contains("Test") } != null
|
|
|
|
if (hasTest) {
|
|
|
|
apply plugin: 'kotlin-allopen'
|
|
|
|
allOpen {
|
|
|
|
annotation("org.mozilla.fenix.utils.OpenClass")
|
2019-02-20 02:10:17 +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
|
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
|
2019-06-03 14:32:38 +00:00
|
|
|
def isDebug = variant.buildType.resValues['IS_DEBUG']?.value ?: false
|
|
|
|
def useReleaseVersioning = variant.buildType.buildConfigFields['USE_RELEASE_VERSIONING']?.value ?: false
|
2021-04-28 09:50:57 +00:00
|
|
|
def versionName = variant.buildType.name == 'nightly' ? Config.nightlyVersionName() : Config.releaseVersionName(project)
|
2019-08-23 12:08:37 +00:00
|
|
|
|
2019-08-23 12:44:23 +00:00
|
|
|
println("----------------------------------------------")
|
|
|
|
println("Variant name: " + variant.name)
|
|
|
|
println("Application ID: " + [variant.mergedFlavor.applicationId, variant.buildType.applicationIdSuffix].findAll().join())
|
|
|
|
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.
|
|
|
|
|
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
|
|
|
}
|
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
|
|
|
|
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
// 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'
|
|
|
|
}
|
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"
|
|
|
|
|
2020-10-19 18:07:47 +00:00
|
|
|
configurations {
|
|
|
|
// There's an interaction between Gradle's resolution of dependencies with different types
|
|
|
|
// (@jar, @aar) for `implementation` and `testImplementation` and with Android Studio's built-in
|
|
|
|
// JUnit test runner. The runtime classpath in the built-in JUnit test runner gets the
|
|
|
|
// dependency from the `implementation`, which is type @aar, and therefore the JNA dependency
|
|
|
|
// doesn't provide the JNI dispatch libraries in the correct Java resource directories. I think
|
|
|
|
// what's happening is that @aar type in `implementation` resolves to the @jar type in
|
|
|
|
// `testImplementation`, and that it wins the dependency resolution battle.
|
|
|
|
//
|
|
|
|
// A workaround is to add a new configuration which depends on the @jar type and to reference
|
|
|
|
// the underlying JAR file directly in `testImplementation`. This JAR file doesn't resolve to
|
|
|
|
// the @aar type in `implementation`. This works when invoked via `gradle`, but also sets the
|
|
|
|
// correct runtime classpath when invoked with Android Studio's built-in JUnit test runner.
|
|
|
|
// Success!
|
|
|
|
jnaForTest
|
|
|
|
}
|
|
|
|
|
2018-12-07 20:11:50 +00:00
|
|
|
dependencies {
|
2020-10-19 18:07:47 +00:00
|
|
|
jnaForTest Deps.jna
|
|
|
|
testImplementation files(configurations.jnaForTest.copyRecursive().files)
|
|
|
|
|
2021-04-20 15:50:57 +00:00
|
|
|
implementation Deps.mozilla_browser_engine_gecko
|
2019-08-21 15:32:01 +00:00
|
|
|
|
2019-01-07 20:23:30 +00:00
|
|
|
implementation Deps.kotlin_stdlib
|
2019-04-11 17:34:27 +00:00
|
|
|
implementation Deps.kotlin_coroutines
|
2019-12-13 19:29:27 +00:00
|
|
|
implementation Deps.kotlin_coroutines_android
|
2019-09-04 20:27:30 +00:00
|
|
|
testImplementation Deps.kotlin_coroutines_test
|
2019-01-07 20:23:30 +00:00
|
|
|
implementation Deps.androidx_appcompat
|
|
|
|
implementation Deps.androidx_constraintlayout
|
2019-06-05 19:33:42 +00:00
|
|
|
implementation Deps.androidx_coordinatorlayout
|
2019-01-28 16:46:39 +00:00
|
|
|
|
2019-01-29 16:42:10 +00:00
|
|
|
implementation Deps.sentry
|
2019-03-07 07:19:31 +00:00
|
|
|
|
2021-09-07 17:41:05 +00:00
|
|
|
implementation Deps.mozilla_compose_awesomebar
|
|
|
|
|
|
|
|
implementation Deps.mozilla_concept_awesomebar
|
2020-10-06 21:07:24 +00:00
|
|
|
implementation Deps.mozilla_concept_base
|
2019-01-18 23:33:40 +00:00
|
|
|
implementation Deps.mozilla_concept_engine
|
2020-07-25 22:23:27 +00:00
|
|
|
implementation Deps.mozilla_concept_menu
|
2019-07-12 22:21:02 +00:00
|
|
|
implementation Deps.mozilla_concept_push
|
2019-01-18 23:33:40 +00:00
|
|
|
implementation Deps.mozilla_concept_storage
|
2019-03-13 18:23:00 +00:00
|
|
|
implementation Deps.mozilla_concept_sync
|
2019-07-12 22:21:02 +00:00
|
|
|
implementation Deps.mozilla_concept_toolbar
|
2020-04-23 20:38:35 +00:00
|
|
|
implementation Deps.mozilla_concept_tabstray
|
2019-01-18 23:33:40 +00:00
|
|
|
|
2019-01-23 21:39:53 +00:00
|
|
|
implementation Deps.mozilla_browser_domains
|
2019-02-28 20:46:39 +00:00
|
|
|
implementation Deps.mozilla_browser_icons
|
2019-07-08 16:14:13 +00:00
|
|
|
implementation Deps.mozilla_browser_menu
|
2020-08-03 01:48:10 +00:00
|
|
|
implementation Deps.mozilla_browser_menu2
|
2020-12-18 14:34:33 +00:00
|
|
|
implementation Deps.mozilla_browser_session_storage
|
2019-08-30 16:56:22 +00:00
|
|
|
implementation Deps.mozilla_browser_state
|
2019-01-29 20:04:57 +00:00
|
|
|
implementation Deps.mozilla_browser_storage_sync
|
2020-05-29 01:14:56 +00:00
|
|
|
implementation Deps.mozilla_browser_tabstray
|
|
|
|
implementation Deps.mozilla_browser_thumbnails
|
2019-01-10 00:07:33 +00:00
|
|
|
implementation Deps.mozilla_browser_toolbar
|
|
|
|
|
2020-02-04 06:41:52 +00:00
|
|
|
implementation Deps.mozilla_feature_addons
|
2019-02-15 22:44:43 +00:00
|
|
|
implementation Deps.mozilla_feature_accounts
|
2019-05-31 15:08:13 +00:00
|
|
|
implementation Deps.mozilla_feature_app_links
|
2021-03-12 14:34:45 +00:00
|
|
|
implementation Deps.mozilla_feature_autofill
|
2019-01-24 20:10:16 +00:00
|
|
|
implementation Deps.mozilla_feature_awesomebar
|
2019-01-30 20:47:27 +00:00
|
|
|
implementation Deps.mozilla_feature_contextmenu
|
2019-01-31 17:58:52 +00:00
|
|
|
implementation Deps.mozilla_feature_customtabs
|
2019-01-28 21:26:28 +00:00
|
|
|
implementation Deps.mozilla_feature_downloads
|
2019-01-18 23:33:40 +00:00
|
|
|
implementation Deps.mozilla_feature_intent
|
2019-06-05 13:02:47 +00:00
|
|
|
implementation Deps.mozilla_feature_media
|
2019-01-30 19:41:01 +00:00
|
|
|
implementation Deps.mozilla_feature_prompts
|
2019-07-12 22:21:02 +00:00
|
|
|
implementation Deps.mozilla_feature_push
|
2020-06-23 00:38:58 +00:00
|
|
|
implementation Deps.mozilla_feature_privatemode
|
2019-08-29 19:45:11 +00:00
|
|
|
implementation Deps.mozilla_feature_pwa
|
2019-04-19 21:12:42 +00:00
|
|
|
implementation Deps.mozilla_feature_qr
|
2019-07-08 16:14:13 +00:00
|
|
|
implementation Deps.mozilla_feature_search
|
2019-01-18 23:33:40 +00:00
|
|
|
implementation Deps.mozilla_feature_session
|
2020-05-26 20:25:52 +00:00
|
|
|
implementation Deps.mozilla_feature_syncedtabs
|
2019-01-23 21:39:53 +00:00
|
|
|
implementation Deps.mozilla_feature_toolbar
|
2019-01-23 22:48:15 +00:00
|
|
|
implementation Deps.mozilla_feature_tabs
|
2019-02-13 13:19:20 +00:00
|
|
|
implementation Deps.mozilla_feature_findinpage
|
2020-07-02 02:37:03 +00:00
|
|
|
implementation Deps.mozilla_feature_logins
|
2019-02-28 21:10:52 +00:00
|
|
|
implementation Deps.mozilla_feature_site_permissions
|
2019-05-03 21:01:45 +00:00
|
|
|
implementation Deps.mozilla_feature_readerview
|
2019-05-16 21:02:24 +00:00
|
|
|
implementation Deps.mozilla_feature_tab_collections
|
2020-08-29 19:24:45 +00:00
|
|
|
implementation Deps.mozilla_feature_recentlyclosed
|
2019-12-30 16:05:40 +00:00
|
|
|
implementation Deps.mozilla_feature_top_sites
|
2019-11-26 15:39:54 +00:00
|
|
|
implementation Deps.mozilla_feature_share
|
2019-12-13 19:24:42 +00:00
|
|
|
implementation Deps.mozilla_feature_accounts_push
|
2021-01-29 14:17:54 +00:00
|
|
|
implementation Deps.mozilla_feature_webauthn
|
2019-09-19 18:36:22 +00:00
|
|
|
implementation Deps.mozilla_feature_webcompat
|
2019-11-06 21:46:52 +00:00
|
|
|
implementation Deps.mozilla_feature_webnotifications
|
2020-06-03 18:50:58 +00:00
|
|
|
implementation Deps.mozilla_feature_webcompat_reporter
|
2021-08-18 11:50:44 +00:00
|
|
|
implementation Deps.mozilla_service_pocket
|
2019-02-13 13:19:20 +00:00
|
|
|
|
2020-06-24 16:55:22 +00:00
|
|
|
implementation Deps.mozilla_service_digitalassetlinks
|
2021-03-09 20:54:15 +00:00
|
|
|
implementation Deps.mozilla_service_sync_autofill
|
2019-10-24 16:29:41 +00:00
|
|
|
implementation Deps.mozilla_service_sync_logins
|
2019-02-15 22:44:43 +00:00
|
|
|
implementation Deps.mozilla_service_firefox_accounts
|
2021-09-29 10:13:20 +00:00
|
|
|
implementation(Deps.mozilla_service_glean)
|
2020-01-16 21:12:54 +00:00
|
|
|
implementation Deps.mozilla_service_location
|
2020-11-19 11:17:25 +00:00
|
|
|
implementation Deps.mozilla_service_nimbus
|
2020-01-16 21:12:54 +00:00
|
|
|
|
2021-09-07 17:41:05 +00:00
|
|
|
implementation Deps.mozilla_support_extensions
|
2019-12-05 03:06:05 +00:00
|
|
|
implementation Deps.mozilla_support_base
|
2020-06-12 08:29:24 +00:00
|
|
|
implementation Deps.mozilla_support_images
|
2019-01-23 16:13:05 +00:00
|
|
|
implementation Deps.mozilla_support_ktx
|
2019-02-15 21:19:14 +00:00
|
|
|
implementation Deps.mozilla_support_rustlog
|
2019-07-08 16:14:13 +00:00
|
|
|
implementation Deps.mozilla_support_utils
|
2020-01-04 02:15:35 +00:00
|
|
|
implementation Deps.mozilla_support_locale
|
2020-01-15 05:59:08 +00:00
|
|
|
implementation Deps.mozilla_support_migration
|
2019-10-19 02:19:22 +00:00
|
|
|
|
2019-02-05 21:52:04 +00:00
|
|
|
implementation Deps.mozilla_ui_colors
|
|
|
|
implementation Deps.mozilla_ui_icons
|
2020-08-02 21:23:39 +00:00
|
|
|
implementation Deps.mozilla_lib_publicsuffixlist
|
2020-07-30 18:21:17 +00:00
|
|
|
implementation Deps.mozilla_ui_widgets
|
2020-11-16 21:45:48 +00:00
|
|
|
implementation Deps.mozilla_ui_tabcounter
|
2019-02-05 21:52:04 +00:00
|
|
|
|
2019-01-29 16:42:10 +00:00
|
|
|
implementation Deps.mozilla_lib_crash
|
2019-07-12 22:21:02 +00:00
|
|
|
implementation Deps.mozilla_lib_push_firebase
|
2021-05-10 20:08:08 +00:00
|
|
|
implementation Deps.mozilla_lib_state
|
2019-11-04 22:02:16 +00:00
|
|
|
implementation Deps.mozilla_lib_dataprotect
|
2019-02-13 15:08:35 +00:00
|
|
|
debugImplementation Deps.leakcanary
|
2019-01-29 16:42:10 +00:00
|
|
|
|
2021-07-26 13:20:52 +00:00
|
|
|
implementation Deps.androidx_compose_ui
|
|
|
|
implementation Deps.androidx_compose_ui_tooling
|
|
|
|
implementation Deps.androidx_compose_foundation
|
|
|
|
implementation Deps.androidx_compose_material
|
2019-01-15 01:42:58 +00:00
|
|
|
implementation Deps.androidx_legacy
|
2019-10-30 00:14:12 +00:00
|
|
|
implementation Deps.androidx_biometric
|
2019-07-08 16:14:13 +00:00
|
|
|
implementation Deps.androidx_paging
|
2019-01-30 20:02:11 +00:00
|
|
|
implementation Deps.androidx_preference
|
2019-02-07 23:37:52 +00:00
|
|
|
implementation Deps.androidx_fragment
|
2019-03-07 04:23:57 +00:00
|
|
|
implementation Deps.androidx_navigation_fragment
|
|
|
|
implementation Deps.androidx_navigation_ui
|
2019-04-07 02:06:27 +00:00
|
|
|
implementation Deps.androidx_recyclerview
|
2021-09-02 18:13:56 +00:00
|
|
|
implementation Deps.androidx_lifecycle_common
|
2019-11-06 01:30:04 +00:00
|
|
|
implementation Deps.androidx_lifecycle_livedata
|
2021-09-02 18:13:56 +00:00
|
|
|
implementation Deps.androidx_lifecycle_process
|
2019-06-13 00:14:46 +00:00
|
|
|
implementation Deps.androidx_lifecycle_runtime
|
|
|
|
implementation Deps.androidx_lifecycle_viewmodel
|
2019-05-09 21:19:44 +00:00
|
|
|
implementation Deps.androidx_core
|
2019-06-10 12:50:37 +00:00
|
|
|
implementation Deps.androidx_core_ktx
|
2019-05-09 21:19:44 +00:00
|
|
|
implementation Deps.androidx_transition
|
2019-07-08 16:14:13 +00:00
|
|
|
implementation Deps.androidx_work_ktx
|
2021-10-04 07:00:38 +00:00
|
|
|
implementation Deps.androidx_datastore
|
|
|
|
implementation Deps.protobuf_javalite
|
2019-05-24 21:03:59 +00:00
|
|
|
implementation Deps.google_material
|
2019-02-17 01:04:32 +00:00
|
|
|
|
2019-02-28 17:12:47 +00:00
|
|
|
implementation Deps.adjust
|
|
|
|
implementation Deps.installreferrer // Required by Adjust
|
|
|
|
|
2019-05-03 14:40:22 +00:00
|
|
|
implementation Deps.google_ads_id // Required for the Google Advertising ID
|
|
|
|
|
2020-08-24 19:34:27 +00:00
|
|
|
implementation Deps.google_play_store // Required for in-app reviews
|
|
|
|
|
2019-04-10 16:59:38 +00:00
|
|
|
androidTestImplementation Deps.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
|
|
|
|
implementation 'com.jraska:falcon:2.2.0'
|
2021-09-08 14:53:34 +00:00
|
|
|
|
|
|
|
androidTestImplementation Deps.androidx_compose_ui_test
|
2019-12-30 16:05:40 +00:00
|
|
|
|
2019-04-10 16:59:38 +00:00
|
|
|
androidTestImplementation Deps.espresso_core, {
|
|
|
|
exclude group: 'com.android.support', module: 'support-annotations'
|
|
|
|
}
|
|
|
|
|
|
|
|
androidTestImplementation(Deps.espresso_contrib) {
|
|
|
|
exclude module: 'appcompat-v7'
|
|
|
|
exclude module: 'support-v4'
|
|
|
|
exclude module: 'support-annotations'
|
|
|
|
exclude module: 'recyclerview-v7'
|
|
|
|
exclude module: 'design'
|
|
|
|
exclude module: 'espresso-core'
|
|
|
|
}
|
|
|
|
|
2019-08-08 16:03:39 +00:00
|
|
|
androidTestImplementation Deps.androidx_test_core
|
2019-04-10 16:59:38 +00:00
|
|
|
androidTestImplementation Deps.espresso_idling_resources
|
2019-12-27 15:55:35 +00:00
|
|
|
androidTestImplementation Deps.espresso_intents
|
2019-04-20 21:15:18 +00:00
|
|
|
|
2019-02-20 02:10:17 +00:00
|
|
|
androidTestImplementation Deps.tools_test_runner
|
2019-04-10 16:59:38 +00:00
|
|
|
androidTestImplementation Deps.tools_test_rules
|
|
|
|
androidTestUtil Deps.orchestrator
|
|
|
|
androidTestImplementation Deps.espresso_core, {
|
|
|
|
exclude group: 'com.android.support', module: 'support-annotations'
|
|
|
|
}
|
2019-02-20 02:10:17 +00:00
|
|
|
|
2020-01-13 10:32:10 +00:00
|
|
|
androidTestImplementation Deps.androidx_junit
|
|
|
|
androidTestImplementation Deps.androidx_work_testing
|
2021-06-09 23:48:14 +00:00
|
|
|
androidTestImplementation Deps.androidx_benchmark_junit4
|
2019-07-05 17:38:09 +00:00
|
|
|
androidTestImplementation Deps.mockwebserver
|
2019-06-08 19:12:44 +00:00
|
|
|
testImplementation Deps.mozilla_support_test
|
2020-12-07 12:17:36 +00:00
|
|
|
testImplementation Deps.mozilla_support_test_libstate
|
2019-06-08 19:12:44 +00:00
|
|
|
testImplementation Deps.androidx_junit
|
2019-09-18 14:16:10 +00:00
|
|
|
testImplementation Deps.androidx_work_testing
|
2019-07-26 15:08:01 +00:00
|
|
|
testImplementation (Deps.robolectric) {
|
|
|
|
exclude group: 'org.apache.maven'
|
|
|
|
}
|
|
|
|
|
|
|
|
testImplementation 'org.apache.maven:maven-ant-tasks:2.1.3'
|
2019-07-17 22:09:47 +00:00
|
|
|
implementation Deps.mozilla_support_rusthttp
|
2019-02-20 02:10:17 +00:00
|
|
|
|
|
|
|
testImplementation Deps.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 {
|
|
|
|
protoc {
|
|
|
|
artifact = Deps.protobuf_compiler
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
|
|
if (gradle.hasProperty('localProperties.autoPublish.android-components.dir')) {
|
|
|
|
ext.acSrcDir = gradle."localProperties.autoPublish.android-components.dir"
|
|
|
|
apply from: "../${acSrcDir}/substitute-local-ac.gradle"
|
|
|
|
}
|
2020-02-24 02:20:19 +00:00
|
|
|
|
|
|
|
if (gradle.hasProperty('localProperties.autoPublish.application-services.dir')) {
|
|
|
|
ext.appServicesSrcDir = gradle."localProperties.autoPublish.application-services.dir"
|
|
|
|
apply from: "../${appServicesSrcDir}/build-scripts/substitute-local-appservices.gradle"
|
|
|
|
}
|
2020-06-04 17:18:37 +00:00
|
|
|
|
|
|
|
// Define a reusable task for updating the versions of our built-in web extensions. We automate this
|
|
|
|
// to make sure we never forget to update the version, either in local development or for releases.
|
|
|
|
// In both cases, we want to make sure the latest version of all extensions (including their latest
|
|
|
|
// changes) are installed on first start-up.
|
|
|
|
// We're using the A-C version here as we want to uplift all built-in extensions to A-C (Once that's
|
|
|
|
// done we can also remove the task below):
|
|
|
|
// https://github.com/mozilla-mobile/android-components/issues/7249
|
|
|
|
ext.updateExtensionVersion = { task, extDir ->
|
|
|
|
configure(task) {
|
|
|
|
from extDir
|
|
|
|
include 'manifest.template.json'
|
|
|
|
rename { 'manifest.json' }
|
|
|
|
into extDir
|
|
|
|
|
|
|
|
def values = ['version': AndroidComponents.VERSION + "." + new Date().format('MMddHHmmss')]
|
|
|
|
inputs.properties(values)
|
|
|
|
expand(values)
|
|
|
|
}
|
|
|
|
}
|