Simplify landmines code a bit now that all branches of all platforms are on ninja
BUG=none Committed: https://crrev.com/7491d14275670fad399837445b6c1e76ff498a50 Review-Url: https://codereview.chromium.org/2071463002 Cr-Original-Commit-Position: refs/heads/master@{#408818} Cr-Original-Original-Commit-Position: refs/heads/master@{#408739} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 08e9878eadb7ce7477f5947190d4b4c29acf2f56
This commit is contained in:
Родитель
37cbdc7b9f
Коммит
0299b0e8f5
|
@ -13,7 +13,6 @@ import sys
|
|||
import landmine_utils
|
||||
|
||||
|
||||
builder = landmine_utils.builder
|
||||
distributor = landmine_utils.distributor
|
||||
gyp_defines = landmine_utils.gyp_defines
|
||||
gyp_msvs_version = landmine_utils.gyp_msvs_version
|
||||
|
@ -30,27 +29,26 @@ def print_landmines():
|
|||
# dependency problems, fix the dependency problems instead of adding a
|
||||
# landmine.
|
||||
|
||||
if (distributor() == 'goma' and platform() == 'win32' and
|
||||
builder() == 'ninja'):
|
||||
if distributor() == 'goma' and platform() == 'win32':
|
||||
print 'Need to clobber winja goma due to backend cwd cache fix.'
|
||||
if platform() == 'android':
|
||||
print 'Clobber: to handle new way of suppressing findbugs failures.'
|
||||
print 'Clobber to fix gyp not rename package name (crbug.com/457038)'
|
||||
if platform() == 'win' and builder() == 'ninja':
|
||||
if platform() == 'win':
|
||||
print 'Compile on cc_unittests fails due to symbols removed in r185063.'
|
||||
if platform() == 'linux' and builder() == 'ninja':
|
||||
if platform() == 'linux':
|
||||
print 'Builders switching from make to ninja will clobber on this.'
|
||||
if platform() == 'mac':
|
||||
print 'Switching from bundle to unbundled dylib (issue 14743002).'
|
||||
if platform() in ('win', 'mac'):
|
||||
print ('Improper dependency for create_nmf.py broke in r240802, '
|
||||
'fixed in r240860.')
|
||||
if (platform() == 'win' and builder() == 'ninja' and
|
||||
if (platform() == 'win' and
|
||||
gyp_msvs_version() == '2012' and
|
||||
gyp_defines().get('target_arch') == 'x64' and
|
||||
gyp_defines().get('dcheck_always_on') == '1'):
|
||||
print "Switched win x64 trybots from VS2010 to VS2012."
|
||||
if (platform() == 'win' and builder() == 'ninja' and
|
||||
if (platform() == 'win' and
|
||||
gyp_msvs_version().startswith('2013')):
|
||||
print "Switch to VS2013"
|
||||
if (platform() == 'win' and gyp_msvs_version().startswith('2015')):
|
||||
|
|
|
@ -47,27 +47,27 @@ def gyp_defines():
|
|||
return dict(arg.split('=', 1)
|
||||
for arg in shlex.split(os.environ.get('GYP_DEFINES', '')))
|
||||
|
||||
|
||||
@memoize()
|
||||
def gyp_generator_flags():
|
||||
"""Parses and returns GYP_GENERATOR_FLAGS env var as a dictionary."""
|
||||
return dict(arg.split('=', 1)
|
||||
for arg in shlex.split(os.environ.get('GYP_GENERATOR_FLAGS', '')))
|
||||
|
||||
|
||||
@memoize()
|
||||
def gyp_msvs_version():
|
||||
return os.environ.get('GYP_MSVS_VERSION', '')
|
||||
|
||||
|
||||
@memoize()
|
||||
def distributor():
|
||||
"""
|
||||
Returns a string which is the distributed build engine in use (if any).
|
||||
Possible values: 'goma', 'ib', ''
|
||||
Possible values: 'goma', None
|
||||
"""
|
||||
if 'goma' in gyp_defines():
|
||||
return 'goma'
|
||||
elif IsWindows():
|
||||
if 'CHROME_HEADLESS' in os.environ:
|
||||
return 'ib' # use (win and !goma and headless) as approximation of ib
|
||||
|
||||
|
||||
@memoize()
|
||||
|
@ -87,34 +87,3 @@ def platform():
|
|||
return 'linux'
|
||||
else:
|
||||
return 'mac'
|
||||
|
||||
|
||||
@memoize()
|
||||
def builder():
|
||||
"""
|
||||
Returns a string representing the build engine (not compiler) to use.
|
||||
Possible values: 'make', 'ninja', 'xcode', 'msvs', 'scons'
|
||||
"""
|
||||
if 'GYP_GENERATORS' in os.environ:
|
||||
# for simplicity, only support the first explicit generator
|
||||
generator = os.environ['GYP_GENERATORS'].split(',')[0]
|
||||
if generator.endswith('-android'):
|
||||
return generator.split('-')[0]
|
||||
elif generator.endswith('-ninja'):
|
||||
return 'ninja'
|
||||
else:
|
||||
return generator
|
||||
else:
|
||||
if platform() == 'android':
|
||||
# Good enough for now? Do any android bots use make?
|
||||
return 'ninja'
|
||||
elif platform() == 'ios':
|
||||
return 'xcode'
|
||||
elif IsWindows():
|
||||
return 'ninja'
|
||||
elif IsLinux():
|
||||
return 'ninja'
|
||||
elif IsMac():
|
||||
return 'ninja'
|
||||
else:
|
||||
assert False, 'Don\'t know what builder we\'re using!'
|
||||
|
|
28
landmines.py
28
landmines.py
|
@ -27,35 +27,28 @@ import clobber
|
|||
import landmine_utils
|
||||
|
||||
|
||||
def get_build_dir(build_tool, src_dir, is_iphone=False):
|
||||
def get_build_dir(src_dir):
|
||||
"""
|
||||
Returns output directory absolute path dependent on build and targets.
|
||||
Examples:
|
||||
r'c:\b\build\slave\win\build\src\out'
|
||||
'/mnt/data/b/build/slave/linux/build/src/out'
|
||||
'/b/build/slave/ios_rel_device/build/src/xcodebuild'
|
||||
'/b/build/slave/ios_rel_device/build/src/out'
|
||||
|
||||
Keep this function in sync with tools/build/scripts/slave/compile.py
|
||||
"""
|
||||
ret = None
|
||||
if build_tool == 'xcode':
|
||||
ret = os.path.join(src_dir, 'xcodebuild')
|
||||
elif build_tool in ['make', 'ninja', 'ninja-ios']: # TODO: Remove ninja-ios.
|
||||
if 'CHROMIUM_OUT_DIR' in os.environ:
|
||||
output_dir = os.environ.get('CHROMIUM_OUT_DIR').strip()
|
||||
if not output_dir:
|
||||
raise Error('CHROMIUM_OUT_DIR environment variable is set but blank!')
|
||||
else:
|
||||
output_dir = landmine_utils.gyp_generator_flags().get('output_dir', 'out')
|
||||
ret = os.path.join(src_dir, output_dir)
|
||||
if 'CHROMIUM_OUT_DIR' in os.environ:
|
||||
output_dir = os.environ.get('CHROMIUM_OUT_DIR').strip()
|
||||
if not output_dir:
|
||||
raise Error('CHROMIUM_OUT_DIR environment variable is set but blank!')
|
||||
else:
|
||||
raise NotImplementedError('Unexpected GYP_GENERATORS (%s)' % build_tool)
|
||||
return os.path.abspath(ret)
|
||||
output_dir = landmine_utils.gyp_generator_flags().get('output_dir', 'out')
|
||||
return os.path.abspath(os.path.join(src_dir, output_dir))
|
||||
|
||||
|
||||
def clobber_if_necessary(new_landmines, src_dir):
|
||||
"""Does the work of setting, planting, and triggering landmines."""
|
||||
out_dir = get_build_dir(landmine_utils.builder(), src_dir)
|
||||
out_dir = get_build_dir(src_dir)
|
||||
landmines_path = os.path.normpath(os.path.join(src_dir, '.landmines'))
|
||||
try:
|
||||
os.makedirs(out_dir)
|
||||
|
@ -129,9 +122,6 @@ def process_options():
|
|||
def main():
|
||||
options = process_options()
|
||||
|
||||
if landmine_utils.builder() in ('dump_dependency_json', 'eclipse'):
|
||||
return 0
|
||||
|
||||
gyp_environment.SetEnvironment()
|
||||
|
||||
landmines = []
|
||||
|
|
Загрузка…
Ссылка в новой задаче