Repository navigation
Commit b5d6c80
authored
[CI] Update deps script (flutter#12427)
- Unblocks flutter/packages#12423
Fixes a Pub version solver failure during release PR testing (`make-deps-path-based`) for co-dependent packages (specifically `material_ui` and `cupertino_ui`).
When creating a release PR for `material_ui` (e.g., `release-material_ui-0.0.3+1`), the `make-deps-path-based` CI step failed during `flutter test` on `packages/cupertino_ui` with the following Pub version solver error:
```
Resolving dependencies in `./example`...
Because every version of material_ui from path depends on cupertino_ui from hosted and cupertino_ui_examples depends on cupertino_ui from path, material_ui from path is forbidden.
So, because cupertino_ui_examples depends on material_ui from path, version solving failed.
Failed to update packages.
```
`material_ui` and `cupertino_ui` share an asymmetric co-dependency in the repository:
- **`material_ui`** has a **direct dependency** on `cupertino_ui` (`dependencies: cupertino_ui: ^0.0.3`).
- **`cupertino_ui`** has a **dev dependency** on `material_ui` (`dev_dependencies: material_ui: ^0.0.2`).
When `make-deps-path-based --target-dependencies=material_ui` runs:
1. `make-deps-path-based` adds `dependency_overrides: material_ui: {path: ../material_ui}` to `cupertino_ui/pubspec.yaml` and `cupertino_ui/example/pubspec.yaml`.
2. `cupertino_ui/example` depends directly on `cupertino_ui` (`path: ..`).
3. `material_ui` (from `path`) depends on `cupertino_ui: ^0.0.3` (from hosted `pub.dev`).
4. Without `cupertino_ui` in `cupertino_ui/example`'s `dependency_overrides`, Pub detects `cupertino_ui` sourced from **`path`** (in `cupertino_ui_examples`) and **`hosted`** (in `material_ui`), causing Pub's version solver to reject the resolution graph.
Updated `make-deps-path-based` (`script/tool/lib/src/make_deps_path_based_command.dart`):
When `_addDependencyOverridesIfNecessary` recursively updates example apps of a package (`for (final RepositoryPackage example in package.getExamples())`), it now explicitly includes the parent `package` itself in the local package mapping and `additionalPackagesToOverride`.
This ensures `cupertino_ui/example/pubspec.yaml` receives a path override for its parent package (`dependency_overrides: cupertino_ui: {path: ...}`) alongside the target package override (`material_ui: {path: ...}`). Consequently, Pub solver resolves both local path dependencies cleanly without requiring recursive dependency expansion (thereby preserving the safety net of `--target-dependencies`).
---
#### Why `cupertino_ui` Has a `dev_dependency` on `material_ui`
`cupertino_ui` declares `material_ui` in its `dev_dependencies` because multiple files across `cupertino_ui/lib/src/` (e.g., `text_field.dart`, `dialog.dart`, `scrollbar.dart`, `theme.dart`) use Dart `@docImport` directives referencing Material design widgets in public API documentation:
```dart
/// @DocImport 'package:material_ui/material_ui.dart';
```
Per Dart doc guidelines, packages referenced in `@docImport` must be declared in `dev_dependencies` so static analysis and `dartdoc` can resolve the cross-referenced symbols.
---
#### Didn't we fix this last week?
- **Aug 4, 09:06 AM (`material_ui 0.0.3` release flutter#12352)**: Both packages still used Dart Workspaces (`resolution: workspace`). Under Dart Workspaces, Pub dependency resolution was handled at the top-level workspace root, hiding the Pub solver conflict.
- **Aug 4, 12:44 PM (PR flutter#12351)**: PR flutter#12351 landed to unblock `cupertino_ui 0.0.3` by removing Dart workspaces from `cupertino_ui` and `material_ui`.
- When releasing **`cupertino_ui`** (`targetDependencies=cupertino_ui`), `material_ui` got path overrides for `cupertino_ui`. Since `cupertino_ui` didn't depend on a third package pulling hosted `cupertino_ui`, `cupertino_ui`'s release succeeded.
- However, when releasing **`material_ui`** (`targetDependencies=material_ui`), `material_ui`'s direct dependency on `cupertino_ui` caused `cupertino_ui/example` to fail.
- **Aug 10 (`material_ui 0.0.3+1` release flutter#12423)**: This was the first release attempt of `material_ui` since Dart workspaces were removed, exposing the non-workspace Pub solver requirement.
## Pre-Review Checklist
**Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.
[^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.1 parent cdbe30f commit b5d6c80
2 files changed
Lines changed: 57 additions & 5 deletions
File tree
- script/tool
- lib/src
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
239 | | - | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
240 | 243 | | |
241 | 244 | | |
242 | 245 | | |
| |||
272 | 275 | | |
273 | 276 | | |
274 | 277 | | |
| 278 | + | |
275 | 279 | | |
276 | 280 | | |
277 | | - | |
| 281 | + | |
278 | 282 | | |
279 | | - | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
280 | 286 | | |
281 | 287 | | |
282 | 288 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
229 | | - | |
| 229 | + | |
| 230 | + | |
230 | 231 | | |
231 | 232 | | |
232 | 233 | | |
| |||
248 | 249 | | |
249 | 250 | | |
250 | 251 | | |
251 | | - | |
| 252 | + | |
252 | 253 | | |
| 254 | + | |
253 | 255 | | |
254 | 256 | | |
255 | 257 | | |
| |||
264 | 266 | | |
265 | 267 | | |
266 | 268 | | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
267 | 313 | | |
268 | 314 | | |
269 | 315 | | |
| |||
0 commit comments