From fddf77280c6b86d76ea5ab5e902770cc005d0d41 Mon Sep 17 00:00:00 2001 From: Grisha Kruglov Date: Tue, 25 Feb 2020 13:09:02 -0800 Subject: [PATCH] Remove direct A-S dependency; switch to using 'full' megazord As far as I can tell, we never actually exercise the a-s libraries in Fenix tests currently (this was one of the presumed reasons for having a direct dependency). In a different branch I've started work on adding end-to-end tests, but currently that's blocked on trying to figure out to load native libraries in tests (somehow, fenix's setup is different than what we have in A-C, not yet clear to me in what way). Another reason for a direct dependency (i think) is that we needed it to configure a `fenix` megazord. This could be solved via a `support-megazord-fenix` a-c component that provides the correct transient dependencies, but we can also just switch to use the `full` megazord instead, which is essentially what fenix megazord is at this point. A-S team wants to remove the fenix megazord, so this will help. This is what this patch does. --- app/build.gradle | 20 ------------------- .../org/mozilla/fenix/FenixApplication.kt | 8 ++++---- buildSrc/src/main/java/Dependencies.kt | 10 ---------- 3 files changed, 4 insertions(+), 34 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 70ec18313..faeb66ae0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -530,22 +530,7 @@ dependencies { } testImplementation 'org.apache.maven:maven-ant-tasks:2.1.3' - // 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') - } - } testImplementation Deps.mockito_core androidTestImplementation Deps.mockito_android @@ -654,11 +639,6 @@ ext.gleanGenerateMarkdownDocs = true ext.gleanDocsDirectory = "$rootDir/docs" apply from: 'https://github.com/mozilla-mobile/android-components/raw/' + glean_android_components_tag + '/components/service/glean/scripts/sdk_generator.gradle' -// 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. - afterEvaluate { // Format test output. Ported from AC #2401 diff --git a/app/src/main/java/org/mozilla/fenix/FenixApplication.kt b/app/src/main/java/org/mozilla/fenix/FenixApplication.kt index 2c6e9ae94..be3419594 100644 --- a/app/src/main/java/org/mozilla/fenix/FenixApplication.kt +++ b/app/src/main/java/org/mozilla/fenix/FenixApplication.kt @@ -191,10 +191,10 @@ open class FenixApplication : LocaleAwareApplication() { /** * Initiate Megazord sequence! Megazord Battle Mode! * - * The application-services combined libraries are known as the "megazord". The default megazord - * contains several features that fenix doesn't need, and so we swap out with a customized fenix-specific - * version of the megazord. The best explanation for what this is, and why it's done is the a-s - * documentation on the topic: + * The application-services combined libraries are known as the "megazord". We use the default `full` + * megazord - it contains everything that fenix needs, and (currently) nothing more. + * + * Documentation on what megazords are, and why they're needed: * - https://github.com/mozilla/application-services/blob/master/docs/design/megazords.md * - https://mozilla.github.io/application-services/docs/applications/consuming-megazord-libraries.html */ diff --git a/buildSrc/src/main/java/Dependencies.kt b/buildSrc/src/main/java/Dependencies.kt index 007846b73..21243a44e 100644 --- a/buildSrc/src/main/java/Dependencies.kt +++ b/buildSrc/src/main/java/Dependencies.kt @@ -33,13 +33,6 @@ object Versions { const val google_material = "1.1.0" const val mozilla_android_components = "34.0.0-SNAPSHOT" - // Note that android-components also depends on application-services, - // and in fact is our main source of appservices-related functionality. - // The version number below tracks the application-services version - // that we depend on directly for the fenix-megazord (and for it's - // forUnitTest variant), and it's important that it be kept in - // sync with the version used by android-components above. - const val mozilla_appservices = "0.50.0" const val mozilla_glean = "25.0.0" @@ -207,9 +200,6 @@ object Deps { const val androidx_junit = "androidx.test.ext:junit:${Versions.androidx_test_ext}" const val androidx_test_core = "androidx.test:core:${Versions.androidx_testing}" - const val fenix_megazord = "org.mozilla.appservices:fenix-megazord:${Versions.mozilla_appservices}" - const val fenix_megazord_forUnitTests = "org.mozilla.appservices:fenix-megazord-forUnitTests:${Versions.mozilla_appservices}" - const val google_ads_id = "com.google.android.gms:play-services-ads-identifier:${Versions.google_ads_id_version}" const val lottie = "com.airbnb.android:lottie:${Versions.airbnb_lottie}"