Skip to content

Commit bc5f679

Browse files
authored
Add Compose Stability Analyzer plugin (#114)
* Add Compose Stability Analyzer plugin * Add CONTRIZBUTING.md
1 parent ac7cf75 commit bc5f679

11 files changed

Lines changed: 406 additions & 0 deletions

File tree

.github/workflows/build.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ jobs:
4747
- name: Check lint
4848
run: ./gradlew lintDebug --stacktrace
4949

50+
- name: Check stability
51+
run: ./gradlew stabilityCheck --stacktrace
52+
5053
- name: Build all build type and flavor permutations
5154
run: ./gradlew assemble --stacktrace
5255

CONTRIBUTING.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# How to contribute
2+
3+
## Pre-check before PR
4+
5+
### Run all checks at once:
6+
7+
```bash
8+
./pre_check.sh
9+
```
10+
11+
### Run checks individually
12+
13+
- dependencyGuard
14+
```bash
15+
./gradlew dependencyGuard
16+
```
17+
18+
- spotless
19+
```bash
20+
./gradlew spotlessCheck --init-script gradle/init.gradle.kts
21+
```
22+
23+
- metalava
24+
```bash
25+
./gradlew metalavaCheckCompatibilityRelease
26+
```
27+
28+
- lint
29+
```bash
30+
./gradlew lintDebug
31+
```
32+
33+
- stability
34+
```bash
35+
./gradlew stabilityCheck
36+
```
37+
38+
## Update baselines
39+
40+
- dependencyGuard
41+
```bash
42+
./gradlew dependencyGuardBaseline
43+
```
44+
45+
- spotless
46+
```bash
47+
./gradlew spotlessApply --init-script gradle/init.gradle.kts
48+
```
49+
50+
- metalava
51+
```bash
52+
./gradlew metalavaGenerateSignatureRelease
53+
```
54+
55+
- stability
56+
```bash
57+
./gradlew stabilityDump
58+
```

gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ dokka = "1.8.10"
99

1010
compose = "1.8.2"
1111
compose-material3 = "1.4.0-alpha15"
12+
compose-stability-analyzer = "0.2.11"
1213

1314
material = "1.5.0"
1415

@@ -62,6 +63,7 @@ android-application = { id = "com.android.application", version.ref = "agp" }
6263
android-library = { id = "com.android.library", version.ref = "agp" }
6364
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
6465
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
66+
compose-stability-analyzer = { id = "com.github.skydoves.compose.stability.analyzer", version.ref = "compose-stability-analyzer" }
6567
jetbrains-dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
6668
metalava = { id = "me.tylerbwong.gradle.metalava", version.ref = "metalava" }
6769
maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "mavenPublish" }

pre_check.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
# Pre-check script for PR submission
3+
# Validates dependencies, code formatting, API compatibility, lint, and stability.
4+
5+
# Exit immediately if any command fails
6+
set -e
7+
8+
echo "Starting pre-check validations..."
9+
echo ""
10+
11+
# Verify dependency changes
12+
echo "🔍 [1/5] Checking dependency guard..."
13+
./gradlew dependencyGuard
14+
echo "✓ Dependency guard check passed"
15+
echo ""
16+
17+
# Verify code formatting
18+
echo "🔍 [2/5] Checking code formatting..."
19+
./gradlew spotlessCheck --init-script gradle/init.gradle.kts
20+
echo "✓ Code formatting check passed"
21+
echo ""
22+
23+
# Verify API compatibility
24+
echo "🔍 [3/5] Checking API compatibility..."
25+
./gradlew metalavaCheckCompatibilityRelease
26+
echo "✓ API compatibility check passed"
27+
echo ""
28+
29+
# Static analysis and lint checks
30+
echo "🔍 [4/5] Running lint checks..."
31+
./gradlew lintDebug
32+
echo "✓ Lint check passed"
33+
echo ""
34+
35+
# Compose stability verification
36+
echo "🔍 [5/5] Checking stability..."
37+
./gradlew stabilityCheck
38+
echo "✓ Stability check passed"
39+
echo ""
40+
41+
echo "✅ All pre-checks passed successfully!"

readmore-foundation/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ plugins {
44
alias(libs.plugins.maven.publish)
55
alias(libs.plugins.jetbrains.dokka)
66
alias(libs.plugins.metalava)
7+
alias(libs.plugins.compose.stability.analyzer)
78
}
89

910
android {
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
// This file was automatically generated by Compose Stability Analyzer
2+
// https://github.com/skydoves/compose-stability-analyzer
3+
//
4+
// Do not edit this file directly. To update it, run:
5+
// ./gradlew :readmore-foundation:stabilityDump
6+
7+
@Composable
8+
public fun com.webtoonscorp.android.readmore.foundation.BasicReadMoreText(text: kotlin.String, expanded: kotlin.Boolean, modifier: androidx.compose.ui.Modifier?, onExpandedChange: kotlin.Function1<kotlin.Boolean, kotlin.Unit>?, contentPadding: androidx.compose.foundation.layout.PaddingValues?, style: androidx.compose.ui.text.TextStyle?, onTextLayout: kotlin.Function1<androidx.compose.ui.text.TextLayoutResult, kotlin.Unit>?, softWrap: kotlin.Boolean, readMoreText: kotlin.String?, readMoreMaxLines: kotlin.Int, readMoreOverflow: com.webtoonscorp.android.readmore.foundation.ReadMoreTextOverflow, readMoreStyle: androidx.compose.ui.text.SpanStyle?, readLessText: kotlin.String?, readLessStyle: androidx.compose.ui.text.SpanStyle?, toggleArea: com.webtoonscorp.android.readmore.foundation.ToggleArea, $composer: androidx.compose.runtime.Composer?, $changed: kotlin.Int, $changed1: kotlin.Int, $default: kotlin.Int): kotlin.Unit
9+
skippable: false
10+
restartable: true
11+
params:
12+
- text: STABLE (String is immutable)
13+
- expanded: STABLE (primitive type)
14+
- modifier: STABLE (marked @Stable or @Immutable)
15+
- onExpandedChange: STABLE (function type)
16+
- contentPadding: STABLE (marked @Stable or @Immutable)
17+
- style: STABLE (marked @Stable or @Immutable)
18+
- onTextLayout: STABLE (function type)
19+
- softWrap: STABLE (primitive type)
20+
- readMoreText: STABLE
21+
- readMoreMaxLines: STABLE (primitive type)
22+
- readMoreOverflow: STABLE
23+
- readMoreStyle: STABLE (marked @Stable or @Immutable)
24+
- readLessText: STABLE
25+
- readLessStyle: STABLE (marked @Stable or @Immutable)
26+
- toggleArea: STABLE
27+
- $composer: RUNTIME (requires runtime check)
28+
- $changed: STABLE (primitive type)
29+
- $changed1: STABLE (primitive type)
30+
- $default: STABLE (primitive type)
31+
32+
@Composable
33+
public fun com.webtoonscorp.android.readmore.foundation.BasicReadMoreText(text: androidx.compose.ui.text.AnnotatedString, expanded: kotlin.Boolean, modifier: androidx.compose.ui.Modifier?, onExpandedChange: kotlin.Function1<kotlin.Boolean, kotlin.Unit>?, contentPadding: androidx.compose.foundation.layout.PaddingValues?, style: androidx.compose.ui.text.TextStyle?, onTextLayout: kotlin.Function1<androidx.compose.ui.text.TextLayoutResult, kotlin.Unit>?, softWrap: kotlin.Boolean, readMoreText: kotlin.String?, readMoreMaxLines: kotlin.Int, readMoreOverflow: com.webtoonscorp.android.readmore.foundation.ReadMoreTextOverflow, readMoreStyle: androidx.compose.ui.text.SpanStyle?, readLessText: kotlin.String?, readLessStyle: androidx.compose.ui.text.SpanStyle?, toggleArea: com.webtoonscorp.android.readmore.foundation.ToggleArea, $composer: androidx.compose.runtime.Composer?, $changed: kotlin.Int, $changed1: kotlin.Int, $default: kotlin.Int): kotlin.Unit
34+
skippable: false
35+
restartable: true
36+
params:
37+
- text: STABLE (marked @Stable or @Immutable)
38+
- expanded: STABLE (primitive type)
39+
- modifier: STABLE (marked @Stable or @Immutable)
40+
- onExpandedChange: STABLE (function type)
41+
- contentPadding: STABLE (marked @Stable or @Immutable)
42+
- style: STABLE (marked @Stable or @Immutable)
43+
- onTextLayout: STABLE (function type)
44+
- softWrap: STABLE (primitive type)
45+
- readMoreText: STABLE
46+
- readMoreMaxLines: STABLE (primitive type)
47+
- readMoreOverflow: STABLE
48+
- readMoreStyle: STABLE (marked @Stable or @Immutable)
49+
- readLessText: STABLE
50+
- readLessStyle: STABLE (marked @Stable or @Immutable)
51+
- toggleArea: STABLE
52+
- $composer: RUNTIME (requires runtime check)
53+
- $changed: STABLE (primitive type)
54+
- $changed1: STABLE (primitive type)
55+
- $default: STABLE (primitive type)
56+
57+
@Composable
58+
private fun com.webtoonscorp.android.readmore.foundation.CoreReadMoreText(text: androidx.compose.ui.text.AnnotatedString, expanded: kotlin.Boolean, modifier: androidx.compose.ui.Modifier?, onExpandedChange: kotlin.Function1<kotlin.Boolean, kotlin.Unit>?, contentPadding: androidx.compose.foundation.layout.PaddingValues?, style: androidx.compose.ui.text.TextStyle?, onTextLayout: kotlin.Function1<androidx.compose.ui.text.TextLayoutResult, kotlin.Unit>?, softWrap: kotlin.Boolean, readMoreText: kotlin.String?, readMoreMaxLines: kotlin.Int, readMoreOverflow: com.webtoonscorp.android.readmore.foundation.ReadMoreTextOverflow, readMoreStyle: androidx.compose.ui.text.SpanStyle?, readLessText: kotlin.String?, readLessStyle: androidx.compose.ui.text.SpanStyle?, toggleArea: com.webtoonscorp.android.readmore.foundation.ToggleArea, $composer: androidx.compose.runtime.Composer?, $changed: kotlin.Int, $changed1: kotlin.Int, $default: kotlin.Int): kotlin.Unit
59+
skippable: false
60+
restartable: true
61+
params:
62+
- text: STABLE (marked @Stable or @Immutable)
63+
- expanded: STABLE (primitive type)
64+
- modifier: STABLE (marked @Stable or @Immutable)
65+
- onExpandedChange: STABLE (function type)
66+
- contentPadding: STABLE (marked @Stable or @Immutable)
67+
- style: STABLE (marked @Stable or @Immutable)
68+
- onTextLayout: STABLE (function type)
69+
- softWrap: STABLE (primitive type)
70+
- readMoreText: STABLE
71+
- readMoreMaxLines: STABLE (primitive type)
72+
- readMoreOverflow: STABLE
73+
- readMoreStyle: STABLE (marked @Stable or @Immutable)
74+
- readLessText: STABLE
75+
- readLessStyle: STABLE (marked @Stable or @Immutable)
76+
- toggleArea: STABLE
77+
- $composer: RUNTIME (requires runtime check)
78+
- $changed: STABLE (primitive type)
79+
- $changed1: STABLE (primitive type)
80+
- $default: STABLE (primitive type)
81+
82+
@Composable
83+
public fun com.webtoonscorp.android.readmore.foundation.CoreReadMoreText.<anonymous>($composer: androidx.compose.runtime.Composer?, $changed: kotlin.Int): kotlin.Unit
84+
skippable: false
85+
restartable: true
86+
params:
87+
- $composer: RUNTIME (requires runtime check)
88+
- $changed: STABLE (primitive type)
89+

readmore-material/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ plugins {
44
alias(libs.plugins.maven.publish)
55
alias(libs.plugins.jetbrains.dokka)
66
alias(libs.plugins.metalava)
7+
alias(libs.plugins.compose.stability.analyzer)
78
}
89

910
android {
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
// This file was automatically generated by Compose Stability Analyzer
2+
// https://github.com/skydoves/compose-stability-analyzer
3+
//
4+
// Do not edit this file directly. To update it, run:
5+
// ./gradlew :readmore-material:stabilityDump
6+
7+
@Composable
8+
public fun com.webtoonscorp.android.readmore.material.ReadMoreText(text: kotlin.String, expanded: kotlin.Boolean, modifier: androidx.compose.ui.Modifier?, onExpandedChange: kotlin.Function1<kotlin.Boolean, kotlin.Unit>?, contentPadding: androidx.compose.foundation.layout.PaddingValues?, color: androidx.compose.ui.graphics.Color, fontSize: androidx.compose.ui.unit.TextUnit, fontStyle: androidx.compose.ui.text.font.FontStyle?, fontWeight: androidx.compose.ui.text.font.FontWeight?, fontFamily: androidx.compose.ui.text.font.FontFamily?, letterSpacing: androidx.compose.ui.unit.TextUnit, textDecoration: androidx.compose.ui.text.style.TextDecoration?, textAlign: androidx.compose.ui.text.style.TextAlign, lineHeight: androidx.compose.ui.unit.TextUnit, softWrap: kotlin.Boolean, onTextLayout: kotlin.Function1<androidx.compose.ui.text.TextLayoutResult, kotlin.Unit>?, style: androidx.compose.ui.text.TextStyle?, readMoreText: kotlin.String?, readMoreColor: androidx.compose.ui.graphics.Color, readMoreFontSize: androidx.compose.ui.unit.TextUnit, readMoreFontStyle: androidx.compose.ui.text.font.FontStyle?, readMoreFontWeight: androidx.compose.ui.text.font.FontWeight?, readMoreFontFamily: androidx.compose.ui.text.font.FontFamily?, readMoreTextDecoration: androidx.compose.ui.text.style.TextDecoration?, readMoreMaxLines: kotlin.Int, readMoreOverflow: com.webtoonscorp.android.readmore.foundation.ReadMoreTextOverflow, readMoreStyle: androidx.compose.ui.text.SpanStyle?, readLessText: kotlin.String?, readLessColor: androidx.compose.ui.graphics.Color, readLessFontSize: androidx.compose.ui.unit.TextUnit, readLessFontStyle: androidx.compose.ui.text.font.FontStyle?, readLessFontWeight: androidx.compose.ui.text.font.FontWeight?, readLessFontFamily: androidx.compose.ui.text.font.FontFamily?, readLessTextDecoration: androidx.compose.ui.text.style.TextDecoration?, readLessStyle: androidx.compose.ui.text.SpanStyle?, toggleArea: com.webtoonscorp.android.readmore.foundation.ToggleArea, $composer: androidx.compose.runtime.Composer?, $changed: kotlin.Int, $changed1: kotlin.Int, $changed2: kotlin.Int, $changed3: kotlin.Int, $default: kotlin.Int, $default1: kotlin.Int): kotlin.Unit
9+
skippable: false
10+
restartable: true
11+
params:
12+
- text: STABLE (String is immutable)
13+
- expanded: STABLE (primitive type)
14+
- modifier: STABLE (marked @Stable or @Immutable)
15+
- onExpandedChange: STABLE (function type)
16+
- contentPadding: STABLE (marked @Stable or @Immutable)
17+
- color: STABLE (marked @Stable or @Immutable)
18+
- fontSize: STABLE (marked @Stable or @Immutable)
19+
- fontStyle: STABLE (known stable type)
20+
- fontWeight: STABLE (marked @Stable or @Immutable)
21+
- fontFamily: STABLE (marked @Stable or @Immutable)
22+
- letterSpacing: STABLE (marked @Stable or @Immutable)
23+
- textDecoration: STABLE (marked @Stable or @Immutable)
24+
- textAlign: STABLE (known stable type)
25+
- lineHeight: STABLE (marked @Stable or @Immutable)
26+
- softWrap: STABLE (primitive type)
27+
- onTextLayout: STABLE (function type)
28+
- style: STABLE (marked @Stable or @Immutable)
29+
- readMoreText: STABLE
30+
- readMoreColor: STABLE (marked @Stable or @Immutable)
31+
- readMoreFontSize: STABLE (marked @Stable or @Immutable)
32+
- readMoreFontStyle: STABLE (known stable type)
33+
- readMoreFontWeight: STABLE (marked @Stable or @Immutable)
34+
- readMoreFontFamily: STABLE (marked @Stable or @Immutable)
35+
- readMoreTextDecoration: STABLE (marked @Stable or @Immutable)
36+
- readMoreMaxLines: STABLE (primitive type)
37+
- readMoreOverflow: STABLE
38+
- readMoreStyle: STABLE (marked @Stable or @Immutable)
39+
- readLessText: STABLE
40+
- readLessColor: STABLE (marked @Stable or @Immutable)
41+
- readLessFontSize: STABLE (marked @Stable or @Immutable)
42+
- readLessFontStyle: STABLE (known stable type)
43+
- readLessFontWeight: STABLE (marked @Stable or @Immutable)
44+
- readLessFontFamily: STABLE (marked @Stable or @Immutable)
45+
- readLessTextDecoration: STABLE (marked @Stable or @Immutable)
46+
- readLessStyle: STABLE (marked @Stable or @Immutable)
47+
- toggleArea: STABLE
48+
- $composer: RUNTIME (requires runtime check)
49+
- $changed: STABLE (primitive type)
50+
- $changed1: STABLE (primitive type)
51+
- $changed2: STABLE (primitive type)
52+
- $changed3: STABLE (primitive type)
53+
- $default: STABLE (primitive type)
54+
- $default1: STABLE (primitive type)
55+
56+
@Composable
57+
public fun com.webtoonscorp.android.readmore.material.ReadMoreText(text: androidx.compose.ui.text.AnnotatedString, expanded: kotlin.Boolean, modifier: androidx.compose.ui.Modifier?, onExpandedChange: kotlin.Function1<kotlin.Boolean, kotlin.Unit>?, contentPadding: androidx.compose.foundation.layout.PaddingValues?, color: androidx.compose.ui.graphics.Color, fontSize: androidx.compose.ui.unit.TextUnit, fontStyle: androidx.compose.ui.text.font.FontStyle?, fontWeight: androidx.compose.ui.text.font.FontWeight?, fontFamily: androidx.compose.ui.text.font.FontFamily?, letterSpacing: androidx.compose.ui.unit.TextUnit, textDecoration: androidx.compose.ui.text.style.TextDecoration?, textAlign: androidx.compose.ui.text.style.TextAlign, lineHeight: androidx.compose.ui.unit.TextUnit, softWrap: kotlin.Boolean, onTextLayout: kotlin.Function1<androidx.compose.ui.text.TextLayoutResult, kotlin.Unit>?, style: androidx.compose.ui.text.TextStyle?, readMoreText: kotlin.String?, readMoreColor: androidx.compose.ui.graphics.Color, readMoreFontSize: androidx.compose.ui.unit.TextUnit, readMoreFontStyle: androidx.compose.ui.text.font.FontStyle?, readMoreFontWeight: androidx.compose.ui.text.font.FontWeight?, readMoreFontFamily: androidx.compose.ui.text.font.FontFamily?, readMoreTextDecoration: androidx.compose.ui.text.style.TextDecoration?, readMoreMaxLines: kotlin.Int, readMoreOverflow: com.webtoonscorp.android.readmore.foundation.ReadMoreTextOverflow, readMoreStyle: androidx.compose.ui.text.SpanStyle?, readLessText: kotlin.String?, readLessColor: androidx.compose.ui.graphics.Color, readLessFontSize: androidx.compose.ui.unit.TextUnit, readLessFontStyle: androidx.compose.ui.text.font.FontStyle?, readLessFontWeight: androidx.compose.ui.text.font.FontWeight?, readLessFontFamily: androidx.compose.ui.text.font.FontFamily?, readLessTextDecoration: androidx.compose.ui.text.style.TextDecoration?, readLessStyle: androidx.compose.ui.text.SpanStyle?, toggleArea: com.webtoonscorp.android.readmore.foundation.ToggleArea, $composer: androidx.compose.runtime.Composer?, $changed: kotlin.Int, $changed1: kotlin.Int, $changed2: kotlin.Int, $changed3: kotlin.Int, $default: kotlin.Int, $default1: kotlin.Int): kotlin.Unit
58+
skippable: false
59+
restartable: true
60+
params:
61+
- text: STABLE (marked @Stable or @Immutable)
62+
- expanded: STABLE (primitive type)
63+
- modifier: STABLE (marked @Stable or @Immutable)
64+
- onExpandedChange: STABLE (function type)
65+
- contentPadding: STABLE (marked @Stable or @Immutable)
66+
- color: STABLE (marked @Stable or @Immutable)
67+
- fontSize: STABLE (marked @Stable or @Immutable)
68+
- fontStyle: STABLE (known stable type)
69+
- fontWeight: STABLE (marked @Stable or @Immutable)
70+
- fontFamily: STABLE (marked @Stable or @Immutable)
71+
- letterSpacing: STABLE (marked @Stable or @Immutable)
72+
- textDecoration: STABLE (marked @Stable or @Immutable)
73+
- textAlign: STABLE (known stable type)
74+
- lineHeight: STABLE (marked @Stable or @Immutable)
75+
- softWrap: STABLE (primitive type)
76+
- onTextLayout: STABLE (function type)
77+
- style: STABLE (marked @Stable or @Immutable)
78+
- readMoreText: STABLE
79+
- readMoreColor: STABLE (marked @Stable or @Immutable)
80+
- readMoreFontSize: STABLE (marked @Stable or @Immutable)
81+
- readMoreFontStyle: STABLE (known stable type)
82+
- readMoreFontWeight: STABLE (marked @Stable or @Immutable)
83+
- readMoreFontFamily: STABLE (marked @Stable or @Immutable)
84+
- readMoreTextDecoration: STABLE (marked @Stable or @Immutable)
85+
- readMoreMaxLines: STABLE (primitive type)
86+
- readMoreOverflow: STABLE
87+
- readMoreStyle: STABLE (marked @Stable or @Immutable)
88+
- readLessText: STABLE
89+
- readLessColor: STABLE (marked @Stable or @Immutable)
90+
- readLessFontSize: STABLE (marked @Stable or @Immutable)
91+
- readLessFontStyle: STABLE (known stable type)
92+
- readLessFontWeight: STABLE (marked @Stable or @Immutable)
93+
- readLessFontFamily: STABLE (marked @Stable or @Immutable)
94+
- readLessTextDecoration: STABLE (marked @Stable or @Immutable)
95+
- readLessStyle: STABLE (marked @Stable or @Immutable)
96+
- toggleArea: STABLE
97+
- $composer: RUNTIME (requires runtime check)
98+
- $changed: STABLE (primitive type)
99+
- $changed1: STABLE (primitive type)
100+
- $changed2: STABLE (primitive type)
101+
- $changed3: STABLE (primitive type)
102+
- $default: STABLE (primitive type)
103+
- $default1: STABLE (primitive type)
104+

readmore-material3/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ plugins {
44
alias(libs.plugins.maven.publish)
55
alias(libs.plugins.jetbrains.dokka)
66
alias(libs.plugins.metalava)
7+
alias(libs.plugins.compose.stability.analyzer)
78
}
89

910
android {

0 commit comments

Comments
 (0)