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

Add ability to generate a ContributesBinding baseline? #875

Open
handstandsam opened this issue Feb 12, 2024 · 7 comments
Open

Add ability to generate a ContributesBinding baseline? #875

handstandsam opened this issue Feb 12, 2024 · 7 comments
Labels
enhancement New feature or request

Comments

@handstandsam
Copy link
Collaborator

handstandsam commented Feb 12, 2024

Could you generate a file that contains the following (see snippet) using

private val contributedBindingClasses = mutableListOf<ClassReference>()
private val contributedMultibindingClasses = mutableListOf<ClassReference>()
private val contributedModuleClasses = mutableListOf<ClassReference>()
?

@AppScope
something.Cool <- something.CoolImpl
com.ReplaceMe <- com.ReplaceMeImpl (**REPLACED**) <- com.IReplacedYou // Calls out what it is replacing

@ActivityScope
something.Else <- something.ElseImpl
standalone.Impl <- standalone.Impl // Provided as a concrete type

This sort of baseline would be incredibly useful in many cases and for debugging.


Writing out replaces is also something that would be nice to call out in bindings. I've seen bugs and issues come up when it wasn't known that a replaces was happening.

This file could be generated per module.


This file would get noisy in Git. Maybe just having the replaces only in the baseline by default would be good?

@handstandsam handstandsam added the enhancement New feature or request label Feb 12, 2024
@ZacSweers
Copy link
Collaborator

is baseline the right word for this? Seems more like something similar to compose's compiler reports.

Sidenote - BindingModuleGenerator.kt is going away soon

@handstandsam
Copy link
Collaborator Author

handstandsam commented Feb 20, 2024

I wanted to call it baseline because like Android lint or dependency-guard, I'd want to see in source control that my baseline changed.

This is because it's so easy to introduce a replaces and have no idea it's happening.

I was on a project previously where an important upgrade checking feature was being replaced by a fake implementation and it was undiscovered for a year.


For my use case, a report could be useful, but wouldn't help me automatically detect these sorts of changes.

@ZacSweers
Copy link
Collaborator

So you want something like a lock file for replacements?

@handstandsam
Copy link
Collaborator Author

Yes, and for ordering/priority.

@ZacSweers
Copy link
Collaborator

tbh this is probably a non-starter. See google/ksp#1677

@handstandsam
Copy link
Collaborator Author

Thanks for linking that issue. Makes sense, but that's unfortunate.

@RBusarow
Copy link
Collaborator

The KSP issue above only applies to KSP. This is still on the table for embedded mode.

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

No branches or pull requests

3 participants