mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-02 03:40:16 +00:00
328 lines
12 KiB
Groovy
328 lines
12 KiB
Groovy
plugins {
|
|
id "com.jetbrains.python.envs" version "0.0.26"
|
|
}
|
|
|
|
apply plugin: 'com.android.application'
|
|
apply plugin: 'kotlin-android'
|
|
apply plugin: 'kotlin-android-extensions'
|
|
apply from: "$project.rootDir/automation/gradle/versionCode.gradle"
|
|
apply plugin: 'androidx.navigation.safeargs.kotlin'
|
|
|
|
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
|
|
}
|
|
}
|
|
|
|
android {
|
|
compileSdkVersion 28
|
|
defaultConfig {
|
|
applicationId "org.mozilla.fenix"
|
|
minSdkVersion Config.minSdkVersion
|
|
targetSdkVersion Config.targetSdkVersion
|
|
versionCode Config.versionCode
|
|
versionName Config.versionName + Config.generateVersionSuffix()
|
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
|
manifestPlaceholders.isRaptorEnabled = "false"
|
|
}
|
|
buildTypes {
|
|
release {
|
|
shrinkResources true
|
|
minifyEnabled true
|
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
}
|
|
debug {
|
|
shrinkResources false
|
|
minifyEnabled false
|
|
applicationIdSuffix ".debug"
|
|
manifestPlaceholders.isRaptorEnabled = "true"
|
|
}
|
|
}
|
|
|
|
flavorDimensions "abi", "channel"
|
|
|
|
productFlavors {
|
|
// Processor architectures (abi dimension)
|
|
|
|
arm {
|
|
dimension "abi"
|
|
ndk {
|
|
abiFilter "armeabi-v7a"
|
|
}
|
|
}
|
|
x86 {
|
|
dimension "abi"
|
|
ndk {
|
|
abiFilter "x86"
|
|
}
|
|
}
|
|
aarch64 {
|
|
dimension "abi"
|
|
ndk {
|
|
abiFilter "arm64-v8a"
|
|
}
|
|
}
|
|
|
|
// 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"
|
|
}
|
|
}
|
|
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
}
|
|
|
|
lintOptions {
|
|
lintConfig file("lint.xml")
|
|
}
|
|
}
|
|
|
|
android.applicationVariants.all { variant ->
|
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
// Set up kotlin-allopen plugin for writing tests
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
boolean hasTest = gradle.startParameter.taskNames.find {it.contains("test") || it.contains("Test")} != null
|
|
if (hasTest) {
|
|
apply plugin: 'kotlin-allopen'
|
|
allOpen {
|
|
annotation("org.mozilla.fenix.test.Mockable")
|
|
}
|
|
}
|
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
// Generate version codes for builds
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
def buildType = variant.buildType.name
|
|
|
|
if (buildType == "release") {
|
|
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.
|
|
|
|
// Our generated version code now has a length of 9 (See automation/gradle/versionCode.gradle).
|
|
// Our x86 builds need a higher version code to avoid installing ARM builds on an x86 device
|
|
// with ARM compatibility mode.
|
|
|
|
if (variant.flavorName.contains("x86")) {
|
|
versionCode = versionCode + 2
|
|
} else if (variant.flavorName.contains("aarch64")) {
|
|
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)
|
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
// 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 + '"'
|
|
|
|
def variantName = variant.getName()
|
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
// Adjust: Read token from local file if it exists (Only release builds)
|
|
// -------------------------------------------------------------------------------------------------
|
|
|
|
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("--")
|
|
}
|
|
|
|
// -------------------------------------------------------------------------------------------------
|
|
// 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")
|
|
}
|
|
}
|
|
|
|
androidExtensions {
|
|
experimental = true
|
|
}
|
|
|
|
dependencies {
|
|
implementation project(':architecture')
|
|
|
|
implementation Deps.kotlin_stdlib
|
|
implementation Deps.androidx_appcompat
|
|
implementation Deps.androidx_constraintlayout
|
|
|
|
implementation Deps.rxAndroid
|
|
implementation Deps.rxKotlin
|
|
implementation Deps.anko_commons
|
|
implementation Deps.anko_sdk
|
|
implementation Deps.anko_appcompat
|
|
implementation Deps.anko_constraintlayout
|
|
|
|
implementation Deps.sentry
|
|
|
|
implementation Deps.leanplum
|
|
|
|
implementation Deps.mozilla_concept_engine
|
|
implementation Deps.mozilla_concept_storage
|
|
implementation Deps.mozilla_concept_toolbar
|
|
implementation Deps.mozilla_concept_sync
|
|
|
|
implementation Deps.mozilla_browser_awesomebar
|
|
implementation Deps.mozilla_feature_downloads
|
|
implementation Deps.mozilla_browser_domains
|
|
implementation Deps.mozilla_browser_icons
|
|
implementation Deps.mozilla_browser_engine_gecko_nightly
|
|
implementation Deps.mozilla_browser_session
|
|
implementation Deps.mozilla_browser_storage_sync
|
|
implementation Deps.mozilla_browser_toolbar
|
|
|
|
implementation Deps.mozilla_feature_accounts
|
|
implementation Deps.mozilla_feature_awesomebar
|
|
implementation Deps.mozilla_feature_contextmenu
|
|
implementation Deps.mozilla_feature_customtabs
|
|
implementation Deps.mozilla_feature_downloads
|
|
implementation Deps.mozilla_feature_intent
|
|
implementation Deps.mozilla_feature_prompts
|
|
implementation Deps.mozilla_feature_session
|
|
implementation Deps.mozilla_feature_sync
|
|
implementation Deps.mozilla_feature_toolbar
|
|
implementation Deps.mozilla_feature_tabs
|
|
implementation Deps.mozilla_feature_findinpage
|
|
implementation Deps.mozilla_feature_session_bundling
|
|
implementation Deps.mozilla_feature_site_permissions
|
|
|
|
implementation Deps.mozilla_service_firefox_accounts
|
|
implementation Deps.mozilla_service_fretboard
|
|
implementation Deps.mozilla_service_glean
|
|
|
|
implementation Deps.mozilla_support_ktx
|
|
implementation Deps.mozilla_support_rustlog
|
|
|
|
implementation Deps.mozilla_ui_colors
|
|
implementation Deps.mozilla_ui_icons
|
|
|
|
implementation Deps.mozilla_lib_crash
|
|
debugImplementation Deps.leakcanary
|
|
releaseImplementation Deps.leakcanary_noop
|
|
|
|
armImplementation Deps.geckoview_nightly_arm
|
|
x86Implementation Deps.geckoview_nightly_x86
|
|
aarch64Implementation Deps.geckoview_nightly_aarch64
|
|
|
|
implementation Deps.androidx_legacy
|
|
implementation Deps.androidx_preference
|
|
implementation Deps.androidx_fragment
|
|
implementation Deps.androidx_navigation_fragment
|
|
implementation Deps.androidx_navigation_ui
|
|
|
|
implementation Deps.autodispose
|
|
|
|
implementation Deps.adjust
|
|
implementation Deps.installreferrer // Required by Adjust
|
|
|
|
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
|
|
|
|
implementation Deps.glide
|
|
annotationProcessor Deps.glideAnnotationProcessor
|
|
}
|
|
|
|
if (project.hasProperty("raptor")) {
|
|
android.defaultConfig.manifestPlaceholders.isRaptorEnabled = "true"
|
|
}
|
|
|
|
// 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'
|