Use explicit paths when using hermetic toolchain.

Previously, both the invocation to mig and mig's internal code would use xcrun
to locate binaries. When we're using the hermetic toolchain, we want to
explicitly specify the binaries to use and we want to avoid calls to xcrun.

Bug: chromium:971452
Change-Id: I8527368e0846bc72789e6454fcd626b028d297ff
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1650147
Commit-Queue: Erik Chen <erikchen@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
Erik Chen 2019-06-07 11:37:56 -07:00 committed by Commit Bot
parent 4920d248fe
commit e0e83ad18a
3 changed files with 29 additions and 10 deletions

View File

@ -47,9 +47,19 @@ if (crashpad_is_mac) {
args += rebase_path(outputs, root_build_dir)
if (crashpad_is_in_chromium) {
if (!use_system_xcode) {
import("//build/config/clang/clang.gni")
import("//build/config/mac/mac_sdk.gni")
clang_path = rebase_path("$clang_base_path/bin/", root_build_dir) + "clang"
mig_path = "$mac_bin_path" + "mig"
migcom_path = "$mac_bin_path" + "../libexec/migcom"
args += [
"--developer-dir",
hermetic_xcode_path,
"--clang-path",
clang_path,
"--mig-path",
mig_path,
"--migcom-path",
migcom_path,
]
}
}

View File

@ -26,7 +26,8 @@ def main(args):
interface = mig_gen.MigInterface(parsed.user_c, parsed.server_c,
parsed.user_h, parsed.server_h)
mig_gen.generate_interface(parsed.defs, interface, parsed.include,
parsed.developer_dir, parsed.sdk)
parsed.sdk, parsed.clang_path, parsed.mig_path,
parsed.migcom_path)
mig_fix.fix_interface(interface)
if __name__ == '__main__':

View File

@ -24,16 +24,21 @@ import sys
MigInterface = collections.namedtuple('MigInterface', ['user_c', 'server_c',
'user_h', 'server_h'])
def generate_interface(defs, interface, includes=[],
developer_dir=None, sdk=None):
command = ['mig',
def generate_interface(defs, interface, includes=[], sdk=None, clang_path=None,
mig_path=None, migcom_path=None):
if mig_path is None:
mig_path = 'mig'
command = [mig_path,
'-user', interface.user_c,
'-server', interface.server_c,
'-header', interface.user_h,
'-sheader', interface.server_h,
]
if developer_dir is not None:
os.environ['DEVELOPER_DIR'] = developer_dir
if clang_path is not None:
os.environ['MIGCC'] = clang_path
if migcom_path is not None:
os.environ['MIGCOM'] = migcom_path
if sdk is not None:
command.extend(['-isysroot', sdk])
for include in includes:
@ -43,7 +48,9 @@ def generate_interface(defs, interface, includes=[],
def parse_args(args):
parser = argparse.ArgumentParser()
parser.add_argument('--developer-dir', help='Path to Xcode')
parser.add_argument('--clang-path', help='Path to Clang')
parser.add_argument('--mig-path', help='Path to mig')
parser.add_argument('--migcom-path', help='Path to migcom')
parser.add_argument('--sdk', help='Path to SDK')
parser.add_argument('--include',
default=[],
@ -61,7 +68,8 @@ def main(args):
interface = MigInterface(parsed.user_c, parsed.server_c,
parsed.user_h, parsed.server_h)
generate_interface(parsed.defs, interface, parsed.include,
parsed.developer_dir, parsed.sdk)
parsed.sdk, parsed.clang_path, parsed.mig_path,
parsed.migcom_path)
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))