Source release 17.1.2
This commit is contained in:
84
build.py
84
build.py
@@ -12,6 +12,7 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import math
|
||||
import os
|
||||
import subprocess
|
||||
@@ -149,42 +150,59 @@ def RunNinja(output_path, options):
|
||||
|
||||
def RunXcode(output_path, options):
|
||||
"""Run Xcode as a build system."""
|
||||
if 'all' in options.target:
|
||||
scheme = 'All'
|
||||
elif len(options.target) == 1:
|
||||
scheme = options.target[0]
|
||||
# Xcode generates a separate project for each GYP file and requires telling
|
||||
# which project to use for a target. So we need to generate a mapping of
|
||||
# target name to the project that defined it.
|
||||
projects = (['cdm/cdm_unittests.xcodeproj'] +
|
||||
[val.replace('.gyp', '.xcodeproj') for val in options.extra_gyp])
|
||||
target_map = {}
|
||||
if 'all' in options.target or 'All' in options.target:
|
||||
target_map['All'] = os.path.join(output_path, projects[0])
|
||||
targets = ['All']
|
||||
else:
|
||||
raise ValueError('Can only specify one target on Xcode')
|
||||
targets = options.target
|
||||
for name in projects:
|
||||
# List every target in a project.
|
||||
project = os.path.join(output_path, name)
|
||||
cmd = ['xcodebuild', 'build', '-project', project, '-list', '-json']
|
||||
data = json.loads(subprocess.check_output(cmd).decode('utf8'))
|
||||
for scheme in data['project']['schemes'] + data['project']['targets']:
|
||||
# 'All' will appear in each project, but it is handled above.
|
||||
target_map[scheme] = project
|
||||
|
||||
cmd = [
|
||||
'xcodebuild', 'test' if options.xcode_test else 'build',
|
||||
'-project', os.path.join(output_path, 'cdm', 'cdm_unittests.xcodeproj'),
|
||||
'-scheme', scheme,
|
||||
'-configuration', options.build_config,
|
||||
'-derivedDataPath', os.path.join(output_path, 'DerivedData'),
|
||||
]
|
||||
if options.xcode_test:
|
||||
cmd += ['-only-testing:' + scheme]
|
||||
if options.ios_device_name:
|
||||
if options.ios:
|
||||
cmd += ['-destination', 'platform=iOS,name=' + options.ios_device_name]
|
||||
for scheme in targets:
|
||||
cmd = [
|
||||
'xcodebuild', 'test' if options.xcode_test else 'build',
|
||||
'-project', target_map[scheme],
|
||||
'-scheme', scheme,
|
||||
'-configuration', options.build_config,
|
||||
'-derivedDataPath', os.path.join(output_path, 'DerivedData'),
|
||||
]
|
||||
if options.xcode_test:
|
||||
cmd += ['-only-testing:' + scheme]
|
||||
if options.ios_device_name:
|
||||
if options.ios:
|
||||
cmd += ['-destination', 'platform=iOS,name=' + options.ios_device_name]
|
||||
else:
|
||||
cmd += [
|
||||
'-destination',
|
||||
'platform=iOS Simulator,name=' + options.ios_device_name,
|
||||
]
|
||||
elif options.ios:
|
||||
cmd += ['-destination', 'generic/platform=iOS']
|
||||
elif options.ios_sim:
|
||||
cmd += ['-destination', 'generic/platform=iOS Simulator']
|
||||
else:
|
||||
cmd += [
|
||||
'-destination',
|
||||
'platform=iOS Simulator,name=' + options.ios_device_name,
|
||||
]
|
||||
elif options.ios:
|
||||
cmd += ['-destination', 'generic/platform=iOS']
|
||||
elif options.ios_sim:
|
||||
cmd += ['-destination', 'generic/platform=iOS Simulator']
|
||||
else:
|
||||
cmd += ['-destination', 'platform=macOS,arch=x86_64']
|
||||
cmd += ['-destination', 'platform=macOS,arch=x86_64']
|
||||
|
||||
if options.jobs is not None:
|
||||
cmd += ['-jobs', str(options.jobs)]
|
||||
if not options.verbose:
|
||||
cmd += ['-quiet']
|
||||
return VerboseSubprocess(cmd)
|
||||
if options.jobs is not None:
|
||||
cmd += ['-jobs', str(options.jobs)]
|
||||
if not options.verbose:
|
||||
cmd += ['-quiet']
|
||||
ret = VerboseSubprocess(cmd)
|
||||
if ret != 0:
|
||||
return ret
|
||||
return 0
|
||||
|
||||
|
||||
# Map from generator name to generator invocation function.
|
||||
@@ -247,7 +265,7 @@ def ImportPlatform(platform, is_cobalt, skip_deps, gyp_args):
|
||||
for variable, value in target['export_variables'].items():
|
||||
existing_value = os.environ.get(variable)
|
||||
if not existing_value:
|
||||
if '/' in value or '\\' in value:
|
||||
if '"' not in value and ('/' in value or '\\' in value):
|
||||
# Use absolute paths since the output directory will be different. If
|
||||
# "value" is already absolute, os.path.join will only use that part.
|
||||
value = os.path.normpath(os.path.join(CDM_TOP_PATH, target_path,
|
||||
|
||||
Reference in New Issue
Block a user