Skip to content

[tool] Use flutter for pub commands when examples use Flutter#11830

Merged
auto-submit[bot] merged 3 commits into
flutter:mainfrom
stuartmorgan-g:dart-analyze-fix
Jun 4, 2026
Merged

[tool] Use flutter for pub commands when examples use Flutter#11830
auto-submit[bot] merged 3 commits into
flutter:mainfrom
stuartmorgan-g:dart-analyze-fix

Conversation

@stuartmorgan-g

Copy link
Copy Markdown
Collaborator

#11797 changed the repo tooling to use dart instead of flutter for more commands when the target package isn't a Flutter package, include pub downgrade and pub get in analyze. However, since pub get will resolve any example apps, if any of them use Flutter, dart pub get will fail unless dart is coming from the Flutter SDK. Normally this is fine since that's the expected setup, but for the head-head tests in dart-lang that run the repo analysis using the head version of Dart via the --analysis-sdk flag, using that version of Dart for pub commands breaks things.

This checks the example apps for Flutter dependencies to ensure that dart pub won't be used in cases where that can cause failures to resolve in the examples. This should be safe for core-packages, since core-packages should never use Flutter, even in examples.

flutter#11797 changed the repo tooling
to use `dart` instead of `flutter` for more commands when the target
package isn't a Flutter package, include `pub downgrade` and `pub get`
in `analyze`. However, since `pub get` will resolve any example apps, if
any of *them* use Flutter, `dart pub get` will fail unless `dart` is
coming from the Flutter SDK. Normally this is fine since that's the
expected setup, but for the head-head tests in dart-lang that run the
repo analysis using the head version of Dart via the `--analysis-sdk`
flag, using that version of Dart for pub commands breaks things.

This checks the example apps for Flutter dependencies to ensure that
`dart pub` won't be used in cases where that can cause failures to
resolve in the examples. This should be safe for core-packages, since
core-packages should never use Flutter, even in examples.
@stuartmorgan-g stuartmorgan-g requested a review from srawlins June 3, 2026 17:32
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Jun 3, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the tooling to run flutter pub commands instead of dart pub for non-Flutter packages that contain Flutter examples, ensuring correct dependency resolution. This is implemented by adding a recursiveFlutterCheck flag to the pub utility functions. Feedback on the changes suggests updating startPubCommand to also support and forward this new flag for completeness, and explicitly passing examples: [] when creating a fake example package in the tests for consistency.

Comment thread script/tool/test/analyze_command_test.dart Outdated
Comment thread script/tool/lib/src/common/pub_utils.dart
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 3, 2026

@srawlins srawlins left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense to me; love that there are tests :D

@stuartmorgan-g stuartmorgan-g added CICD Run CI/CD autosubmit Merge PR when tree becomes green via auto submit App labels Jun 3, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 3, 2026
@auto-submit

auto-submit Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/packages/11830, because - The status or check suite Mac_arm64 custom_package_tests master has failed. Please fix the issues identified (or deflake) before re-applying this label.

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 3, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 3, 2026
@auto-submit

auto-submit Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/packages/11830, because - The status or check suite Mac_arm64 macos_platform_tests master - packages has failed. Please fix the issues identified (or deflake) before re-applying this label.

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 3, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 3, 2026
@auto-submit

auto-submit Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/packages/11830, because - The status or check suite Mac_arm64 macos_platform_tests master - packages has failed. Please fix the issues identified (or deflake) before re-applying this label.

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 4, 2026
@auto-submit

auto-submit Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/packages/11830, because - The status or check suite Mac_arm64 macos_platform_tests master - packages has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 4, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label Jun 4, 2026
@stuartmorgan-g stuartmorgan-g added CICD Run CI/CD autosubmit Merge PR when tree becomes green via auto submit App labels Jun 4, 2026
@auto-submit auto-submit Bot merged commit 61bdbb4 into flutter:main Jun 4, 2026
87 checks passed
@stuartmorgan-g stuartmorgan-g deleted the dart-analyze-fix branch June 4, 2026 20:46
tamirenkhbayar3-cmd pushed a commit to tamirenkhbayar3-cmd/flutter that referenced this pull request Jun 5, 2026
…r#187612)

flutter/packages@03352b5...61bdbb4

2026-06-04 stuartmorgan@google.com [tool] Use `flutter` for pub commands
when examples use Flutter (flutter/packages#11830)
2026-06-04 stuartmorgan@google.com Sync analysis_options.yaml with
flutter/flutter (flutter/packages#11823)
2026-06-04 stuartmorgan@google.com [path_provider] Create temp dir in
tests if needed (flutter/packages#11841)
2026-06-04 jeff.ward@datadoghq.com [webview] Add new method for cross
plugin webview access (flutter/packages#11714)
2026-06-04 47866232+chunhtai@users.noreply.github.com [ci] Renames the
override post-release label for batch release (flutter/packages#11835)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
…ter#11830)

flutter#11797 changed the repo tooling to use `dart` instead of `flutter` for more commands when the target package isn't a Flutter package, include `pub downgrade` and `pub get` in `analyze`. However, since `pub get` will resolve any example apps, if any of *them* use Flutter, `dart pub get` will fail unless `dart` is coming from the Flutter SDK. Normally this is fine since that's the expected setup, but for the head-head tests in dart-lang that run the repo analysis using the head version of Dart via the `--analysis-sdk` flag, using that version of Dart for pub commands breaks things.

This checks the example apps for Flutter dependencies to ensure that `dart pub` won't be used in cases where that can cause failures to resolve in the examples. This should be safe for core-packages, since core-packages should never use Flutter, even in examples.
via-guy pushed a commit to via-guy/flutter that referenced this pull request Jun 26, 2026
…r#187612)

flutter/packages@03352b5...61bdbb4

2026-06-04 stuartmorgan@google.com [tool] Use `flutter` for pub commands
when examples use Flutter (flutter/packages#11830)
2026-06-04 stuartmorgan@google.com Sync analysis_options.yaml with
flutter/flutter (flutter/packages#11823)
2026-06-04 stuartmorgan@google.com [path_provider] Create temp dir in
tests if needed (flutter/packages#11841)
2026-06-04 jeff.ward@datadoghq.com [webview] Add new method for cross
plugin webview access (flutter/packages#11714)
2026-06-04 47866232+chunhtai@users.noreply.github.com [ci] Renames the
override post-release label for batch release (flutter/packages#11835)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC flutter-ecosystem@google.com on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants