25a757da3e
Also apply code signing like we do for C++ binaries. Cq-Include-Trybots: luci.dart.try:dart-sdk-mac-try,dart-sdk-mac-arm64-try Change-Id: If2a379c0cde556ad3198cafc5b53a386bd265197 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/504721 Reviewed-by: Alexander Markov <alexmarkov@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
53 lines
1.7 KiB
Python
53 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
#
|
|
# Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file
|
|
# for details. All rights reserved. Use of this source code is governed by a
|
|
# BSD-style license that can be found in the LICENSE file.
|
|
#
|
|
# Copies a binary and signs with using the specified signing identity.
|
|
|
|
import optparse
|
|
import subprocess
|
|
|
|
parser = optparse.OptionParser()
|
|
parser.add_option("--identity", type="string", help="Code signing identity")
|
|
parser.add_option("--input", type="string")
|
|
parser.add_option("--output", type="string")
|
|
options = parser.parse_args()[0]
|
|
|
|
if not options.identity:
|
|
raise Exception("Missing code signing identity (--identity)")
|
|
|
|
if not options.input:
|
|
raise Exception("Missing binaries to sign (--input)")
|
|
|
|
if not options.output:
|
|
raise Exception("Missing binaries to sign (--input)")
|
|
|
|
# Not cp. Compare tool("copy") in mac_toolchain.gni.
|
|
cmd = ["ln", "-f", options.input, options.output]
|
|
result = subprocess.run(cmd, capture_output=True, encoding="utf8")
|
|
if result.returncode != 0:
|
|
print("failed to run: " + " ".join(cmd))
|
|
print(f"exit code: {result.returncode}")
|
|
print("stdout:")
|
|
print(result.stdout)
|
|
print("stdout:")
|
|
print(result.stderr)
|
|
raise Exception("failed to copy")
|
|
|
|
codesign_args = [
|
|
"--deep", "--force", "--verify", "--verbose", "--timestamp", "--options",
|
|
"runtime", "--sign", options.identity
|
|
]
|
|
cmd = ["codesign"] + codesign_args + [options.output]
|
|
result = subprocess.run(cmd, capture_output=True, encoding="utf8")
|
|
if result.returncode != 0:
|
|
print("failed to run: " + " ".join(cmd))
|
|
print(f"exit code: {result.returncode}")
|
|
print("stdout:")
|
|
print(result.stdout)
|
|
print("stdout:")
|
|
print(result.stderr)
|
|
raise Exception("failed to codesign")
|