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-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'
|
2018-12-07 20:11:50 +00:00
|
|
|
|
2019-02-15 21:19:14 +00:00
|
|
|
apply plugin: 'org.mozilla.appservices'
|
|
|
|
|
|
|
|
appservices {
|
|
|
|
defaultConfig {
|
|
|
|
megazord = 'fenix'
|
|
|
|
// Necessary to allow for local dependency substitutions.
|
|
|
|
// See https://github.com/mozilla-mobile/reference-browser/pull/356#issuecomment-449190236
|
|
|
|
unitTestingEnabled = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-07 20:11:50 +00:00
|
|
|
android {
|
|
|
|
compileSdkVersion 28
|
|
|
|
defaultConfig {
|
|
|
|
applicationId "org.mozilla.fenix"
|
2019-02-12 19:13:09 +00:00
|
|
|
minSdkVersion Config.minSdkVersion
|
|
|
|
targetSdkVersion Config.targetSdkVersion
|
|
|
|
versionCode Config.versionCode
|
|
|
|
versionName Config.versionName + Config.generateVersionSuffix()
|
2018-12-07 20:11:50 +00:00
|
|
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
2019-02-25 23:32:17 +00:00
|
|
|
manifestPlaceholders.isRaptorEnabled = "false"
|
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 {
|
|
|
|
release {
|
2019-02-12 20:54:02 +00:00
|
|
|
shrinkResources true
|
|
|
|
minifyEnabled true
|
|
|
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
2018-12-07 20:11:50 +00:00
|
|
|
}
|
2019-03-28 15:30:55 +00:00
|
|
|
releaseRaptor {
|
|
|
|
initWith release
|
|
|
|
manifestPlaceholders.isRaptorEnabled = "true"
|
|
|
|
matchingFallbacks = ['release']
|
|
|
|
}
|
2019-01-28 17:00:21 +00:00
|
|
|
debug {
|
2019-02-11 01:30:37 +00:00
|
|
|
shrinkResources false
|
|
|
|
minifyEnabled false
|
2019-01-28 17:00:21 +00:00
|
|
|
applicationIdSuffix ".debug"
|
2019-02-25 23:32:17 +00:00
|
|
|
manifestPlaceholders.isRaptorEnabled = "true"
|
2019-01-28 17:00:21 +00:00
|
|
|
}
|
2018-12-07 20:11:50 +00:00
|
|
|
}
|
2019-01-07 20:23:30 +00:00
|
|
|
|
2019-02-27 16:44:43 +00:00
|
|
|
flavorDimensions "abi", "channel"
|
2019-02-13 12:48:11 +00:00
|
|
|
|
2019-01-07 20:23:30 +00:00
|
|
|
productFlavors {
|
2019-02-27 16:44:43 +00:00
|
|
|
// Processor architectures (abi dimension)
|
|
|
|
|
2019-01-30 00:26:03 +00:00
|
|
|
arm {
|
|
|
|
dimension "abi"
|
|
|
|
ndk {
|
|
|
|
abiFilter "armeabi-v7a"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
x86 {
|
|
|
|
dimension "abi"
|
|
|
|
ndk {
|
|
|
|
abiFilter "x86"
|
|
|
|
}
|
|
|
|
}
|
2019-02-13 12:48:11 +00:00
|
|
|
aarch64 {
|
|
|
|
dimension "abi"
|
|
|
|
ndk {
|
|
|
|
abiFilter "arm64-v8a"
|
|
|
|
}
|
|
|
|
}
|
2019-02-27 16:44:43 +00:00
|
|
|
|
|
|
|
// Product channels (channel dimension)
|
|
|
|
|
|
|
|
// "Greenfield" is our clean version of Fenix without any of the "Fennec transition" code.
|
|
|
|
greenfield {
|
|
|
|
dimension "channel"
|
|
|
|
}
|
|
|
|
firefoxNightly {
|
|
|
|
dimension "channel"
|
|
|
|
|
|
|
|
// Aurora was a channel between nightly builds and beta versions. Aurora builds were published on Google
|
|
|
|
// Play. When the Aurora channel was shutdown in April 2017 the decision was made to instead ship Nightly
|
|
|
|
// builds to Google Play using the existing application id. Previously Nightly builds were not available
|
|
|
|
// on Google Play. Since then our Nightly package name is "fennec_aurora" instead of "fennec_nightly".
|
|
|
|
applicationId "org.mozilla.fennec_aurora"
|
|
|
|
}
|
|
|
|
firefoxBeta {
|
|
|
|
dimension "channel"
|
|
|
|
|
|
|
|
applicationId "org.mozilla.firefox_beta"
|
|
|
|
}
|
|
|
|
firefoxRelease {
|
|
|
|
dimension "channel"
|
|
|
|
|
|
|
|
applicationId "org.mozilla.firefox"
|
|
|
|
}
|
2019-01-07 20:23:30 +00:00
|
|
|
}
|
2019-01-07 21:47:47 +00:00
|
|
|
|
2019-04-02 16:24:43 +00:00
|
|
|
variantFilter { variant ->
|
|
|
|
def flavors = variant.flavors*.name.toString().toLowerCase()
|
|
|
|
|
|
|
|
if (!flavors.contains("greenfield")) {
|
|
|
|
// For now everything that isn't a "greenfield" build isn't used. So let's ignore those variants.
|
|
|
|
setIgnore(true)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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-01-07 20:23:30 +00:00
|
|
|
}
|
|
|
|
|
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 {
|
|
|
|
annotation("org.mozilla.fenix.test.Mockable")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-28 17:12:47 +00:00
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
// Generate version codes for builds
|
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
|
2019-01-07 20:23:30 +00:00
|
|
|
def buildType = variant.buildType.name
|
|
|
|
|
2019-02-28 17:12:47 +00:00
|
|
|
if (buildType == "release") {
|
2019-01-07 20:23:30 +00:00
|
|
|
def versionCode = generatedVersionCode
|
|
|
|
|
|
|
|
// 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-01-11 05:41:37 +00:00
|
|
|
if (variant.flavorName.contains("x86")) {
|
2019-02-14 14:17:25 +00:00
|
|
|
versionCode = versionCode + 2
|
|
|
|
} else if (variant.flavorName.contains("aarch64")) {
|
2019-01-07 20:23:30 +00:00
|
|
|
versionCode = versionCode + 1
|
|
|
|
}// else variant.flavorName.contains("Arm")) use generated version code
|
|
|
|
|
|
|
|
variant.outputs.all { output ->
|
|
|
|
setVersionCodeOverride(versionCode)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
println("----------------------------------------------")
|
|
|
|
println("Build type: " + buildType)
|
|
|
|
println("Flavor: " + variant.flavorName)
|
|
|
|
println("Version code: " + variant.mergedFlavor.versionCode)
|
2019-02-28 17:12:47 +00:00
|
|
|
|
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
// BuildConfig: Set variables for Sentry, Crash Reporting, and Telemetry
|
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// 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) {
|
|
|
|
buildConfigField 'String', 'SENTRY_TOKEN', 'null'
|
|
|
|
}
|
|
|
|
|
|
|
|
// Activating crash reporting only if command line parameter was provided (in automation)
|
|
|
|
if (project.hasProperty("crashReports") && project.property("crashReports") == "true") {
|
|
|
|
buildConfigField 'boolean', 'CRASH_REPORTING', 'true'
|
|
|
|
} else {
|
|
|
|
buildConfigField 'boolean', 'CRASH_REPORTING', 'false'
|
|
|
|
}
|
|
|
|
|
|
|
|
// Activating telemetry only if command line parameter was provided (in automation)
|
|
|
|
if (project.hasProperty("telemetry") && project.property("telemetry") == "true") {
|
|
|
|
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: ")
|
|
|
|
|
|
|
|
if (variantName.contains("Release")) {
|
|
|
|
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")
|
|
|
|
}
|
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-01-07 20:23:30 +00:00
|
|
|
implementation Deps.kotlin_stdlib
|
2019-04-11 17:34:27 +00:00
|
|
|
implementation Deps.kotlin_coroutines
|
2019-01-07 20:23:30 +00:00
|
|
|
implementation Deps.androidx_appcompat
|
|
|
|
implementation Deps.androidx_constraintlayout
|
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-03-21 19:41:41 +00:00
|
|
|
implementation Deps.mozilla_places
|
|
|
|
|
2019-01-18 23:33:40 +00:00
|
|
|
implementation Deps.mozilla_concept_engine
|
|
|
|
implementation Deps.mozilla_concept_storage
|
2019-01-23 22:48:15 +00:00
|
|
|
implementation Deps.mozilla_concept_toolbar
|
2019-03-13 18:23:00 +00:00
|
|
|
implementation Deps.mozilla_concept_sync
|
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-04-03 14:38:50 +00:00
|
|
|
implementation Deps.mozilla_browser_engine_gecko_nightly
|
2019-01-18 23:33:40 +00:00
|
|
|
implementation Deps.mozilla_browser_session
|
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-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-01-30 19:41:01 +00:00
|
|
|
implementation Deps.mozilla_feature_prompts
|
2019-01-18 23:33:40 +00:00
|
|
|
implementation Deps.mozilla_feature_session
|
2019-03-13 18:23:00 +00:00
|
|
|
implementation Deps.mozilla_feature_sync
|
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
|
|
|
|
implementation Deps.mozilla_feature_session_bundling
|
2019-02-28 21:10:52 +00:00
|
|
|
implementation Deps.mozilla_feature_site_permissions
|
2019-02-13 13:19:20 +00:00
|
|
|
|
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-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-01-23 16:13:05 +00:00
|
|
|
|
2019-02-05 21:52:04 +00:00
|
|
|
implementation Deps.mozilla_ui_colors
|
|
|
|
implementation Deps.mozilla_ui_icons
|
|
|
|
|
2019-01-29 16:42:10 +00:00
|
|
|
implementation Deps.mozilla_lib_crash
|
2019-02-13 15:08:35 +00:00
|
|
|
debugImplementation Deps.leakcanary
|
|
|
|
releaseImplementation Deps.leakcanary_noop
|
2019-01-29 16:42:10 +00:00
|
|
|
|
2019-04-02 21:41:34 +00:00
|
|
|
implementation Deps.mozilla_lib_fetch_httpurlconnection
|
|
|
|
|
2019-04-05 01:17:49 +00:00
|
|
|
armImplementation Gecko.geckoview_nightly_arm
|
|
|
|
x86Implementation Gecko.geckoview_nightly_x86
|
|
|
|
aarch64Implementation Gecko.geckoview_nightly_aarch64
|
2019-02-13 12:48:11 +00:00
|
|
|
|
2019-01-15 01:42:58 +00:00
|
|
|
implementation Deps.androidx_legacy
|
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-04-04 20:40:39 +00:00
|
|
|
implementation Deps.androidx_lifecycle_viewmodel_ktx
|
2019-02-17 01:04:32 +00:00
|
|
|
|
|
|
|
implementation Deps.autodispose
|
2019-02-20 02:10:17 +00:00
|
|
|
|
2019-02-28 17:12:47 +00:00
|
|
|
implementation Deps.adjust
|
|
|
|
implementation Deps.installreferrer // Required by Adjust
|
|
|
|
|
2019-02-20 02:10:17 +00:00
|
|
|
androidTestImplementation Deps.tools_test_runner
|
|
|
|
androidTestImplementation Deps.tools_espresso_core
|
|
|
|
|
|
|
|
testImplementation Deps.junit_jupiter_api
|
|
|
|
testImplementation Deps.junit_jupiter_params
|
|
|
|
testImplementation Deps.junit_jupiter_engine
|
|
|
|
|
|
|
|
testImplementation Deps.mockito_core
|
|
|
|
androidTestImplementation Deps.mockito_android
|
|
|
|
testImplementation Deps.mockk
|
2019-02-21 17:38:00 +00:00
|
|
|
|
|
|
|
implementation Deps.glide
|
|
|
|
annotationProcessor Deps.glideAnnotationProcessor
|
2019-03-22 21:19:10 +00:00
|
|
|
|
|
|
|
debugImplementation Deps.flipper
|
|
|
|
debugImplementation Deps.soLoader
|
2018-12-07 20:11:50 +00:00
|
|
|
}
|
2019-01-29 16:42:10 +00:00
|
|
|
|
2019-02-25 23:32:17 +00:00
|
|
|
if (project.hasProperty("raptor")) {
|
|
|
|
android.defaultConfig.manifestPlaceholders.isRaptorEnabled = "true"
|
|
|
|
}
|
|
|
|
|
2019-03-27 14:23:03 +00:00
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
// Task for printing all build variants to build variants in parallel in automation
|
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
task printBuildVariants {
|
|
|
|
doLast {
|
|
|
|
def buildVariants = android.applicationVariants.collect { variant ->
|
|
|
|
variant.name
|
|
|
|
}
|
|
|
|
println "variants: " + groovy.json.JsonOutput.toJson(buildVariants)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-31 16:27:36 +00:00
|
|
|
// Normally this should use the same version as the glean dependency. But since we are currently using AC snapshots we
|
|
|
|
// can't reference a git tag with a specific version here. So we are just using "master" and hoping for the best.
|
|
|
|
apply from: 'https://github.com/mozilla-mobile/android-components/raw/master/components/service/glean/scripts/sdk_generator.gradle'
|