Commit c4e843e
committed
Implement featureScope/featureComponent support for @DevelopmentAppComponent
When `featureScope` and `featureComponent` are set on `@DevelopmentAppComponent`,
the compiler plugin now generates two additional types that redirect the
`FeatureProvider` binding from `ActivityScope` to the feature scope:
- `FeatureLoginScreenComponent`: a `@ContributesTo(featureScope)` interface
extending `DevelopmentLoginScreenComponent`, making `FeatureProvider` available
at the feature scope.
- `NoopLoginScreenComponent`: a `@ContributesTo(ActivityScope::class,
replaces = [ContributedDevelopmentLoginScreenComponent::class])` interface that
removes the default login screen component from `ActivityScope`, so
`FeatureProvider` is no longer required there.
This matches what the KSP generator produced. Without these types, demo apps
with a feature scope fail to compile because
`ContributedDevelopmentLoginScreenComponent.featureProvider()` demands
`FeatureProvider` at `ActivityScope`, but the app only provides it at the
feature scope.
New stubs (minimal copies from android-register):
- `ActivityScope`, `FeatureProvider`, `DevelopmentLoginScreenComponent`,
`ContributedDevelopmentLoginScreenComponent`, `DefaultFeatureModule`,
`DevelopmentFeatureScopeComponent`
Tests:
- Box test: multi-module compilation verifying the graph compiles and runs
- FIR dump test: validates the generated FIR structure
- Integration test: `FeatureScopeDemoApp` with `featureScope`/`featureComponent`1 parent 22c5fb9 commit c4e843e
17 files changed
Lines changed: 948 additions & 2 deletions
File tree
- compiler
- api
- src
- main/kotlin/com/squareup/metro/extensions
- developmentapp
- test
- java/com/squareup/metro/extensions/runners
- resources
- box/developmentappcomponent
- dump/developmentappcomponent
- integration-tests/demo/src
- main/kotlin/com/squareup/test/demo/featurescope
- test/kotlin/com/squareup/test/demo/featurescope
- stubs/src/main/kotlin/com/squareup
- dagger
- development/shell
- login/screen
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
37 | 49 | | |
38 | 50 | | |
39 | 51 | | |
| |||
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
| 71 | + | |
70 | 72 | | |
71 | 73 | | |
72 | 74 | | |
| |||
79 | 81 | | |
80 | 82 | | |
81 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
82 | 109 | | |
83 | 110 | | |
84 | 111 | | |
| |||
0 commit comments