Repository navigation
feat(flutter_tools): migrate Apple build commands to typed options - #192818
Conversation
…ions # Conflicts: # packages/flutter_tools/lib/src/runner/flutter_command.dart
There was a problem hiding this comment.
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.
…ions # Conflicts: # packages/flutter_tools/lib/src/commands/build_ios.dart # packages/flutter_tools/lib/src/commands/build_macos.dart
|
@kevmoo some tests are failing: |
…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`.
|
Thanks for flagging, @okorohelijah! Fixed in 45abce6. Root cause: We added a typed global descriptor |
…lutter#193323) Migrate `BuildLinuxCommand` (`build linux`) and `BuildWindowsCommand` (`build windows`) to typed `OptionDescriptor`s and `OptionBundle`s (following flutter#191018, flutter#191510, flutter#191760, flutter#192307, flutter#192455, flutter#192524, and flutter#192818): - Add `DesktopBuildOptionsBundle` in `common_options.dart`, encapsulating `CommonBuildOptionsBundle`, `BuildModeOptionsBundle`, `DartCompileOptionsBundle`, `BuildInfoOptions.flavor`, `splitDebugInfo`, `obfuscate`, `extraFrontEndOptions`, `extraGenSnapshotOptions`, `performanceMeasurementFile`, `analyzeSize`, `codeSizeDirectory`, `trackWidgetCreation`, and `configOnly`. - Migrate `BuildLinuxCommand` (`build_linux.dart`) to `DesktopBuildOptionsBundle`, `DefaultedEnumOptionDescriptor<TargetPlatform>` (`_targetPlatformOption`), and `DefaultedStringOptionDescriptor` (`_targetSysroot`), replacing untyped `boolArg('config-only')`, `stringArg('target-platform')!`, and `stringArg('target-sysroot')!` queries. - Migrate `BuildWindowsCommand` (`build_windows.dart`) to `DesktopBuildOptionsBundle` and `getValue(DesktopBuildOptionsBundle.configOnly)`. - Delete the obsolete `FlutterCommand.addCommonDesktopBuildOptions` helper method from `flutter_command.dart` (no remaining callers in `flutter_tools`). ## 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]. - [ ] 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.
Migrates Apple build subcommands (
build ios,build ipa,build macos,build ios-framework,build macos-framework, andbuild swift-package) to use typed option descriptors and option bundles.BuildInfoOptions.codesignIdentityandDebuggingOptionDescriptors.publishPortdescriptors.AppleBuildOptionsBundlefor common Apple compilation and build options (flavor,splitDebugInfo,obfuscate,extraFrontEndOptions,extraGenSnapshotOptions,performanceMeasurementFile,analyzeSize, andcodeSizeDirectory).DarwinCodeSignXCFrameworksOptionsBundlecomposingcodesignandcodesignIdentity.usesDarwinCodeSignXCFrameworksOptionhelper fromFlutterCommandas all callers (build ios-framework,build macos-framework,build swift-package) have migrated.FlutterCommand.addPublishPortandFlutterCommand.disablePortPublicationto useDebuggingOptionDescriptors.publishPort.registerOptionBundlesandargParser.addDescriptors.getValue(...)/wasParsed(...)viaSafeArgResults.AppleBuildOptionsBundleandDarwinCodeSignXCFrameworksOptionsBundleinoption_descriptor_test.dart.Pre-launch Checklist
///).