1
0
Fork 0

Closes #2555: Remove appservices gradle plugin, perform megazord substitution by hand.

master
Ryan Kelly 2019-05-16 16:35:43 +10:00 committed by Jeff Boek
parent 04e28096b2
commit 17f8e236aa
3 changed files with 47 additions and 18 deletions

View File

@ -8,19 +8,8 @@ apply plugin: 'kotlin-android-extensions'
apply from: "$project.rootDir/automation/gradle/versionCode.gradle"
apply plugin: 'androidx.navigation.safeargs.kotlin'
apply plugin: 'org.mozilla.appservices'
import com.android.build.gradle.internal.tasks.AppPreBuildTask
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 {
@ -376,7 +365,6 @@ dependencies {
testImplementation Deps.junit
testImplementation Deps.robolectric
implementation Deps.fragment_testing
testImplementation Deps.megazord_forUnitTests
testImplementation Deps.places_forUnitTests
testImplementation Deps.mockito_core
@ -414,4 +402,44 @@ task printGeckoviewVersions {
// 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'
apply from: 'https://github.com/mozilla-mobile/android-components/raw/master/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 {
def megazord = "fenix-megazord"
def appServicesGroup = "org.mozilla.appservices"
def appServicesVersion = null
configurations.each { configuration ->
configuration.resolutionStrategy.eachDependency { DependencyResolveDetails dependency ->
if (dependency.requested.group == appServicesGroup) {
// Ensure that we only depend on a single, consistent version of appservices.
if (appServicesVersion == null) {
appServicesVersion = dependency.requested.version
} else {
if (dependency.requested.version != appServicesVersion) {
logger.lifecycle("In ${configuration}: mismatched '${appServicesGroup}` dependency version:" +
" '${dependency.requested.group}:${dependency.requested.name}:${dependency.requested.version}'" +
" does not have expected version ${appServicesVersion}")
throw new RuntimeException("mismatched '${appServicesGroup}` dependency version")
}
}
// Check whether it was already megazorded.
if (! dependency.requested.name.endsWith("-withoutLib")) {
// Use either the -forUnitTests megazord, or the default one.
def substitution
if (dependency.requested.name.endsWith("-forUnitTests")) {
substitution = "org.mozilla.appservices:${megazord}-forUnitTests:${appServicesVersion}"
} else {
substitution = "org.mozilla.appservices:${megazord}:${appServicesVersion}"
}
logger.lifecycle("In ${configuration}: substituting megazord module '$substitution' for component module" +
" '${dependency.requested.group}:${dependency.requested.name}:${dependency.requested.version}'")
dependency.useTarget(substitution)
}
}
}
}
}

View File

@ -8,7 +8,6 @@ buildscript {
dependencies {
classpath Deps.tools_androidgradle
classpath Deps.tools_kotlingradle
classpath Deps.tools_appservicesgradle
classpath Deps.androidx_safeargs
classpath Deps.allopen

View File

@ -28,9 +28,13 @@ private object Versions {
const val androidx_core = "1.2.0-alpha01"
const val androidx_transition = "1.1.0-rc01"
const val appservices_gradle_plugin = "0.4.4"
const val mozilla_android_components = "0.54.0-SNAPSHOT"
const val mozilla_appservices = "0.27.0"
// 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 tests, and it's important that it
// be kept in sync with the version used by android-components above.
const val mozilla_appservices = "0.28.1"
const val autodispose = "1.1.0"
const val adjust = "4.11.4"
@ -58,7 +62,6 @@ private object Versions {
object Deps {
const val tools_androidgradle = "com.android.tools.build:gradle:${Versions.android_gradle_plugin}"
const val tools_kotlingradle = "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}"
const val tools_appservicesgradle = "org.mozilla.appservices:gradle-plugin:${Versions.appservices_gradle_plugin}"
const val kotlin_stdlib = "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${Versions.kotlin}"
const val kotlin_coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.coroutines}"
@ -175,7 +178,6 @@ object Deps {
const val uiautomator = "com.android.support.test.uiautomator:uiautomator-v18:${Versions.uiautomator}"
const val robolectric = "org.robolectric:robolectric:${Versions.robolectric}"
const val fragment_testing = "androidx.fragment:fragment-testing:${Versions.androidx_testing}"
const val megazord_forUnitTests = "org.mozilla.appservices:fenix-megazord-forUnitTests:${Versions.mozilla_appservices}"
const val places_forUnitTests = "org.mozilla.appservices:places-forUnitTests:${Versions.mozilla_appservices}"
const val google_ads_id = "com.google.android.gms:play-services-ads-identifier:${Versions.google_ads_id_version}"