Sitelet https://github.com/flutter/flutter/pull/192818
Skip to content

feat(flutter_tools): migrate Apple build commands to typed options - #192818

Merged
auto-submit[bot] merged 8 commits into
flutter:masterfrom
kevmoo:pr6-apple-build-options
Sep 25, 2026
Merged

auto-submit[bot] merged 8 commits into
flutter:masterfrom
kevmoo:pr6-apple-build-options

Conversation

@kevmoo

@kevmoo kevmoo commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Migrates Apple build subcommands (build ios, build ipa, build macos, build ios-framework, build macos-framework, and build swift-package) to use typed option descriptors and option bundles.

  • Adds BuildInfoOptions.codesignIdentity and DebuggingOptionDescriptors.publishPort descriptors.
  • Adds AppleBuildOptionsBundle for common Apple compilation and build options (flavor, splitDebugInfo, obfuscate, extraFrontEndOptions, extraGenSnapshotOptions, performanceMeasurementFile, analyzeSize, and codeSizeDirectory).
  • Adds DarwinCodeSignXCFrameworksOptionsBundle composing codesign and codesignIdentity.
  • Removes obsolete usesDarwinCodeSignXCFrameworksOption helper from FlutterCommand as all callers (build ios-framework, build macos-framework, build swift-package) have migrated.
  • Updates FlutterCommand.addPublishPort and FlutterCommand.disablePortPublication to use DebuggingOptionDescriptors.publishPort.
  • Migrates command constructors to registerOptionBundles and argParser.addDescriptors.
  • Migrates option reads to getValue(...) / wasParsed(...) via SafeArgResults.
  • Adds unit tests for AppleBuildOptionsBundle and DarwinCodeSignXCFrameworksOptionsBundle in option_descriptor_test.dart.

Pre-launch Checklist

@github-actions github-actions Bot added tool Affects the "flutter" command-line tool. See also t: labels. team-ios Owned by iOS platform team team-macos Owned by the macOS platform team labels Sep 15, 2026
@kevmoo
kevmoo marked this pull request as ready for review September 15, 2026 19:50
@kevmoo
kevmoo requested review from a team as code owners September 15, 2026 19:50

@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 refactors command-line option registration across several Apple-related build commands to use a structured, descriptor-based approach with OptionDescriptor and OptionBundle. A critical compilation issue was identified in DarwinAddToAppOptionsBundle.onRegister, where the non-existent methods enableUsesTargetOption and enableUsesPubOption are called on FlutterCommand instead of usesTargetOption and usesPubOption.

Comment thread packages/flutter_tools/lib/src/runner/options/common_options.dart
@kevmoo kevmoo added the CICD Run CI/CD label Sep 18, 2026
…ions

# Conflicts:
#	packages/flutter_tools/lib/src/commands/build_ios.dart
#	packages/flutter_tools/lib/src/commands/build_macos.dart
@okorohelijah

Copy link
Copy Markdown
Contributor

@kevmoo some tests are failing:

02:12 +3 -1: test/integration.shard/swift_package_manager_add2app_test.dart: Generate and embed Flutter app in native macos app using SwiftPM [E]
  Expected: not <Instance of 'FileSystemEntity'> with `existsSync`: <true>
    Actual: LocalDirectory:<LocalDirectory: '/Volumes/Work/s/w/ir/x/t/swift_package_manager_add2app_test_macos.vKt8VK/my_flutter_app/build/macos/SwiftPackages/FlutterNativeIntegration/FlutterNativeTools/Tests'>
  
  package:matcher                                                        expect
  test/integration.shard/swift_package_manager_add2app_test.dart 640:3   _verifyModeAgnosticFiles
  test/integration.shard/swift_package_manager_add2app_test.dart 144:11  main.<fn>
06:14 +4 -2: test/integration.shard/swift_package_manager_add2app_test.dart: Generate and embed Flutter app in native ios app using SwiftPM [E]
  Expected: not <Instance of 'FileSystemEntity'> with `existsSync`: <true>
    Actual: LocalDirectory:<LocalDirectory: '/Volumes/Work/s/w/ir/x/t/swift_package_manager_add2app_test_ios.wYWcUh/my_flutter_app/build/ios/SwiftPackages/FlutterNativeIntegration/FlutterNativeTools/Tests'>
  
  package:matcher                                                        expect
  test/integration.shard/swift_package_manager_add2app_test.dart 640:3   _verifyModeAgnosticFiles
  test/integration.shard/swift_package_manager_add2app_test.dart 144:11  main.<fn>

…ateTests

`BuildSwiftPackage.generateTests` previously checked `boolArg('ci', global: true)`,
which is only true when `--ci` is explicitly passed on the command line.
Using `usingCISystem` caused `generateTests` to return `true` whenever
`LUCI_CI=True` was set in the environment on LUCI bots (breaking
`swift_package_manager_add2app_test.dart` in `Mac tool_integration_tests_8`).

- Add `CommonOptions.ci` (`OptionScope.global`) for `--ci` and register it in `FlutterCommandRunner`.
- Update `FlutterCommand.usingCISystem` and `BuildSwiftPackage.generateTests` to read `getValue(CommonOptions.ci)`.
- Add hermetic regression test in `build_swift_package_test.dart`.
@kevmoo

kevmoo commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for flagging, @okorohelijah! Fixed in 45abce6.

Root cause: BuildSwiftPackage.generateTests originally checked boolArg(FlutterGlobalOptions.kContinuousIntegrationFlag, global: true), which is true only when --ci is explicitly passed on the CLI. Switching it to usingCISystem caused generateTests to also return true whenever LUCI_CI=True is set in the environment on LUCI bots, unexpectedly generating FlutterNativeIntegration/FlutterNativeTools/Tests during swift_package_manager_add2app_test.dart.

We added a typed global descriptor CommonOptions.ci (OptionScope.global), updated both FlutterCommand.usingCISystem and BuildSwiftPackage.generateTests to read getValue(CommonOptions.ci), and added a hermetic regression test in build_swift_package_test.dart.

@kevmoo
kevmoo requested a review from bkonyi September 24, 2026 20:08
@kevmoo kevmoo added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 24, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Sep 25, 2026
Merged via the queue into flutter:master with commit c990a63 Sep 25, 2026
23 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 25, 2026
@kevmoo
kevmoo deleted the pr6-apple-build-options branch September 25, 2026 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD team-ios Owned by iOS platform team team-macos Owned by the macOS platform team tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants