Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider introducing "preferredIdentifier" to bundles #662

Closed
ZacSweers opened this issue May 6, 2022 · 1 comment · Fixed by #666
Closed

Consider introducing "preferredIdentifier" to bundles #662

ZacSweers opened this issue May 6, 2022 · 1 comment · Fixed by #666
Labels
enhancement New feature or request

Comments

@ZacSweers
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Currently, bundles do not assist with fixing "misused" transitive dependencies. This can result in awkward cases like this

Project A depends on project B
Project B depends on androidx.paging:paging-runtime, which in turns depends on an internal-ish dependency androidx.paging:paging-common
Project A uses something from paging-common, so DAGP suggests adding paging-common. This is not ideal because that dependency shouldn't usually be depended on directly. The preferred shim is paging-runtime.

Describe the solution you'd like

A new optional preferredIdentifier for bundles to use if defined when advising dependencies contained within it.

dependencyAnalysis {
  dependencies {
    bundle("androidx-paging", preferredIdentifier = "androidx.paging:paging-runtime") { includeGroup("androidx.paging") }
  }
}

Describe alternatives you've considered

We can manually shim these in our "DependencyRake" solution for now: slackhq/foundry#14

Additional context

@autonomousapps
Copy link
Owner

The issue here from the perspective of the current implementation is that the bundle rules require that one of the dependencies in the bundle being explicitly declared in the build. That is, in your scenario, you'd have to apply paging-runtime and declare a bundle on that + paging-common and then it would "just work." But because you're getting paging-common through project B, such a bundle rule wouldn't work currently.

I know we already discussed this elsewhere; I'm adding it here so that I remember later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants