You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+40Lines changed: 40 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -878,6 +878,46 @@ composeStabilityAnalyzer {
878
878
}
879
879
```
880
880
881
+
#### `stabilityConfigurationFiles` Option
882
+
883
+
You can provide stability configuration files to tell `stabilityCheck` which types should be treated as stable, even if the compiler marks them as unstable. This matches the [Compose compiler's stability configuration file](https://developer.android.com/develop/ui/compose/performance/stability/fix#configuration-file) format, so you can reuse the same file for both the compiler and stability validation.
884
+
885
+
This is useful when:
886
+
- Third-party library types don't have `@Stable` or `@Immutable` annotations
887
+
- Code-generated types are effectively stable but the compiler can't infer it
888
+
- You want the stability check to respect the same overrides as the Compose compiler
889
+
890
+
```kotlin
891
+
composeStabilityAnalyzer {
892
+
stabilityValidation {
893
+
// Use the same stability configuration file as the Compose compiler
You can provide stability configuration files to tell `stabilityCheck` which types should be treated as stable, even if the compiler marks them as unstable. This uses the same format as the [Compose compiler's stability configuration file](https://developer.android.com/develop/ui/compose/performance/stability/fix#configuration-file), so you can reuse the same file for both the compiler and stability validation.
The configuration file contains fully-qualified type names, one per line. Lines starting with `//` are treated as comments. Wildcard patterns are supported: `*` matches a single package segment and `**` matches across package boundaries.
183
+
184
+
```
185
+
// stability_config.conf
186
+
com.google.firebase.auth.FirebaseUser
187
+
com.example.generated.*
188
+
com.example.models.**
189
+
```
190
+
191
+
When these files are configured, the `stabilityCheck` task treats any parameter type matching these patterns as stable. This affects the comparison in two ways: new composables whose parameters all match these patterns won't be flagged, and parameter stability regressions to a matching type won't be reported.
192
+
193
+
This is particularly useful when your project already uses a stability configuration file for the Compose compiler. By pointing `stabilityConfigurationFiles` to the same file, the stability validation respects the same overrides, keeping the two in sync.
194
+
161
195
## Excluding Composables
162
196
163
197
Some composables shouldn't be included in stability validation: preview composables that only exist for Android Studio previews, debug-only screens, or experimental features still under active development. Use the `@IgnoreStabilityReport` annotation to exclude them.
Copy file name to clipboardExpand all lines: docs/stability-concepts.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -151,6 +151,8 @@ com.example.ThirdPartyModel
151
151
com.google.firebase.auth.FirebaseUser
152
152
```
153
153
154
+
The same configuration file can also be used with the [Stability Validation](gradle-plugin/stability-validation.md#stabilityconfigurationfiles) Gradle task. By pointing `stabilityConfigurationFiles` to this file, the `stabilityCheck` task respects the same overrides as the Compose compiler, so types you've declared stable won't be flagged as regressions.
155
+
154
156
## Cross-Module Stability
155
157
156
158
Types from other modules that were **not compiled with the Compose compiler** are treated as unstable by default. This is a conservative decision, because the Compose compiler in your module can't inspect the source code of external modules, so it can't verify stability.
0 commit comments