2019-01-31 16:27:36 +00:00
|
|
|
plugins {
|
|
|
|
id "com.jetbrains.python.envs" version "0.0.26"
|
|
|
|
}
|
|
|
|
|
2018-12-07 20:11:50 +00:00
|
|
|
apply plugin: 'com.android.application'
|
|
|
|
apply plugin: 'kotlin-android'
|
|
|
|
apply plugin: 'kotlin-android-extensions'
|
2019-11-26 15:39:54 +00:00
|
|
|
apply plugin: 'kotlin-kapt'
|
2019-08-09 00:09:54 +00:00
|
|
|
apply plugin: 'jacoco'
|
2019-01-07 20:23:30 +00:00
|
|
|
apply from: "$project.rootDir/automation/gradle/versionCode.gradle"
|
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'
|
2018-12-07 20:11:50 +00:00
|
|
|
|
2019-11-06 01:30:04 +00:00
|
|
|
|
|
|
|
import com.android.build.OutputFile
|
2019-07-26 15:56:13 +00:00
|
|
|
import org.gradle.internal.logging.text.StyledTextOutput.Style
|
|
|
|
import org.gradle.internal.logging.text.StyledTextOutputFactory
|
2020-04-01 23:05:09 +00:00
|
|
|
import org.mozilla.fenix.gradle.tasks.LintUnitTestRunner
|
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
|
|
|
|
2018-12-07 20:11:50 +00:00
|
|
|
android {
|
2020-07-09 17:50:51 +00:00
|
|
|
compileSdkVersion Config.compileSdkVersion
|
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"
|
2020-06-29 18:16:06 +00:00
|
|
|
buildConfigField "String", "AMO_COLLECTION", "\"3204bb44a6ef44d39ee34917f28055\""
|
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 = [
|
|
|
|
"isRaptorEnabled": "false",
|
2020-04-17 20:24:20 +00:00
|
|
|
"deepLinkScheme": deepLinkSchemeValue
|
2020-02-27 15:43:43 +00:00
|
|
|
]
|
2019-04-22 18:02:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
def releaseTemplate = {
|
|
|
|
shrinkResources true
|
|
|
|
minifyEnabled true
|
2020-04-24 09:54:31 +00:00
|
|
|
proguardFiles 'proguard-android-optimize-3.5.0-modified.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
|
|
|
|
}
|
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-02-25 23:32:17 +00:00
|
|
|
manifestPlaceholders.isRaptorEnabled = "true"
|
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
|
|
|
}
|
2019-06-03 14:32:38 +00:00
|
|
|
forPerformanceTest releaseTemplate >> { // the ">>" concatenates the raptor-specific options with the template
|
2019-04-22 18:02:39 +00:00
|
|
|
manifestPlaceholders.isRaptorEnabled = "true"
|
2019-08-23 12:44:23 +00:00
|
|
|
applicationIdSuffix ".fenix.performancetest"
|
2019-06-03 14:32:38 +00:00
|
|
|
debuggable true
|
2020-02-21 12:58:41 +00:00
|
|
|
manifestPlaceholders = [
|
|
|
|
// Since we configure this build to behave like a "fennec" flavored build, we need
|
|
|
|
// to set a shared user id for the manifest. The actual values does not matter.
|
|
|
|
// However we pick a unique value to not "clash" with other Fenix/Fennec builds
|
|
|
|
// installed on the device.
|
|
|
|
"sharedUserId": "org.mozilla.fenix.performancetest.sharedID"
|
|
|
|
]
|
2019-04-22 18:02:39 +00:00
|
|
|
}
|
2019-08-21 15:32:01 +00:00
|
|
|
fenixNightly releaseTemplate >> {
|
2019-08-23 12:44:23 +00:00
|
|
|
applicationIdSuffix ".fenix.nightly"
|
2019-06-03 14:32:38 +00:00
|
|
|
buildConfigField "boolean", "USE_RELEASE_VERSIONING", "true"
|
2020-04-17 20:24:20 +00:00
|
|
|
def deepLinkSchemeValue = "fenix-nightly"
|
|
|
|
buildConfigField "String", "DEEP_LINK_SCHEME", "\"$deepLinkSchemeValue\""
|
|
|
|
manifestPlaceholders = ["deepLinkScheme": deepLinkSchemeValue]
|
2019-04-22 18:02:39 +00:00
|
|
|
}
|
2019-08-21 15:32:01 +00:00
|
|
|
fenixBeta releaseTemplate >> {
|
2019-08-23 12:44:23 +00:00
|
|
|
applicationIdSuffix ".fenix.beta"
|
2019-06-03 14:32:38 +00:00
|
|
|
buildConfigField "boolean", "USE_RELEASE_VERSIONING", "true"
|
2020-04-17 20:24:20 +00:00
|
|
|
def deepLinkSchemeValue = "fenix-beta"
|
|
|
|
buildConfigField "String", "DEEP_LINK_SCHEME", "\"$deepLinkSchemeValue\""
|
|
|
|
manifestPlaceholders = ["deepLinkScheme": deepLinkSchemeValue]
|
2019-04-22 18:02:39 +00:00
|
|
|
}
|
2019-08-21 15:32:01 +00:00
|
|
|
fenixProduction 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-04-17 20:24:20 +00:00
|
|
|
def deepLinkSchemeValue = "fenix"
|
|
|
|
buildConfigField "String", "DEEP_LINK_SCHEME", "\"$deepLinkSchemeValue\""
|
|
|
|
manifestPlaceholders = ["deepLinkScheme": deepLinkSchemeValue]
|
2019-06-05 15:48:10 +00:00
|
|
|
}
|
2019-08-22 09:10:23 +00:00
|
|
|
fennecProduction releaseTemplate >> {
|
|
|
|
buildConfigField "boolean", "USE_RELEASE_VERSIONING", "true"
|
2019-08-23 12:44:23 +00:00
|
|
|
applicationIdSuffix ".firefox"
|
2020-04-17 20:24:20 +00:00
|
|
|
def deepLinkSchemeValue = "fenix"
|
|
|
|
buildConfigField "String", "DEEP_LINK_SCHEME", "\"$deepLinkSchemeValue\""
|
2019-08-26 15:02:11 +00:00
|
|
|
manifestPlaceholders = [
|
2019-11-20 00:30:56 +00:00
|
|
|
// 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",
|
2020-04-17 20:24:20 +00:00
|
|
|
"deepLinkScheme": deepLinkSchemeValue
|
2019-08-26 15:02:11 +00:00
|
|
|
]
|
2019-08-22 09:10:23 +00:00
|
|
|
}
|
2019-11-15 17:21:11 +00:00
|
|
|
fennecBeta releaseTemplate >> {
|
|
|
|
buildConfigField "boolean", "USE_RELEASE_VERSIONING", "true"
|
|
|
|
applicationIdSuffix ".firefox_beta"
|
2020-04-17 20:24:20 +00:00
|
|
|
def deepLinkSchemeValue = "fenix-beta"
|
|
|
|
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",
|
2020-04-17 20:24:20 +00:00
|
|
|
"deepLinkScheme": deepLinkSchemeValue
|
2019-11-15 17:21:11 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
fennecNightly releaseTemplate >> {
|
|
|
|
buildConfigField "boolean", "USE_RELEASE_VERSIONING", "true"
|
|
|
|
applicationIdSuffix ".fennec_aurora"
|
2020-04-17 20:24:20 +00:00
|
|
|
def deepLinkSchemeValue = "fenix-nightly"
|
|
|
|
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.fennec.sharedID",
|
2020-04-17 20:24:20 +00:00
|
|
|
"deepLinkScheme": deepLinkSchemeValue
|
2019-11-15 17:21:11 +00:00
|
|
|
]
|
|
|
|
}
|
2019-04-22 18:02:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
variantFilter { // There's a "release" build type that exists by default that we don't use (it's replaced by "nightly" and "beta")
|
|
|
|
if (buildType.name == 'release') {
|
|
|
|
setIgnore true
|
|
|
|
}
|
2019-08-21 15:32:01 +00:00
|
|
|
|
|
|
|
// Current build variant setup:
|
|
|
|
//
|
|
|
|
// | geckoNightly | geckoBeta |
|
|
|
|
// |--------------------|---------------|-----------|
|
|
|
|
// | debug | ✅ | ✅ | Both variants for testing and development.
|
|
|
|
// | forPerformanceTest | ✅ | ✅ | Both variants unless the perf team only cares about Nightly (TBD).
|
|
|
|
// | fenixNightly | ✅ | ✅ | Built with both, but only the "geckoNightly" one is published to Google Play
|
|
|
|
// | fenixBeta | ❌ | ✅ | Fenix Beta ships with GV Beta
|
|
|
|
// | fenixProduction | ❌ | ✅ | Fenix Production ships with GV Beta
|
2019-08-23 13:22:31 +00:00
|
|
|
// | fennecProduction | ❌ | ✅ | Fenix build to replace production Firefox builds
|
2019-11-15 17:21:11 +00:00
|
|
|
// | fennecBeta | ❌ | ✅ | Fenix build to replace beta Firefox builds
|
|
|
|
// | fennecNightly | ✅ | ❌ | Fenix build to replace Nightly Firefox builds
|
2019-08-21 15:32:01 +00:00
|
|
|
|
|
|
|
def flavors = flavors*.name.toString().toLowerCase()
|
|
|
|
|
|
|
|
if (buildType.name == 'fenixBeta' && flavors.contains("geckonightly")) {
|
|
|
|
setIgnore true
|
|
|
|
}
|
|
|
|
|
2020-07-01 09:03:10 +00:00
|
|
|
if (buildType.name == 'fenixProduction' && flavors.contains("geckobeta")) {
|
2019-08-21 15:32:01 +00:00
|
|
|
setIgnore true
|
|
|
|
}
|
2019-08-23 13:22:31 +00:00
|
|
|
|
2019-11-15 17:21:11 +00:00
|
|
|
if ((buildType.name == 'fennecProduction' || buildType.name == 'fennecBeta') && flavors.contains("geckonightly")) {
|
|
|
|
setIgnore true
|
|
|
|
}
|
|
|
|
|
|
|
|
if (buildType.name == 'fennecNightly' && flavors.contains("geckobeta")) {
|
2019-08-23 13:22:31 +00:00
|
|
|
setIgnore true
|
|
|
|
}
|
2018-12-07 20:11:50 +00:00
|
|
|
}
|
2019-01-07 20:23:30 +00:00
|
|
|
|
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
|
|
|
}
|
2019-11-15 17:21:11 +00:00
|
|
|
fennecNightly {
|
|
|
|
java.srcDirs = ['src/migration/java']
|
|
|
|
manifest.srcFile "src/migration/AndroidManifest.xml"
|
|
|
|
}
|
|
|
|
fennecBeta {
|
|
|
|
java.srcDirs = ['src/migration/java']
|
|
|
|
manifest.srcFile "src/migration/AndroidManifest.xml"
|
|
|
|
}
|
|
|
|
fennecProduction {
|
|
|
|
java.srcDirs = ['src/migration/java']
|
|
|
|
manifest.srcFile "src/migration/AndroidManifest.xml"
|
|
|
|
}
|
2020-02-21 12:58:41 +00:00
|
|
|
forPerformanceTest {
|
|
|
|
// We want our performance test builds to use the same code as our "fennec" flavor builds
|
|
|
|
// since those builds will ship to our large user base.
|
|
|
|
java.srcDirs = ['src/migration/java']
|
|
|
|
manifest.srcFile "src/migration/AndroidManifest.xml"
|
|
|
|
}
|
2019-07-11 14:23:35 +00:00
|
|
|
}
|
|
|
|
|
2019-01-07 20:23:30 +00:00
|
|
|
productFlavors {
|
2019-08-21 15:32:01 +00:00
|
|
|
geckoNightly {
|
|
|
|
dimension "engine"
|
2019-05-29 13:19:17 +00:00
|
|
|
}
|
2019-08-21 15:32:01 +00:00
|
|
|
|
|
|
|
geckoBeta {
|
|
|
|
dimension "engine"
|
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")
|
|
|
|
}
|
2019-04-11 17:34:27 +00:00
|
|
|
|
|
|
|
packagingOptions {
|
|
|
|
exclude 'META-INF/atomicfu.kotlin_module'
|
|
|
|
}
|
2019-08-09 18:11:08 +00:00
|
|
|
|
|
|
|
testOptions {
|
|
|
|
unitTests.returnDefaultValues = true
|
|
|
|
}
|
2019-01-07 20:23:30 +00:00
|
|
|
}
|
|
|
|
|
2019-08-21 15:32:01 +00:00
|
|
|
def baseVersionCode = generatedVersionCode
|
|
|
|
|
2019-02-20 02:10:17 +00:00
|
|
|
android.applicationVariants.all { variant ->
|
2019-02-28 17:12:47 +00:00
|
|
|
|
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
// Set up kotlin-allopen plugin for writing tests
|
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
|
2019-03-27 02:54:28 +00:00
|
|
|
boolean hasTest = gradle.startParameter.taskNames.find { it.contains("test") || it.contains("Test") } != null
|
2019-02-20 02:10:17 +00:00
|
|
|
if (hasTest) {
|
|
|
|
apply plugin: 'kotlin-allopen'
|
|
|
|
allOpen {
|
2020-04-03 22:20:11 +00:00
|
|
|
annotation("org.mozilla.fenix.utils.OpenClass")
|
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
|
2019-08-23 12:08:37 +00:00
|
|
|
def versionName = Config.releaseVersionName(project)
|
|
|
|
|
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.
|
|
|
|
|
2019-01-11 00:01:05 +00:00
|
|
|
// Our generated version code now has a length of 9 (See automation/gradle/versionCode.gradle).
|
2019-01-07 20:23:30 +00:00
|
|
|
// Our x86 builds need a higher version code to avoid installing ARM builds on an x86 device
|
|
|
|
// with ARM compatibility mode.
|
|
|
|
|
2019-08-21 15:32:01 +00:00
|
|
|
variant.outputs.each { output ->
|
|
|
|
def abi = output.getFilter(OutputFile.ABI)
|
|
|
|
|
|
|
|
def versionCodeOverride
|
2019-08-23 16:10:25 +00:00
|
|
|
if (variant.name.contains("Fennec")) {
|
|
|
|
versionCodeOverride = Config.generateFennecVersionCode(abi)
|
|
|
|
} else if (abi == "x86_64") {
|
2019-08-21 15:32:01 +00:00
|
|
|
versionCodeOverride = baseVersionCode + 3
|
|
|
|
} else if (abi == "x86") {
|
|
|
|
versionCodeOverride = baseVersionCode + 2
|
|
|
|
} else if (abi == "arm64-v8a") {
|
|
|
|
versionCodeOverride = baseVersionCode + 1
|
|
|
|
} else if (abi == "armeabi-v7a") {
|
|
|
|
versionCodeOverride = baseVersionCode
|
|
|
|
} else {
|
|
|
|
throw RuntimeException("Unknown ABI: $abi")
|
|
|
|
}
|
|
|
|
|
|
|
|
println("versionCode for $abi = $versionCodeOverride")
|
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
|
|
|
|
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
// Leanplum: Read token from local file if it exists
|
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
print("Leanplum token: ")
|
|
|
|
|
|
|
|
try {
|
|
|
|
def parts = new File("${rootDir}/.leanplum_token").text.trim().split(":")
|
|
|
|
def id = parts[0]
|
|
|
|
def key = parts[1]
|
|
|
|
buildConfigField 'String', 'LEANPLUM_ID', '"' + id + '"'
|
|
|
|
buildConfigField 'String', 'LEANPLUM_TOKEN', '"' + key + '"'
|
|
|
|
println "(Added from .leanplum_token file)"
|
|
|
|
} catch (FileNotFoundException ignored) {
|
|
|
|
buildConfigField 'String', 'LEANPLUM_ID', 'null'
|
|
|
|
buildConfigField 'String', 'LEANPLUM_TOKEN', 'null'
|
|
|
|
println("X_X")
|
|
|
|
}
|
2019-09-18 14:15:29 +00:00
|
|
|
|
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
// Digital Asset Links: Read token from local file if it exists
|
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
print("Digital Asset Links token: ")
|
|
|
|
|
|
|
|
try {
|
|
|
|
def token = new File("${rootDir}/.digital_asset_links_token").text.trim()
|
|
|
|
buildConfigField 'String', 'DIGITAL_ASSET_LINKS_TOKEN', '"' + token + '"'
|
|
|
|
println "(Added from .digital_asset_links_token file)"
|
|
|
|
} catch (FileNotFoundException ignored) {
|
|
|
|
buildConfigField 'String', 'DIGITAL_ASSET_LINKS_TOKEN', 'null'
|
|
|
|
println("X_X")
|
|
|
|
}
|
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")
|
|
|
|
}
|
2018-12-07 20:11:50 +00:00
|
|
|
}
|
|
|
|
|
2019-01-28 16:46:39 +00:00
|
|
|
androidExtensions {
|
|
|
|
experimental = true
|
|
|
|
}
|
|
|
|
|
2020-02-27 19:35:49 +00:00
|
|
|
// Generate Kotlin code and markdown docs for the Fenix Glean metrics.
|
|
|
|
ext.gleanGenerateMarkdownDocs = true
|
|
|
|
ext.gleanDocsDirectory = "$rootDir/docs"
|
|
|
|
apply plugin: "org.mozilla.telemetry.glean-gradle-plugin"
|
|
|
|
|
2018-12-07 20:11:50 +00:00
|
|
|
dependencies {
|
2019-08-21 15:32:01 +00:00
|
|
|
geckoNightlyImplementation Deps.mozilla_browser_engine_gecko_nightly
|
|
|
|
geckoBetaImplementation Deps.mozilla_browser_engine_gecko_beta
|
|
|
|
|
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-08-07 16:37:56 +00:00
|
|
|
implementation Deps.osslicenses_library
|
2019-03-07 07:19:31 +00:00
|
|
|
|
2020-01-23 23:03:04 +00:00
|
|
|
implementation Deps.leanplum_core
|
|
|
|
implementation Deps.leanplum_fcm
|
|
|
|
|
2019-01-18 23:33:40 +00:00
|
|
|
implementation Deps.mozilla_concept_engine
|
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-10 00:07:33 +00:00
|
|
|
implementation Deps.mozilla_browser_awesomebar
|
2019-01-29 19:20:29 +00:00
|
|
|
implementation Deps.mozilla_feature_downloads
|
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
|
|
|
|
implementation Deps.mozilla_browser_search
|
2019-01-18 23:33:40 +00:00
|
|
|
implementation Deps.mozilla_browser_session
|
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_support_extensions
|
|
|
|
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
|
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
|
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
|
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
|
2019-02-13 13:19:20 +00:00
|
|
|
|
2020-06-24 16:55:22 +00:00
|
|
|
implementation Deps.mozilla_service_digitalassetlinks
|
2020-05-28 16:37:45 +00:00
|
|
|
implementation Deps.mozilla_service_experiments
|
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
|
2019-01-31 16:27:36 +00:00
|
|
|
implementation Deps.mozilla_service_glean
|
2020-01-16 21:12:54 +00:00
|
|
|
implementation Deps.mozilla_service_location
|
|
|
|
|
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
|
2019-01-23 16:13:05 +00:00
|
|
|
|
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
|
2019-07-08 16:14:13 +00:00
|
|
|
implementation Deps.mozilla_ui_publicsuffixlist
|
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
|
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
|
|
|
|
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
|
2019-11-06 01:30:04 +00:00
|
|
|
implementation Deps.androidx_lifecycle_livedata
|
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
|
2019-05-24 21:03:59 +00:00
|
|
|
implementation Deps.google_material
|
2019-02-17 01:04:32 +00:00
|
|
|
|
2020-03-09 14:22:38 +00:00
|
|
|
implementation Deps.google_flexbox
|
|
|
|
|
2019-09-10 20:29:21 +00:00
|
|
|
implementation Deps.lottie
|
|
|
|
|
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
|
|
|
|
|
2019-04-10 16:59:38 +00:00
|
|
|
androidTestImplementation Deps.uiautomator
|
2019-08-23 20:37:52 +00:00
|
|
|
// Removed pending AndroidX fixes
|
2019-12-10 11:05:47 +00:00
|
|
|
androidTestImplementation "tools.fastlane:screengrab:2.0.0"
|
2019-08-23 20:37:52 +00:00
|
|
|
// androidTestImplementation "br.com.concretesolutions:kappuccino:1.2.1"
|
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
|
2019-07-05 17:38:09 +00:00
|
|
|
androidTestImplementation Deps.mockwebserver
|
2019-06-08 19:12:44 +00:00
|
|
|
testImplementation Deps.mozilla_support_test
|
|
|
|
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.
|
2020-02-27 19:35:49 +00:00
|
|
|
testImplementation "org.mozilla.telemetry:glean-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
|
|
|
|
2019-07-17 22:09:47 +00:00
|
|
|
if (project.hasProperty("raptor")) {
|
|
|
|
android.defaultConfig.manifestPlaceholders.isRaptorEnabled = "true"
|
|
|
|
}
|
|
|
|
|
2019-08-09 00:09:54 +00:00
|
|
|
if (project.hasProperty("coverage")) {
|
|
|
|
tasks.withType(Test) {
|
|
|
|
jacoco.includeNoLocationClasses = true
|
|
|
|
}
|
|
|
|
|
|
|
|
android.applicationVariants.all { variant ->
|
|
|
|
task "jacoco${variant.name.capitalize()}TestReport"(type: JacocoReport, dependsOn: "test${variant.name.capitalize()}UnitTest") {
|
|
|
|
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"
|
|
|
|
|
|
|
|
sourceDirectories = files([mainSrc])
|
|
|
|
classDirectories = files([kotlinDebugTree, javaDebugTree])
|
|
|
|
executionData = fileTree(dir: project.buildDir, includes: [
|
|
|
|
"jacoco/test${variant.name.capitalize()}UnitTest.exec", 'outputs/code-coverage/connected/*coverage.ec'
|
|
|
|
])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
// -------------------------------------------------------------------------------------------------
|
2019-09-24 14:18:45 +00:00
|
|
|
task printVariants {
|
2019-03-27 14:23:03 +00:00
|
|
|
doLast {
|
2019-09-24 14:18:45 +00:00
|
|
|
def variants = android.applicationVariants.collect {[
|
2019-11-20 00:30:56 +00:00
|
|
|
apks: it.variantData.outputScope.apkDatas.collect {[
|
|
|
|
abi: it.filters.find { it.filterType == 'ABI' }.identifier,
|
|
|
|
fileName: it.outputFileName,
|
|
|
|
]},
|
|
|
|
build_type: it.buildType.name,
|
|
|
|
engine: it.productFlavors.find { it.dimension == 'engine' }.name,
|
|
|
|
name: it.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',
|
|
|
|
fileName: 'app-geckoNightly-debug-androidTest.apk',
|
|
|
|
]],
|
|
|
|
build_type: 'androidTest',
|
|
|
|
engine: 'geckoNightly',
|
|
|
|
name: 'androidTest',
|
|
|
|
])
|
2019-09-24 14:18:45 +00:00
|
|
|
println 'variants: ' + groovy.json.JsonOutput.toJson(variants)
|
2019-03-27 14:23:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-04 02:15:35 +00:00
|
|
|
task buildTranslationArray {
|
|
|
|
def foundLocales = new StringBuilder()
|
|
|
|
foundLocales.append("new String[]{")
|
|
|
|
|
|
|
|
fileTree("src/main/res").visit { FileVisitDetails details ->
|
|
|
|
if(details.file.path.endsWith("/strings.xml")){
|
|
|
|
def languageCode = details.file.parent.tokenize('/').last().replaceAll('values-','').replaceAll('-r','-')
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2020-04-01 23:05:09 +00:00
|
|
|
task lintUnitTestRunner(type: LintUnitTestRunner)
|
|
|
|
|
2019-05-16 06:35:43 +00:00
|
|
|
afterEvaluate {
|
2019-07-26 15:56:13 +00:00
|
|
|
|
|
|
|
// Format test output. Ported from AC #2401
|
|
|
|
tasks.matching {it instanceof Test}.all {
|
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.register("updateAdsExtensionVersion", Copy) { task ->
|
|
|
|
updateExtensionVersion(task, 'src/main/assets/extensions/ads')
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.register("updateCookiesExtensionVersion", Copy) { task ->
|
|
|
|
updateExtensionVersion(task, 'src/main/assets/extensions/cookies')
|
|
|
|
}
|
|
|
|
|
|
|
|
preBuild.dependsOn updateAdsExtensionVersion
|
|
|
|
preBuild.dependsOn updateCookiesExtensionVersion
|