2015-08-12 00:01:19 +03:00
|
|
|
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
2013-05-28 20:02:13 +04:00
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
|
|
|
|
2016-09-22 01:27:23 +03:00
|
|
|
"""This script is now only used by the closure_compilation builders."""
|
2013-05-28 20:02:13 +04:00
|
|
|
|
2016-09-07 19:40:06 +03:00
|
|
|
import argparse
|
2015-08-12 00:01:19 +03:00
|
|
|
import glob
|
2016-09-07 19:40:06 +03:00
|
|
|
import gyp_environment
|
2013-05-28 20:02:13 +04:00
|
|
|
import os
|
2015-08-12 00:01:19 +03:00
|
|
|
import shlex
|
|
|
|
import sys
|
|
|
|
|
|
|
|
script_dir = os.path.dirname(os.path.realpath(__file__))
|
|
|
|
chrome_src = os.path.abspath(os.path.join(script_dir, os.pardir))
|
|
|
|
|
2016-09-07 19:40:06 +03:00
|
|
|
sys.path.insert(0, os.path.join(chrome_src, 'tools', 'gyp', 'pylib'))
|
|
|
|
import gyp
|
|
|
|
|
2015-08-12 00:01:19 +03:00
|
|
|
|
|
|
|
def ProcessGypDefinesItems(items):
|
|
|
|
"""Converts a list of strings to a list of key-value pairs."""
|
|
|
|
result = []
|
|
|
|
for item in items:
|
|
|
|
tokens = item.split('=', 1)
|
|
|
|
# Some GYP variables have hyphens, which we don't support.
|
|
|
|
if len(tokens) == 2:
|
|
|
|
result += [(tokens[0], tokens[1])]
|
|
|
|
else:
|
|
|
|
# No value supplied, treat it as a boolean and set it. Note that we
|
|
|
|
# use the string '1' here so we have a consistent definition whether
|
|
|
|
# you do 'foo=1' or 'foo'.
|
|
|
|
result += [(tokens[0], '1')]
|
|
|
|
return result
|
|
|
|
|
|
|
|
|
2016-09-22 01:27:23 +03:00
|
|
|
def GetSupplementalFiles():
|
|
|
|
return []
|
2015-08-12 00:01:19 +03:00
|
|
|
|
|
|
|
|
2016-09-22 01:27:23 +03:00
|
|
|
def GetGypVars(_):
|
|
|
|
"""Returns a dictionary of all GYP vars."""
|
2015-08-12 00:01:19 +03:00
|
|
|
# GYP defines from the environment.
|
|
|
|
env_items = ProcessGypDefinesItems(
|
|
|
|
shlex.split(os.environ.get('GYP_DEFINES', '')))
|
|
|
|
|
2016-09-07 19:40:06 +03:00
|
|
|
# GYP defines from the command line.
|
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
parser.add_argument('-D', dest='defines', action='append', default=[])
|
|
|
|
cmdline_input_items = parser.parse_known_args()[0].defines
|
|
|
|
cmdline_items = ProcessGypDefinesItems(cmdline_input_items)
|
|
|
|
|
2016-09-22 01:27:23 +03:00
|
|
|
return dict(env_items + cmdline_items)
|
2015-08-12 00:01:19 +03:00
|
|
|
|
|
|
|
|
|
|
|
def main():
|
2016-09-07 19:40:06 +03:00
|
|
|
gyp_environment.SetEnvironment()
|
|
|
|
|
2016-09-22 01:27:23 +03:00
|
|
|
print 'Updating projects from gyp files...'
|
|
|
|
sys.stdout.flush()
|
|
|
|
sys.exit(gyp.main(sys.argv[1:] + [
|
|
|
|
'--check',
|
|
|
|
'--no-circular-check',
|
|
|
|
'-I', os.path.join(script_dir, 'common.gypi'),
|
|
|
|
'-D', 'gyp_output_dir=out']))
|
2013-05-28 20:02:13 +04:00
|
|
|
|
2015-08-12 00:01:19 +03:00
|
|
|
if __name__ == '__main__':
|
|
|
|
sys.exit(main())
|