From 4d060aeb341c0b4e40bebbe1aef755bcc8871d27 Mon Sep 17 00:00:00 2001 From: "auto-submit[bot]" <98614782+auto-submit[bot]@users.noreply.github.com> Date: Mon, 28 Jul 2025 20:07:47 +0000 Subject: [PATCH] Reverts "[flutter_tools] Add --no-codesign support for macOS build (#169034)" (#172878) Reverts: flutter/flutter#169034 Initiated by: vashworth Reason for reverting: failing in post-submit https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8708074284638575793/+/u/run_test.dart_for_analyze_shard_and_subshard_None/stdout Original PR Author: knopp Reviewed By: {bkonyi, vashworth} This change reverts the following previous change: Unlike iOS, the macOS build currently does not support `--no-codesign` option to skip signing of application bundle. Having this option is useful for situation where the code-signing step is happens separately after the bundle is built (i.e. on CI). ## 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. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. [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/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md Co-authored-by: auto-submit[bot] --- .../lib/src/commands/build_macos.dart | 7 --- .../lib/src/macos/build_macos.dart | 6 --- .../hermetic/build_macos_test.dart | 54 ------------------- 3 files changed, 67 deletions(-) diff --git a/packages/flutter_tools/lib/src/commands/build_macos.dart b/packages/flutter_tools/lib/src/commands/build_macos.dart index 7185d86afcc..641e8fc29b1 100644 --- a/packages/flutter_tools/lib/src/commands/build_macos.dart +++ b/packages/flutter_tools/lib/src/commands/build_macos.dart @@ -25,7 +25,6 @@ class BuildMacosCommand extends BuildSubCommand { 'This can be used in CI/CD process that create an archive to avoid ' 'performing duplicate work.', ); - argParser.addFlag('codesign', defaultsTo: true, help: 'Codesign the application bundle.'); } @override @@ -47,8 +46,6 @@ class BuildMacosCommand extends BuildSubCommand { bool get configOnly => boolArg('config-only'); - bool get shouldCodesign => boolArg('codesign'); - @override Future runCommand() async { final BuildInfo buildInfo = await getBuildInfo(); @@ -60,9 +57,6 @@ class BuildMacosCommand extends BuildSubCommand { if (!supported) { throwToolExit('"build macos" only supported on macOS hosts.'); } - if (!shouldCodesign) { - globals.printStatus('Warning: Building with codesigning disabled.'); - } await buildMacOS( flutterProject: project, buildInfo: buildInfo, @@ -76,7 +70,6 @@ class BuildMacosCommand extends BuildSubCommand { analytics: analytics, ), usingCISystem: usingCISystem, - codesign: shouldCodesign, ); return FlutterCommandResult.success(); } diff --git a/packages/flutter_tools/lib/src/macos/build_macos.dart b/packages/flutter_tools/lib/src/macos/build_macos.dart index 87983663939..974f2a4149a 100644 --- a/packages/flutter_tools/lib/src/macos/build_macos.dart +++ b/packages/flutter_tools/lib/src/macos/build_macos.dart @@ -72,7 +72,6 @@ Future buildMacOS({ bool configOnly = false, SizeAnalyzer? sizeAnalyzer, bool usingCISystem = false, - bool codesign = true, }) async { final Directory? xcodeWorkspace = flutterProject.macos.xcodeWorkspace; if (xcodeWorkspace == null) { @@ -225,11 +224,6 @@ Future buildMacOS({ if (disabledSandboxEntitlementFile != null) 'CODE_SIGN_ENTITLEMENTS=${disabledSandboxEntitlementFile.path}', ...environmentVariablesAsXcodeBuildSettings(globals.platform), - if (!codesign) ...[ - 'CODE_SIGNING_ALLOWED=NO', - 'CODE_SIGNING_REQUIRED=NO', - 'CODE_SIGNING_IDENTITY=""', - ], ], trace: true, stdoutErrorMatcher: verboseLogging ? null : _filteredOutput, diff --git a/packages/flutter_tools/test/commands.shard/hermetic/build_macos_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/build_macos_test.dart index a1ccec64466..9c2bedbd0ff 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/build_macos_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/build_macos_test.dart @@ -1010,58 +1010,4 @@ STDERR STUFF OperatingSystemUtils: () => FakeOperatingSystemUtils(hostPlatform: HostPlatform.darwin_x64), }, ); - - testUsingContext( - 'macos build --no-codesign skips codesigning', - () async { - final BuildCommand command = BuildCommand( - androidSdk: FakeAndroidSdk(), - buildSystem: TestBuildSystem.all(BuildResult(success: true)), - logger: logger, - fileSystem: fileSystem, - osUtils: FakeOperatingSystemUtils(hostPlatform: HostPlatform.darwin_arm64), - ); - fakeProcessManager.addCommands([ - const FakeCommand( - command: [ - '/usr/bin/env', - 'xcrun', - 'xcodebuild', - '-workspace', - '/macos/Runner.xcworkspace', - '-configuration', - 'Release', - '-scheme', - 'Runner', - '-derivedDataPath', - '/build/macos', - '-destination', - 'generic/platform=macOS', - 'OBJROOT=/build/macos/Build/Intermediates.noindex', - 'SYMROOT=/build/macos/Build/Products', - '-quiet', - 'COMPILER_INDEX_STORE_ENABLE=NO', - 'CODE_SIGNING_ALLOWED=NO', - 'CODE_SIGNING_REQUIRED=NO', - 'CODE_SIGNING_IDENTITY=""', - ], - ), - ]); - createMinimalMockProjectFiles(); - - await createTestCommandRunner( - command, - ).run(const ['build', 'macos', '--no-pub', '--no-codesign']); - expect(fakeProcessManager, hasNoRemainingExpectations); - expect(logger.statusText, contains('Warning: Building with codesigning disabled.')); - }, - overrides: { - FileSystem: () => fileSystem, - Logger: () => logger, - ProcessManager: () => fakeProcessManager, - Pub: ThrowingPub.new, - Platform: () => macosPlatform, - OperatingSystemUtils: () => FakeOperatingSystemUtils(hostPlatform: HostPlatform.darwin_arm64), - }, - ); }