Reverts "[flutter_tools] Add --no-codesign support for macOS build (#169034)" (#172878)

<!-- start_original_pr_link -->
Reverts: flutter/flutter#169034
<!-- end_original_pr_link -->
<!-- start_initiating_author -->
Initiated by: vashworth
<!-- end_initiating_author -->
<!-- start_revert_reason -->
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
<!-- end_revert_reason -->
<!-- start_original_pr_author -->
Original PR Author: knopp
<!-- end_original_pr_author -->

<!-- start_reviewers -->
Reviewed By: {bkonyi, vashworth}
<!-- end_reviewers -->

<!-- start_revert_body -->
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].

<!-- Links -->
[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

<!-- end_revert_body -->

Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com>
This commit is contained in:
auto-submit[bot] 2025-07-28 20:07:47 +00:00 committed by GitHub
parent 3ac59c9859
commit 4d060aeb34
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 0 additions and 67 deletions

View File

@ -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<FlutterCommandResult> 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();
}

View File

@ -72,7 +72,6 @@ Future<void> 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<void> buildMacOS({
if (disabledSandboxEntitlementFile != null)
'CODE_SIGN_ENTITLEMENTS=${disabledSandboxEntitlementFile.path}',
...environmentVariablesAsXcodeBuildSettings(globals.platform),
if (!codesign) ...<String>[
'CODE_SIGNING_ALLOWED=NO',
'CODE_SIGNING_REQUIRED=NO',
'CODE_SIGNING_IDENTITY=""',
],
],
trace: true,
stdoutErrorMatcher: verboseLogging ? null : _filteredOutput,

View File

@ -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(<FakeCommand>[
const FakeCommand(
command: <String>[
'/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 <String>['build', 'macos', '--no-pub', '--no-codesign']);
expect(fakeProcessManager, hasNoRemainingExpectations);
expect(logger.statusText, contains('Warning: Building with codesigning disabled.'));
},
overrides: <Type, Generator>{
FileSystem: () => fileSystem,
Logger: () => logger,
ProcessManager: () => fakeProcessManager,
Pub: ThrowingPub.new,
Platform: () => macosPlatform,
OperatingSystemUtils: () => FakeOperatingSystemUtils(hostPlatform: HostPlatform.darwin_arm64),
},
);
}