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-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
|
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 {
|
|
|
|
compileSdkVersion 28
|
|
|
|
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-02-25 23:32:17 +00:00
|
|
|
manifestPlaceholders.isRaptorEnabled = "false"
|
2019-06-03 14:32:38 +00:00
|
|
|
resValue "bool", "IS_DEBUG", "false"
|
|
|
|
buildConfigField "boolean", "USE_RELEASE_VERSIONING", "false"
|
2019-04-22 18:02:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
def releaseTemplate = {
|
|
|
|
shrinkResources true
|
|
|
|
minifyEnabled true
|
|
|
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
|
|
matchingFallbacks = ['release'] // Use on the "release" build type in dependencies (AARs)
|
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
|
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"
|
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"
|
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"
|
|
|
|
}
|
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"
|
2019-08-26 15:02:11 +00:00
|
|
|
manifestPlaceholders = [
|
|
|
|
// This release type is meant to replace Firefox (Release channel) and therefore needs to inherit
|
2019-08-26 16:14:47 +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
|
2019-08-26 15:02:11 +00:00
|
|
|
// fatal consequences. For example see:
|
|
|
|
// - https://issuetracker.google.com/issues/36924841
|
|
|
|
// - https://issuetracker.google.com/issues/36905922
|
|
|
|
"sharedUserId": "org.mozilla.firefox.sharedID"
|
|
|
|
]
|
2019-08-22 09:10:23 +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-08-21 15:32:01 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
def flavors = flavors*.name.toString().toLowerCase()
|
|
|
|
|
|
|
|
if (buildType.name == 'fenixBeta' && flavors.contains("geckonightly")) {
|
|
|
|
setIgnore true
|
|
|
|
}
|
|
|
|
|
|
|
|
if (buildType.name == 'fenixProduction' && flavors.contains("geckonightly")) {
|
|
|
|
setIgnore true
|
|
|
|
}
|
2019-08-23 13:22:31 +00:00
|
|
|
|
|
|
|
if (buildType.name == 'fennecProduction' && flavors.contains("geckonightly")) {
|
|
|
|
setIgnore true
|
|
|
|
}
|
2018-12-07 20:11:50 +00:00
|
|
|
}
|
2019-01-07 20:23:30 +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
|
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 {
|
|
|
|
resources.srcDirs += ['src/androidTest/resources']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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 {
|
2019-05-07 21:36:37 +00:00
|
|
|
annotation("org.mozilla.fenix.test.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()
|
|
|
|
buildConfigField 'String', 'BUILD_DATE', '"' + buildDate + '"'
|
|
|
|
|
2019-03-07 07:19:31 +00:00
|
|
|
def variantName = variant.getName()
|
|
|
|
|
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")
|
|
|
|
}
|
2018-12-07 20:11:50 +00:00
|
|
|
}
|
|
|
|
|
2019-01-28 16:46:39 +00:00
|
|
|
androidExtensions {
|
|
|
|
experimental = true
|
|
|
|
}
|
|
|
|
|
2018-12-07 20:11:50 +00:00
|
|
|
dependencies {
|
2019-02-01 14:26:58 +00:00
|
|
|
implementation project(':architecture')
|
|
|
|
|
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-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
|
|
|
|
|
|
|
implementation Deps.rxAndroid
|
|
|
|
implementation Deps.rxKotlin
|
2019-04-04 20:40:39 +00:00
|
|
|
implementation Deps.rxBindings
|
|
|
|
implementation Deps.autodispose
|
|
|
|
implementation Deps.autodispose_android
|
|
|
|
implementation Deps.autodispose_android_aac
|
|
|
|
|
2019-01-28 16:46:39 +00:00
|
|
|
implementation Deps.anko_commons
|
|
|
|
implementation Deps.anko_sdk
|
|
|
|
implementation Deps.anko_constraintlayout
|
2019-01-10 00:07:33 +00:00
|
|
|
|
2019-01-29 16:42:10 +00:00
|
|
|
implementation Deps.sentry
|
2019-03-07 07:19:31 +00:00
|
|
|
implementation Deps.leanplum
|
2019-08-07 16:37:56 +00:00
|
|
|
implementation Deps.osslicenses_library
|
2019-03-07 07:19:31 +00:00
|
|
|
|
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
|
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
|
2019-01-10 00:07:33 +00:00
|
|
|
implementation Deps.mozilla_browser_toolbar
|
|
|
|
|
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
|
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
|
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
|
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-09-02 14:20:58 +00:00
|
|
|
implementation Deps.mozilla_feature_sendtab
|
2019-09-19 18:36:22 +00:00
|
|
|
implementation Deps.mozilla_feature_webcompat
|
2019-02-13 13:19:20 +00:00
|
|
|
|
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-29 19:20:29 +00:00
|
|
|
implementation Deps.mozilla_service_fretboard
|
2019-01-31 16:27:36 +00:00
|
|
|
implementation Deps.mozilla_service_glean
|
2019-08-05 16:14:42 +00:00
|
|
|
implementation Deps.mozilla_service_experiments
|
2019-02-13 13:19:20 +00:00
|
|
|
|
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
|
2019-01-23 16:13:05 +00:00
|
|
|
|
2019-10-19 02:19:22 +00:00
|
|
|
// We only care about support-migration in builds that will be overwriting Fennec.
|
|
|
|
fennecProductionImplementation Deps.mozilla_support_migration
|
|
|
|
|
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
|
|
|
|
|
|
|
implementation Deps.autodispose
|
2019-02-20 02:10:17 +00:00
|
|
|
|
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
|
|
|
|
// androidTestImplementation "tools.fastlane:screengrab:1.2.0"
|
|
|
|
// androidTestImplementation "br.com.concretesolutions:kappuccino:1.2.1"
|
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-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
|
|
|
|
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
|
|
|
// For production builds, the native code for all `org.mozilla.appservices`
|
|
|
|
// dependencies gets compiled together into a single "megazord" build, and
|
|
|
|
// different megazords are published for different subsets of features. Ref
|
|
|
|
// https://mozilla.github.io/application-services/docs/applications/consuming-megazord-libraries.html
|
|
|
|
// We want to use the one that's specifically designed for Fenix.
|
|
|
|
implementation Deps.fenix_megazord
|
|
|
|
testImplementation Deps.fenix_megazord_forUnitTests
|
|
|
|
implementation Deps.mozilla_support_rusthttp
|
|
|
|
modules {
|
|
|
|
module('org.mozilla.appservices:full-megazord') {
|
|
|
|
replacedBy('org.mozilla.appservices:fenix-megazord', 'prefer the fenix megazord, to reduce final application size')
|
|
|
|
}
|
|
|
|
module('org.mozilla.appservices:fenix-megazord') {
|
|
|
|
replacedBy('org.mozilla.appservices:fenix-megazord-forUnitTests', 'prefer the forUnitTests variant if present')
|
|
|
|
}
|
|
|
|
}
|
2019-02-20 02:10:17 +00:00
|
|
|
|
|
|
|
testImplementation Deps.mockito_core
|
|
|
|
androidTestImplementation Deps.mockito_android
|
|
|
|
testImplementation Deps.mockk
|
2019-07-26 02:55:51 +00:00
|
|
|
testImplementation Deps.assertk
|
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.
|
|
|
|
testImplementation Deps.mozilla_service_glean_forUnitTests
|
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 {[
|
|
|
|
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,
|
|
|
|
]}
|
|
|
|
println 'variants: ' + groovy.json.JsonOutput.toJson(variants)
|
2019-03-27 14:23:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-22 19:06:42 +00:00
|
|
|
def glean_android_components_tag = (
|
|
|
|
Versions.mozilla_android_components.endsWith('-SNAPSHOT') ?
|
|
|
|
'master' :
|
|
|
|
'v' + Versions.mozilla_android_components
|
|
|
|
)
|
|
|
|
|
2019-09-12 21:49:49 +00:00
|
|
|
// Generate markdown docs for the collected metrics.
|
|
|
|
ext.gleanGenerateMarkdownDocs = true
|
|
|
|
ext.gleanDocsDirectory = "$rootDir/docs"
|
2019-07-22 19:06:42 +00:00
|
|
|
apply from: 'https://github.com/mozilla-mobile/android-components/raw/' + glean_android_components_tag + '/components/service/glean/scripts/sdk_generator.gradle'
|
2019-05-16 06:35:43 +00:00
|
|
|
|
|
|
|
// For production builds, the native code for all `org.mozilla.appservices` dependencies gets compiled together
|
|
|
|
// into a single "megazord" build, and different megazords are published for different subsets of features.
|
|
|
|
// Ref https://mozilla.github.io/application-services/docs/applications/consuming-megazord-libraries.html
|
|
|
|
// Substitute all appservices dependencies with an appropriate megazord.
|
2019-07-17 22:09:47 +00:00
|
|
|
|
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"
|
|
|
|
}
|