Commit bb29e02
fix(snapshots): Generate Paparazzi 1.x compatible snapshot test code (#1142)
* fix(snapshots): Generate Paparazzi 1.x compatible snapshot test code
The generated ComposablePreviewSnapshotTest called
HtmlReportWriter(maxPercentDifference=...) which only compiles against
Paparazzi 2.x. In 1.x, HtmlReportWriter has no maxPercentDifference
parameter and accepts a no-arg constructor instead.
Detect the Paparazzi version from the declared testImplementation
dependencies and conditionally generate the appropriate
HtmlReportWriter constructor call for each major version.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(snapshots): Handle dynamic Paparazzi version strings
Extract version parsing into a testable parseMajorVersion() function
that takes the leading digits from the version string instead of
requiring strict semver. This handles dynamic versions like "1.+" which
SemVer.parse() would reject, causing the task to fail.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix(snapshots): Use project compileSdk instead of hardcoded MAX_API_LEVEL
When a preview doesn't specify an apiLevel, use the compileSdkVersion
from detectEnvironment() (which reflects the project's actual
compileSdk) instead of overriding it with a hardcoded MAX_API_LEVEL=36.
The hardcoded value caused Renderer.configureBuildProperties to crash on
Paparazzi 1.3.5 when its bundled layoutlib didn't support the SDK level.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 8cbd27a commit bb29e02
3 files changed
Lines changed: 67 additions & 7 deletions
File tree
- plugin-build/src
- main/kotlin/io/sentry/android/gradle
- snapshot
- test/kotlin/io/sentry/android/gradle/snapshot
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
495 | 495 | | |
496 | 496 | | |
497 | 497 | | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
498 | 507 | | |
499 | 508 | | |
500 | 509 | | |
501 | 510 | | |
502 | 511 | | |
503 | 512 | | |
| 513 | + | |
504 | 514 | | |
505 | 515 | | |
506 | 516 | | |
| |||
537 | 547 | | |
538 | 548 | | |
539 | 549 | | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
540 | 553 | | |
541 | 554 | | |
542 | 555 | | |
| |||
Lines changed: 13 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| 35 | + | |
| 36 | + | |
34 | 37 | | |
35 | 38 | | |
36 | 39 | | |
| |||
48 | 51 | | |
49 | 52 | | |
50 | 53 | | |
| 54 | + | |
51 | 55 | | |
52 | 56 | | |
53 | 57 | | |
| |||
62 | 66 | | |
63 | 67 | | |
64 | 68 | | |
| 69 | + | |
65 | 70 | | |
66 | 71 | | |
67 | 72 | | |
68 | 73 | | |
69 | 74 | | |
70 | 75 | | |
71 | 76 | | |
| 77 | + | |
72 | 78 | | |
73 | 79 | | |
74 | 80 | | |
| |||
87 | 93 | | |
88 | 94 | | |
89 | 95 | | |
| 96 | + | |
90 | 97 | | |
91 | 98 | | |
92 | 99 | | |
| |||
217 | 224 | | |
218 | 225 | | |
219 | 226 | | |
220 | | - | |
221 | 227 | | |
222 | 228 | | |
223 | 229 | | |
224 | | - | |
225 | | - | |
226 | | - | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
227 | 234 | | |
228 | 235 | | |
229 | 236 | | |
230 | | - | |
| 237 | + | |
231 | 238 | | |
232 | 239 | | |
233 | 240 | | |
| |||
240 | 247 | | |
241 | 248 | | |
242 | 249 | | |
243 | | - | |
| 250 | + | |
244 | 251 | | |
245 | 252 | | |
246 | 253 | | |
| |||
Lines changed: 41 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
| |||
124 | 126 | | |
125 | 127 | | |
126 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
127 | 164 | | |
128 | 165 | | |
129 | 166 | | |
| 167 | + | |
130 | 168 | | |
131 | | - | |
| 169 | + | |
132 | 170 | | |
133 | 171 | | |
134 | 172 | | |
| |||
138 | 176 | | |
139 | 177 | | |
140 | 178 | | |
| 179 | + | |
141 | 180 | | |
142 | 181 | | |
143 | 182 | | |
144 | 183 | | |
145 | 184 | | |
146 | 185 | | |
| 186 | + | |
147 | 187 | | |
148 | 188 | | |
149 | 189 | | |
| |||
0 commit comments