[pkg/dart2native] Force re-signing for standalone executables.

Since the official Dart SDK releases are fully signed, attempting
to re-sign them will fail unless forced.

TEST=Manually.

Bug: https://github.com/dart-lang/sdk/issues/39106
Change-Id: I0cf74fa7fc74a3cc52967abc4bb0dc2d656765d9
Cq-Include-Trybots: luci.dart.try:pkg-mac-release-arm64-try,pkg-mac-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238343
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
This commit is contained in:
Tess Strickland 2022-03-23 13:11:32 +00:00 committed by Commit Bot
parent 988b8093e4
commit b8da7096e7

View file

@ -316,8 +316,11 @@ Future writeAppendedMachOExecutable(
// similar to the linker (the linker-signed option flag) to ensure that any
// LC_CODE_SIGNATURE block has the correct CD hashes. This is necessary for
// platforms where signature verification is always on (e.g., OS X on M1).
//
// We use the `-f` flag to force signature overwriting as the official
// Dart binaries (including dartaotruntime) are fully signed.
final signingProcess = await Process.run(
'codesign', ['-o', 'linker-signed', '-s', '-', outputPath]);
'codesign', ['-f', '-o', 'linker-signed', '-s', '-', outputPath]);
if (signingProcess.exitCode != 0) {
print('Subcommand terminated with exit code ${signingProcess.exitCode}.');
if (signingProcess.stdout.isNotEmpty) {