Repository navigation
[flutter_tools] Inject CrashReportSender into SwiftPM migration - #196315
auto-submit[bot] merged 4 commits into
Conversation
Previously, `SwiftPackageManagerIntegrationMigration` accepted `required bool reportCrashes` and instantiated `CrashReportSender` inline with an unmocked `http.Client()`. As a result, the `validate project settings` unit tests in `swift_package_manager_integration_migration_test.dart` made live HTTPS `POST` requests to `https://clients2.google.com/cr/report`, causing `tool_tests_general` presubmits to fail with `TimeoutException` whenever the remote endpoint took longer than 2 seconds. Replace `bool reportCrashes` with an optional `CrashReportSender? crashReportSender` constructed at the `buildXcodeProject` and `buildMacOS` production call sites (when `!botDetector.isRunningOnBot`), and pass a `MockClient`-backed `CrashReportSender` in `swift_package_manager_integration_migration_test.dart`. Previous output: ``` 00:02 +153 -1: Flutter Package Migration validate project settings throw if settings fail to compile [E] TimeoutException after 0:00:02.000000: Test timed out after 2 seconds. ``` Current output: ``` +156: All tests passed! ```
…tPM migration test Replace `MockClient` and `_parseMultipartFields` in `swift_package_manager_integration_migration_test.dart` with `FakeCrashReportSender`, and assert directly on the recorded `SentCrashReport` fields (`command`, `error`, `flutterVersion`, and `typeId`).
|
Yep, it should! |
There was a problem hiding this comment.
Code Review
This pull request refactors crash reporting in the iOS and macOS build pipelines by passing a CrashReportSender instance directly to SwiftPackageManagerIntegrationMigration instead of a boolean flag, which simplifies the migration class and improves testability. The review comments suggest further optimizing this by passing a factory function (CrashReportSender Function()?) to lazily instantiate the sender, thereby avoiding unnecessary resource allocation on successful builds.
|
I think you'll need to rebase and remove the skip added in https://github.com/flutter/flutter/pull/196310/changes. |
Merge `origin/master` and re-enable the two `validate project settings` tests in `swift_package_manager_integration_migration_test.dart` that were temporarily skipped in flutter#196310. Previous output: ``` 00:32 +3002 ~2 -1: test/general.shard/migrations/swift_package_manager_integration_migration_test.dart: Flutter Package Migration validate project settings throw if settings fail to compile [E] TimeoutException after 0:00:02.000000: Test timed out after 2 seconds. dart:isolate _RawReceivePort._handleMessage ``` Current output: ``` +156: All tests passed! ``` Fixes flutter#196307
Replace `CrashReportSender? crashReportSender` in `SwiftPackageManagerIntegrationMigration` with an optional `CrashReportSender Function()? crashReportSenderFactory` so `CrashReportSender` and its underlying `http.Client` are only instantiated if `getInfo` throws an exception on non-bot builds. Update the `validate project settings` tests in `swift_package_manager_integration_migration_test.dart` to pass the factory and verify it is not invoked when project settings compile. Previous output: ``` 00:32 +3002 ~2 -1: test/general.shard/migrations/swift_package_manager_integration_migration_test.dart: Flutter Package Migration validate project settings throw if settings fail to compile [E] TimeoutException after 0:00:02.000000: Test timed out after 2 seconds. dart:isolate _RawReceivePort._handleMessage ``` Current output: ``` +157: All tests passed! ``` Fixes flutter#196307
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request replaces the boolean reportCrashes parameter with a nullable crashReportSenderFactory function in the Swift Package Manager integration migration. This allows CrashReportSender to be instantiated dynamically. The changes are applied to iOS and macOS build systems, and the test suite is updated with a new FakeCrashReportSender to verify the migration crash reporting behavior. There are no review comments, so I have no feedback to provide.
flutter/flutter@b98afb5...9c427b5 2026-11-12 [email protected] Roll Skia from d67d0f22e3ec to 9aa2513a4ac9 (2 revisions) (flutter/flutter#196429) 2026-11-12 [email protected] [flutter_tools] Move CpuArch to flutter_tools_core and define HostPlatform by osName and cpuArch (flutter/flutter#195841) 2026-11-12 [email protected] Roll Skia from 23e7e63789b8 to d67d0f22e3ec (2 revisions) (flutter/flutter#196424) 2026-11-12 [email protected] Uber compactify (flutter/flutter#196392) 2026-11-12 [email protected] Roll Skia from 3d7e335da165 to 23e7e63789b8 (12 revisions) (flutter/flutter#196422) 2026-11-12 [email protected] Roll Dart SDK from 13af329ea4f2 to e5add7a25b32 (1 revision) (flutter/flutter#196413) 2026-11-12 [email protected] Don't terminate the shared EGL display when an engine is disposed (flutter/flutter#194520) 2026-11-11 [email protected] Adds manifest flag to turn on SDFs for Android. (flutter/flutter#196056) 2026-11-11 [email protected] Remove bringup from Linux_pixel_7pro integration_ui_keyboard_inset_jump (flutter/flutter#196334) 2026-11-11 [email protected] Uses system default locale for text rendering when preferred locale isn't supported (flutter/flutter#195997) 2026-11-11 [email protected] [android]: prewarms shaders when the context is created (flutter/flutter#196069) 2026-11-11 [email protected] iOS: Recomposite platform views only if their parameters change (flutter/flutter#196287) 2026-11-11 [email protected] [flutter_tools] Forward encoding in ErrorHandlingFile.readAsStringSync (flutter/flutter#196136) 2026-11-11 [email protected] Roll Skia from b89c24bbab8c to 3d7e335da165 (8 revisions) (flutter/flutter#196390) 2026-11-11 [email protected] Add Flutter Gardener instructions on how to disable a test (flutter/flutter#196312) 2026-11-11 [email protected] [Impeller] Enable malioc analysis for framebuffer_blend shaders (flutter/flutter#196343) 2026-11-11 [email protected] [flutter_tools] Migrate general.shard Android, asset, and build tests off globals (flutter/flutter#196125) 2026-11-11 [email protected] Roll Dart SDK from 8f15c4ca2d41 to 13af329ea4f2 (1 revision) (flutter/flutter#196386) 2026-11-11 [email protected] [Impeller] Do not clamp the local coverage limit to the root render target (flutter/flutter#195860) 2026-11-11 [email protected] [Impeller] Use separate uniform buffers on VMware SVGA3D (flutter/flutter#196022) 2026-11-11 [email protected] [flutter_tools] Introduce AndroidSdkProvider for lazy native_assets SDK lookup (flutter/flutter#196122) 2026-11-11 [email protected] Moves linux to ThinLTO. (flutter/flutter#196314) 2026-11-11 [email protected] [flutter_tools] Migrate bin/fuchsia_tester.dart off globals and runInContext (flutter/flutter#196074) 2026-11-11 [email protected] Changes the tolerances for frame_rate_main_test.dart. (flutter/flutter#196304) 2026-11-11 [email protected] Roll Packages from 08faf64 to 653628e (16 revisions) (flutter/flutter#196381) 2026-11-11 [email protected] Allow SliverCrossAxisGroup children to lay out with zero cross-axis extent instead of asserting (flutter/flutter#191287) 2026-11-11 [email protected] Roll Skia from cc4c54f752ba to b89c24bbab8c (4 revisions) (flutter/flutter#196375) 2026-11-11 [email protected] [Linux] Fix layer offset when compositing with glBlitFramebuffer (flutter/flutter#196189) 2026-11-11 [email protected] [flutter_tools] Inject CrashReportSender into SwiftPM migration (flutter/flutter#196315) If this roll has caused a breakage, revert this CL and set the roller to dry run mode using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: 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
Previously,
SwiftPackageManagerIntegrationMigrationacceptedrequired bool reportCrashesand instantiatedCrashReportSenderinline with an unmockedhttp.Client(). As a result, thevalidate project settingsunit tests inswift_package_manager_integration_migration_test.dartmade live HTTPSPOSTrequests tohttps://clients2.google.com/cr/report, causingtool_tests_generalpresubmits to fail withTimeoutExceptionwhenever the remote endpoint took longer than 2 seconds.Replace
bool reportCrasheswith an optionalCrashReportSender Function()? crashReportSenderFactorypassed at thebuildXcodeProjectandbuildMacOSproduction call sites (when!botDetector.isRunningOnBot) soCrashReportSenderand itshttp.Clientare only allocated when a migration crash occurs, pass aFakeCrashReportSenderfactory inswift_package_manager_integration_migration_test.dart, and re-enable the twovalidate project settingstests that were temporarily skipped in #196310.Fixes #196307
Previous output:
Current output:
Pre-launch Checklist
///).