anvil
anvil copied to clipboard
Restructure binding module code gen
This PR reimplements binding module generation to perform all merging at the IR level and eliminate intermediate merged binding modules.
At a high level, this does the following
- Updates
@ContributesBindingand@ContributesMultiBindingto instead generate binding modules per-binding. - Each binding modules is annotated with a new
@InternalBindingMarkerannotation that contains a minimal amount of metadataoriginClass- the origin class that contributed the bindingisMultibinding- indicates if the binding is a multibindingpriority- corresponds toContributesBinding.Priority.qualifierKey- the computed "qualifier key"
- Each binding module is annotated with
@ContributesToand propagated via that infrastructure. - During
ModuleMergerIr, these binding modules are merged and metadata read from@InternalBindingMarkerto properly allow forexcludes,replaces, priority, etc all work correctly. - Update tests for this new infrastructure, preserving as much of the existing binding module tests (unit and integration) while removing only now-irrelevant ones (i.e. ones that explicitly expect a BindingModule of the old style to always be generated).
This also functionally completes #751!
- [x] Update ContributesBinding and ContributesMultibinding to generate contributed binding modules
- [x] Update ContributesBinding and ContributesMultibinding tests for new impl
- [x] Aggregate contributed bindings in
ModuleMergerIr+ new modeling using@InternalBindingMarker - [x] Finish reimplementing prioritization and replacements in
ModuleMergerIr. This is a little tricky becauseBindingModuleMergerspeaks classes butModuleMergerIrspeaks modules. - [x] Update tests