Commit 3b1b2506 by tonihei

Add Gradle constraints to common module to enforce matching versions

The common module now defines all other released targets as constraints,
which ensures they must have matching versions. As all other libraries
indirectly depend on the common module, this declaration is only needed
in here.

PiperOrigin-RevId: 419776578
parent bb81c496
Showing with 19 additions and 0 deletions
...@@ -13,6 +13,16 @@ ...@@ -13,6 +13,16 @@
// limitations under the License. // limitations under the License.
apply from: "$gradle.ext.androidxMediaSettingsDir/common_library_config.gradle" apply from: "$gradle.ext.androidxMediaSettingsDir/common_library_config.gradle"
// Make sure this project is evaluated after all other libraries. This ensures
// the Gradle properties of each library are populated and we can automatically
// check if a 'releaseArtifactId' exists.
rootProject.allprojects.forEach {
if ((it.name.contains('lib-') || it.name.contains('test-'))
&& !it.name.endsWith('-common')) {
evaluationDependsOn(modulePrefix + it.name)
}
}
// copybara:media3-only
android { android {
buildTypes { buildTypes {
debug { debug {
...@@ -22,6 +32,15 @@ android { ...@@ -22,6 +32,15 @@ android {
} }
dependencies { dependencies {
constraints {
// List all released targets as constraints. This ensures they are all
// resolved to the same version.
rootProject.allprojects.forEach {
if (it.hasProperty('releaseArtifactId')) {
implementation project(modulePrefix + it.name)
}
}
}
api ('com.google.guava:guava:' + guavaVersion) { api ('com.google.guava:guava:' + guavaVersion) {
// Exclude dependencies that are only used by Guava at compile time // Exclude dependencies that are only used by Guava at compile time
// (but declared as runtime deps) [internal b/168188131]. // (but declared as runtime deps) [internal b/168188131].
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment