Skip to content

Extend --shorebird-trace to aar, ios-framework, and desktop builds#136

Draft
eseidel wants to merge 1 commit intoshorebird/devfrom
es/extend-shorebird-trace
Draft

Extend --shorebird-trace to aar, ios-framework, and desktop builds#136
eseidel wants to merge 1 commit intoshorebird/devfrom
es/extend-shorebird-trace

Conversation

@eseidel
Copy link
Copy Markdown

@eseidel eseidel commented Apr 21, 2026

Summary

Shorebird's release flow passes --shorebird-trace=<path> to every flutter build subcommand it invokes. Only apk, appbundle, ios, and ipa were registering the option, so aar / ios-framework / linux / macos / windows builds failed argparse as soon as Shorebird's version gate admitted tracing.

  • Register usesShorebirdTraceOption() on BuildAarCommand, BuildFrameworkCommand, and — via addCommonDesktopBuildOptions — every desktop build command.
  • Wire AAR through the existing AndroidBuildTraceSession so flutter build aar --shorebird-trace actually produces per-task gradle trace data, mirroring the APK path in buildGradleApp.

For the desktop and framework subcommands the option is accepted but not yet wired into the native build orchestrators — that's a follow-up. Shorebird's in-process tracer still fills in the trace file, so callers get a usable (shorebird-side) trace instead of a crash.

Companion to shorebirdtech/shorebird#3709, which flips the Shorebird-side version gate to stop forwarding --shorebird-trace to Flutter pins that don't know the flag.

Test plan

  • dart pub run test test/general.shard/android/android_gradle_builder_test.dart test/general.shard/build_system/build_trace_test.dart test/commands.shard/hermetic/build_macos_test.dart test/commands.shard/hermetic/build_windows_test.dart — 87 tests pass, including the existing AAR gradle-builder cases.
  • Manually verified flutter build {aar,ios-framework,linux,macos,windows} -h --verbose now lists --shorebird-trace in the option output.

@eseidel eseidel marked this pull request as draft April 21, 2026 22:06
eseidel added a commit to shorebirdtech/shorebird that referenced this pull request Apr 21, 2026
…rt it (#3708)"

This reverts commit 2d0f891.

#3708 probed each `flutter build <cmd> -h` at runtime to decide whether
to pass `--shorebird-trace`. That was a belt-and-suspenders guard around
two real bugs:

1. The Shorebird gate mis-classified unresolved Flutter versions (dev
   revisions not on any `flutter_release/*` branch) as new enough, so
   it opted pre-feature pins into tracing.
2. `flutter build aar` / `ios-framework` / `linux` / `macos` /
   `windows` didn't register the option, so the flag couldn't be
   forwarded to them safely.

The previous commit on this branch fixes (1). The companion
shorebirdtech/flutter#136 fixes (2) and must be on the Shorebird
Flutter pin before this lands. With both in place, every subcommand
this CLI invokes accepts the flag when the gate admits tracing, and
every subcommand refuses it when the gate rejects tracing — so the
per-subcommand runtime probe (plus its 8 per-command call-site
detours and its help-output cache) is dead weight.
@eseidel
Copy link
Copy Markdown
Author

eseidel commented Apr 22, 2026

This and shorebirdtech/shorebird#3709 make an alternative to the dynamic discovery of --shorebird-trace that you did this afternoon. Let me know if you want them or if you just want to keep the dynamic discovery @bdero

@bdero bdero force-pushed the shorebird/dev branch 2 times, most recently from 8e0003b to fbecf6f Compare April 30, 2026 22:10
Wires --shorebird-trace into:
- BuildAarCommand and BuildFrameworkCommand (iOS frameworks)
- The shared usesBuildModeFlags path in FlutterCommand, which covers
  desktop builds (linux, macos, windows)
- AAR Gradle build path in AndroidGradleBuilder, mirroring the existing
  trace session usage in the assemble path

Note: when 'flutter build aar' is invoked with multiple modes in a single
run, each iteration's trace overwrites the previous one. Shorebird's
release flow only builds release mode, so this is not a concern in
practice.
@eseidel eseidel force-pushed the es/extend-shorebird-trace branch from 3868342 to 35ae169 Compare May 1, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants