Repository navigation
Reland "[flutter_tools] forward --offline flag to pub.get in update-packages" - #193838
Conversation
…ackages" Relands flutter#193619 (reverted in flutter#193808) with `const DelegatingToolContext()` in `update_packages_test.dart` to satisfy `prefer_const_constructors`. Fixes flutter#193423
There was a problem hiding this comment.
Code Review
This pull request adds support for an --offline flag in the UpdatePackagesCommand by passing the offline state to the _pubGet helper and the underlying pub.get call, along with corresponding tests. Feedback suggests simplifying the _pubGet helper method and its call sites by directly accessing the inherited offline instance property instead of passing it as an explicit parameter.
Simplifies `_pubGet` and its call sites in `UpdatePackagesCommand.runCommand` by reading `boolArg(_keyOffline)` directly inside `_pubGet` instead of threading an `offline` parameter.
# Conflicts: # packages/flutter_tools/lib/src/commands/update_packages.dart # packages/flutter_tools/test/commands.shard/hermetic/update_packages_test.dart
|
An existing Git SHA, To re-trigger presubmits after closing or re-opeing a PR, or pushing a HEAD commit (i.e. with |
There was a problem hiding this comment.
Code Review
This pull request updates the _pubGet method in UpdatePackagesCommand to use named parameters, including a new offline parameter derived from command-line arguments. It also updates the _FakePub test utility to record these calls and adds test cases to verify that the offline flag is correctly passed. I have no feedback to provide.
|
autosubmit label was removed for flutter/flutter/193838, because The base commit of the PR is older than 7 days and can not be merged. Please merge the latest changes from the main into this branch and resubmit the PR. |
…ackages" (flutter#193838) Relands flutter#193619 (reverted in flutter#193808) with `const` added to `DelegatingToolContext()` in `update_packages_test.dart` to satisfy `prefer_const_constructors`. When running `flutter update-packages --offline`, the `--offline` flag was parsed and used to validate incompatible option combinations (such as `--force-upgrade` and `--cherry-pick-package`), but was not forwarded to the underlying `pub.get` invocations. Read `boolArg(_keyOffline)` in `_pubGet` and forward it to `pub.get` so that `pub` does not attempt network operations in offline environments. Fixes flutter#193423 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [breaking change policy]: https://flutter.dev/to/breaking-changes [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Relands #193619 (reverted in #193808) with
constadded toDelegatingToolContext()inupdate_packages_test.dartto satisfyprefer_const_constructors.When running
flutter update-packages --offline, the--offlineflag was parsed and used to validate incompatible option combinations (such as--force-upgradeand--cherry-pick-package), but was not forwarded to the underlyingpub.getinvocations. ReadboolArg(_keyOffline)in_pubGetand forward it topub.getso thatpubdoes not attempt network operations in offline environments.Fixes #193423
Pre-launch Checklist
///).