Use dependency substitution as a replacement for excludes.
These test artifacts have a dependency on the support annotation binary but we want them to use the version that's being built in the repo instead.
Test: ./gradlew build
Change-Id: I8cb59b1ac4d3956bdfd8286fd2205c2e998c35a1
diff --git a/buildSrc/dependencies.gradle b/buildSrc/dependencies.gradle
index 470551b..48d3eb9 100644
--- a/buildSrc/dependencies.gradle
+++ b/buildSrc/dependencies.gradle
@@ -16,10 +16,6 @@
// Add ext.libs for library versions
def libs = [:]
-libs.exclude_annotations = {
- exclude module: 'support-annotations'
-}
-
libs.exclude_bytebuddy = {
exclude group: 'net.bytebuddy'
}
diff --git a/buildSrc/src/main/kotlin/android/support/SupportAndroidLibraryPlugin.kt b/buildSrc/src/main/kotlin/android/support/SupportAndroidLibraryPlugin.kt
index 391fcc2..5eaa7dd 100644
--- a/buildSrc/src/main/kotlin/android/support/SupportAndroidLibraryPlugin.kt
+++ b/buildSrc/src/main/kotlin/android/support/SupportAndroidLibraryPlugin.kt
@@ -37,6 +37,8 @@
SupportLibraryExtension::class.java, project)
apply(project, supportLibraryExtension)
+ val isCoreSupportLibrary = project.rootProject.name == "support"
+
project.afterEvaluate {
val library = project.extensions.findByType(LibraryExtension::class.java)
?: return@afterEvaluate
@@ -75,6 +77,21 @@
project.apply(mapOf("plugin" to "com.android.library"))
project.apply(mapOf("plugin" to ErrorProneBasePlugin::class.java))
+ project.configurations.all { configuration ->
+ if (isCoreSupportLibrary) {
+ // In projects which compile as part of the "core" support libraries (which include
+ // the annotations), replace any transitive pointer to the deployed Maven
+ // coordinate version of annotations with a reference to the local project. These
+ // usually originate from test dependencies and otherwise cause multiple copies on
+ // the classpath. We do not do this for non-"core" projects as they need to
+ // depend on the Maven coordinate variant.
+ configuration.resolutionStrategy.dependencySubstitution.apply {
+ substitute(module("com.android.support:support-annotations"))
+ .with(project(":support-annotations"))
+ }
+ }
+ }
+
val library = project.extensions.findByType(LibraryExtension::class.java)
?: throw Exception("Failed to find Android extension")
diff --git a/car/build.gradle b/car/build.gradle
index 487f2bc..3970df9 100644
--- a/car/build.gradle
+++ b/car/build.gradle
@@ -12,8 +12,8 @@
api project(':support-v4')
api project(':recyclerview-v7')
- androidTestImplementation(TEST_RUNNER, libs.exclude_annotations)
- androidTestImplementation(ESPRESSO_CORE, libs.exclude_annotations)
+ androidTestImplementation(TEST_RUNNER)
+ androidTestImplementation(ESPRESSO_CORE)
androidTestImplementation(ESPRESSO_CONTRIB, libs.exclude_support)
androidTestImplementation(MOCKITO_CORE, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
androidTestImplementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
diff --git a/compat/build.gradle b/compat/build.gradle
index b3fa298..a26eac8 100644
--- a/compat/build.gradle
+++ b/compat/build.gradle
@@ -13,8 +13,8 @@
transitive = true
}
- androidTestImplementation(TEST_RUNNER, libs.exclude_annotations)
- androidTestImplementation(ESPRESSO_CORE, libs.exclude_annotations)
+ androidTestImplementation(TEST_RUNNER)
+ androidTestImplementation(ESPRESSO_CORE)
androidTestImplementation(MOCKITO_CORE, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
androidTestImplementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
androidTestImplementation project(':support-testutils'), {
diff --git a/content/build.gradle b/content/build.gradle
index 15f96c4..9091053 100644
--- a/content/build.gradle
+++ b/content/build.gradle
@@ -27,8 +27,8 @@
api(project(":support-compat"))
androidTestImplementation(JUNIT)
- androidTestImplementation(TEST_RUNNER, libs.exclude_annotations)
- androidTestImplementation(ESPRESSO_CORE, libs.exclude_annotations)
+ androidTestImplementation(TEST_RUNNER)
+ androidTestImplementation(ESPRESSO_CORE)
}
android {
diff --git a/core-ui/build.gradle b/core-ui/build.gradle
index 8bab1cb..f7cd2d7 100644
--- a/core-ui/build.gradle
+++ b/core-ui/build.gradle
@@ -11,8 +11,8 @@
api(project(":support-compat"))
api project(':support-core-utils')
- androidTestImplementation(TEST_RUNNER, libs.exclude_annotations)
- androidTestImplementation(ESPRESSO_CORE, libs.exclude_annotations)
+ androidTestImplementation(TEST_RUNNER)
+ androidTestImplementation(ESPRESSO_CORE)
androidTestImplementation(ESPRESSO_CONTRIB, libs.exclude_support)
androidTestImplementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
androidTestImplementation project(':support-testutils'), {
diff --git a/core-utils/build.gradle b/core-utils/build.gradle
index de4f67c..3f1efa1 100644
--- a/core-utils/build.gradle
+++ b/core-utils/build.gradle
@@ -10,8 +10,8 @@
api(project(":support-annotations"))
api(project(":support-compat"))
- androidTestImplementation(TEST_RUNNER, libs.exclude_annotations)
- androidTestImplementation(ESPRESSO_CORE, libs.exclude_annotations)
+ androidTestImplementation(TEST_RUNNER)
+ androidTestImplementation(ESPRESSO_CORE)
androidTestImplementation(MOCKITO_CORE, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
androidTestImplementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
}
diff --git a/customtabs/build.gradle b/customtabs/build.gradle
index abcca93..75e28f7 100644
--- a/customtabs/build.gradle
+++ b/customtabs/build.gradle
@@ -10,8 +10,8 @@
api(project(":support-compat"))
api(project(":support-annotations"))
- androidTestImplementation(TEST_RUNNER, libs.exclude_annotations)
- androidTestImplementation(ESPRESSO_CORE, libs.exclude_annotations)
+ androidTestImplementation(TEST_RUNNER)
+ androidTestImplementation(ESPRESSO_CORE)
androidTestImplementation(project(":support-testutils"))
}
diff --git a/design/build.gradle b/design/build.gradle
index 804ed16..e7ebc91 100644
--- a/design/build.gradle
+++ b/design/build.gradle
@@ -12,8 +12,8 @@
api(project(":recyclerview-v7"))
api(project(":transition"))
- androidTestImplementation(TEST_RUNNER, libs.exclude_annotations)
- androidTestImplementation(ESPRESSO_CORE, libs.exclude_annotations)
+ androidTestImplementation(TEST_RUNNER)
+ androidTestImplementation(ESPRESSO_CORE)
androidTestImplementation(ESPRESSO_CONTRIB, libs.exclude_support)
androidTestImplementation(MOCKITO_CORE, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
androidTestImplementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
diff --git a/dynamic-animation/build.gradle b/dynamic-animation/build.gradle
index 21dbfb3..ac5623d 100644
--- a/dynamic-animation/build.gradle
+++ b/dynamic-animation/build.gradle
@@ -9,8 +9,8 @@
dependencies {
api(project(":support-core-utils"))
- androidTestImplementation(TEST_RUNNER, libs.exclude_annotations)
- androidTestImplementation(ESPRESSO_CORE, libs.exclude_annotations)
+ androidTestImplementation(TEST_RUNNER)
+ androidTestImplementation(ESPRESSO_CORE)
androidTestImplementation(MOCKITO_CORE, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
androidTestImplementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
}
diff --git a/emoji/core/build.gradle b/emoji/core/build.gradle
index 67c05ae..a311f25 100644
--- a/emoji/core/build.gradle
+++ b/emoji/core/build.gradle
@@ -24,8 +24,8 @@
api(project(":support-compat"))
- androidTestImplementation(TEST_RUNNER, libs.exclude_annotations)
- androidTestImplementation(ESPRESSO_CORE, libs.exclude_annotations)
+ androidTestImplementation(TEST_RUNNER)
+ androidTestImplementation(ESPRESSO_CORE)
androidTestImplementation(MOCKITO_CORE, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
androidTestImplementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
androidTestImplementation project(':support-testutils')
diff --git a/exifinterface/build.gradle b/exifinterface/build.gradle
index f5e63f6..fa4d7b4 100644
--- a/exifinterface/build.gradle
+++ b/exifinterface/build.gradle
@@ -9,7 +9,7 @@
dependencies {
api(project(":support-annotations"))
- androidTestImplementation(TEST_RUNNER, libs.exclude_annotations)
+ androidTestImplementation(TEST_RUNNER)
}
android {
diff --git a/fragment/build.gradle b/fragment/build.gradle
index 720a68e..b1cc47e 100644
--- a/fragment/build.gradle
+++ b/fragment/build.gradle
@@ -12,8 +12,8 @@
api(project(":support-core-utils"))
api(project(":support-annotations"))
- androidTestImplementation(TEST_RUNNER, libs.exclude_annotations)
- androidTestImplementation(ESPRESSO_CORE, libs.exclude_annotations)
+ androidTestImplementation(TEST_RUNNER)
+ androidTestImplementation(ESPRESSO_CORE)
androidTestImplementation(MOCKITO_CORE, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
androidTestImplementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
androidTestImplementation project(':support-testutils'), {
diff --git a/graphics/drawable/animated/build.gradle b/graphics/drawable/animated/build.gradle
index ffa850f..e76f846 100644
--- a/graphics/drawable/animated/build.gradle
+++ b/graphics/drawable/animated/build.gradle
@@ -10,8 +10,8 @@
api(project(":support-vector-drawable"))
api(project(":support-core-ui"))
- androidTestImplementation(TEST_RUNNER, libs.exclude_annotations)
- androidTestImplementation(ESPRESSO_CORE, libs.exclude_annotations)
+ androidTestImplementation(TEST_RUNNER)
+ androidTestImplementation(ESPRESSO_CORE)
}
android {
diff --git a/graphics/drawable/static/build.gradle b/graphics/drawable/static/build.gradle
index 8e498fe..8575d6a 100644
--- a/graphics/drawable/static/build.gradle
+++ b/graphics/drawable/static/build.gradle
@@ -10,7 +10,7 @@
api(project(":support-annotations"))
api(project(":support-compat"))
- androidTestImplementation(TEST_RUNNER, libs.exclude_annotations)
+ androidTestImplementation(TEST_RUNNER)
}
android {
diff --git a/leanback/build.gradle b/leanback/build.gradle
index c07bc76..036f08f 100644
--- a/leanback/build.gradle
+++ b/leanback/build.gradle
@@ -13,8 +13,8 @@
api(project(":support-fragment"))
api(project(":recyclerview-v7"))
- androidTestImplementation(TEST_RUNNER, libs.exclude_annotations)
- androidTestImplementation(ESPRESSO_CORE, libs.exclude_annotations)
+ androidTestImplementation(TEST_RUNNER)
+ androidTestImplementation(ESPRESSO_CORE)
androidTestImplementation(MOCKITO_CORE, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
androidTestImplementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
}
diff --git a/media-compat/build.gradle b/media-compat/build.gradle
index b832de6..18ff5a3 100644
--- a/media-compat/build.gradle
+++ b/media-compat/build.gradle
@@ -10,8 +10,8 @@
api(project(":support-annotations"))
api(project(":support-compat"))
- androidTestImplementation(TEST_RUNNER, libs.exclude_annotations)
- androidTestImplementation(ESPRESSO_CORE, libs.exclude_annotations)
+ androidTestImplementation(TEST_RUNNER)
+ androidTestImplementation(ESPRESSO_CORE)
androidTestImplementation(MOCKITO_CORE, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
androidTestImplementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
androidTestImplementation project(':support-testutils')
diff --git a/media-compat/version-compat-tests/current/client/build.gradle b/media-compat/version-compat-tests/current/client/build.gradle
index 24e46d4..aeb82c1 100644
--- a/media-compat/version-compat-tests/current/client/build.gradle
+++ b/media-compat/version-compat-tests/current/client/build.gradle
@@ -24,7 +24,7 @@
androidTestImplementation(project(":support-media-compat"))
androidTestImplementation(project(":support-media-compat-test-lib"))
- androidTestImplementation(TEST_RUNNER, libs.exclude_annotations)
+ androidTestImplementation(TEST_RUNNER)
}
android {
diff --git a/media-compat/version-compat-tests/current/service/build.gradle b/media-compat/version-compat-tests/current/service/build.gradle
index 1318d33..cf82918 100644
--- a/media-compat/version-compat-tests/current/service/build.gradle
+++ b/media-compat/version-compat-tests/current/service/build.gradle
@@ -24,7 +24,7 @@
androidTestImplementation(project(":support-media-compat"))
androidTestImplementation(project(":support-media-compat-test-lib"))
- androidTestImplementation(TEST_RUNNER, libs.exclude_annotations)
+ androidTestImplementation(TEST_RUNNER)
}
android {
diff --git a/percent/build.gradle b/percent/build.gradle
index da5ccc9..7d5a651 100644
--- a/percent/build.gradle
+++ b/percent/build.gradle
@@ -9,8 +9,8 @@
dependencies {
api(project(":support-compat"))
- androidTestImplementation(TEST_RUNNER, libs.exclude_annotations)
- androidTestImplementation(ESPRESSO_CORE, libs.exclude_annotations)
+ androidTestImplementation(TEST_RUNNER)
+ androidTestImplementation(ESPRESSO_CORE)
}
android {
diff --git a/recyclerview-selection/build.gradle b/recyclerview-selection/build.gradle
index 9234fd8..06dc730 100644
--- a/recyclerview-selection/build.gradle
+++ b/recyclerview-selection/build.gradle
@@ -25,8 +25,8 @@
api project(':support-annotations')
api project(':support-compat')
- androidTestImplementation(TEST_RUNNER, libs.exclude_annotations)
- androidTestImplementation(ESPRESSO_CORE, libs.exclude_annotations)
+ androidTestImplementation(TEST_RUNNER)
+ androidTestImplementation(ESPRESSO_CORE)
androidTestImplementation(MOCKITO_CORE, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
androidTestImplementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
androidTestImplementation(JUNIT)
diff --git a/testutils/build.gradle b/testutils/build.gradle
index d99826d..074ab34 100644
--- a/testutils/build.gradle
+++ b/testutils/build.gradle
@@ -24,8 +24,8 @@
api(project(":support-fragment"))
api(project(":appcompat-v7"))
- implementation(TEST_RUNNER, libs.exclude_annotations)
- implementation(ESPRESSO_CORE, libs.exclude_annotations)
+ implementation(TEST_RUNNER)
+ implementation(ESPRESSO_CORE)
implementation(MOCKITO_CORE, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
implementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
implementation(JUNIT)
diff --git a/transition/build.gradle b/transition/build.gradle
index 3e78cfe..dcf3a76 100644
--- a/transition/build.gradle
+++ b/transition/build.gradle
@@ -11,8 +11,8 @@
api(project(":support-compat"))
compileOnly project(':support-fragment')
- androidTestImplementation(TEST_RUNNER, libs.exclude_annotations)
- androidTestImplementation(ESPRESSO_CORE, libs.exclude_annotations)
+ androidTestImplementation(TEST_RUNNER)
+ androidTestImplementation(ESPRESSO_CORE)
androidTestImplementation(MOCKITO_CORE, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
androidTestImplementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
androidTestImplementation(project(":support-v4"))
diff --git a/tv-provider/build.gradle b/tv-provider/build.gradle
index eb5d297..7090108 100644
--- a/tv-provider/build.gradle
+++ b/tv-provider/build.gradle
@@ -10,7 +10,7 @@
api(project(":support-annotations"))
api(project(":support-compat"))
- androidTestImplementation(TEST_RUNNER, libs.exclude_annotations)
+ androidTestImplementation(TEST_RUNNER)
}
android {
diff --git a/v13/build.gradle b/v13/build.gradle
index 0f5c9b6..425a31f 100644
--- a/v13/build.gradle
+++ b/v13/build.gradle
@@ -10,8 +10,8 @@
api(project(":support-annotations"))
api(project(":support-v4"))
- androidTestImplementation(TEST_RUNNER, libs.exclude_annotations)
- androidTestImplementation(ESPRESSO_CORE, libs.exclude_annotations)
+ androidTestImplementation(TEST_RUNNER)
+ androidTestImplementation(ESPRESSO_CORE)
androidTestImplementation(MOCKITO_CORE, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
androidTestImplementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
}
diff --git a/v7/appcompat/build.gradle b/v7/appcompat/build.gradle
index 214c6db..a3b80a8 100644
--- a/v7/appcompat/build.gradle
+++ b/v7/appcompat/build.gradle
@@ -13,8 +13,8 @@
api(project(":support-vector-drawable"))
api(project(":animated-vector-drawable"))
- androidTestImplementation(TEST_RUNNER, libs.exclude_annotations)
- androidTestImplementation(ESPRESSO_CORE, libs.exclude_annotations)
+ androidTestImplementation(TEST_RUNNER)
+ androidTestImplementation(ESPRESSO_CORE)
androidTestImplementation(MOCKITO_CORE, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
androidTestImplementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
androidTestImplementation project(':support-testutils'), {
diff --git a/v7/gridlayout/build.gradle b/v7/gridlayout/build.gradle
index dc3a494..7df5397 100644
--- a/v7/gridlayout/build.gradle
+++ b/v7/gridlayout/build.gradle
@@ -10,8 +10,8 @@
api(project(":support-compat"))
api(project(":support-core-ui"))
- androidTestImplementation(TEST_RUNNER, libs.exclude_annotations)
- androidTestImplementation(ESPRESSO_CORE, libs.exclude_annotations)
+ androidTestImplementation(TEST_RUNNER)
+ androidTestImplementation(ESPRESSO_CORE)
}
android {
diff --git a/v7/mediarouter/build.gradle b/v7/mediarouter/build.gradle
index 0c94194..dbf3da5 100644
--- a/v7/mediarouter/build.gradle
+++ b/v7/mediarouter/build.gradle
@@ -11,8 +11,8 @@
api(project(":appcompat-v7"))
api(project(":palette-v7"))
- androidTestImplementation(TEST_RUNNER, libs.exclude_annotations)
- androidTestImplementation(ESPRESSO_CORE, libs.exclude_annotations)
+ androidTestImplementation(TEST_RUNNER)
+ androidTestImplementation(ESPRESSO_CORE)
androidTestImplementation(TEST_RULES)
}
diff --git a/v7/palette/build.gradle b/v7/palette/build.gradle
index 95c0799..a1b1fc9 100644
--- a/v7/palette/build.gradle
+++ b/v7/palette/build.gradle
@@ -10,7 +10,7 @@
api(project(":support-compat"))
api(project(":support-core-utils"))
- androidTestImplementation(TEST_RUNNER, libs.exclude_annotations)
+ androidTestImplementation(TEST_RUNNER)
}
android {
diff --git a/v7/preference/build.gradle b/v7/preference/build.gradle
index 16af11e..698afb6 100644
--- a/v7/preference/build.gradle
+++ b/v7/preference/build.gradle
@@ -27,8 +27,8 @@
api(project(":appcompat-v7"))
api(project(":recyclerview-v7"))
- androidTestImplementation(TEST_RUNNER, libs.exclude_annotations)
- androidTestImplementation(ESPRESSO_CORE, libs.exclude_annotations)
+ androidTestImplementation(TEST_RUNNER)
+ androidTestImplementation(ESPRESSO_CORE)
androidTestImplementation(MOCKITO_CORE, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
androidTestImplementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
}
diff --git a/v7/recyclerview/build.gradle b/v7/recyclerview/build.gradle
index b98e7f7..0a83989 100644
--- a/v7/recyclerview/build.gradle
+++ b/v7/recyclerview/build.gradle
@@ -11,8 +11,8 @@
api(project(":support-compat"))
api(project(":support-core-ui"))
- androidTestImplementation(TEST_RUNNER, libs.exclude_annotations)
- androidTestImplementation(ESPRESSO_CORE, libs.exclude_annotations)
+ androidTestImplementation(TEST_RUNNER)
+ androidTestImplementation(ESPRESSO_CORE)
androidTestImplementation(MOCKITO_CORE, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
androidTestImplementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
androidTestImplementation(JUNIT)
@@ -20,7 +20,7 @@
testImplementation(JUNIT)
testImplementation(MOCKITO_CORE)
- testImplementation(TEST_RUNNER, libs.exclude_annotations)
+ testImplementation(TEST_RUNNER)
}
android {
diff --git a/wear/build.gradle b/wear/build.gradle
index 55320b9..e5b718d 100644
--- a/wear/build.gradle
+++ b/wear/build.gradle
@@ -13,8 +13,8 @@
api(project(":percent"))
api(project(":recyclerview-v7"))
- androidTestImplementation(TEST_RUNNER, libs.exclude_annotations)
- androidTestImplementation(ESPRESSO_CORE, libs.exclude_annotations)
+ androidTestImplementation(TEST_RUNNER)
+ androidTestImplementation(ESPRESSO_CORE)
androidTestImplementation(MOCKITO_CORE, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
androidTestImplementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker