Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """MB - the Meta-Build wrapper around GYP and GN | 6 """MB - the Meta-Build wrapper around GYP and GN |
| 7 | 7 |
| 8 MB is a wrapper script for GYP and GN that can be used to generate build files | 8 MB is a wrapper script for GYP and GN that can be used to generate build files |
| 9 for sets of canned configurations and analyze them. | 9 for sets of canned configurations and analyze them. |
| 10 """ | 10 """ |
| (...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1072 cmd = [ | 1072 cmd = [ |
| 1073 self.executable, | 1073 self.executable, |
| 1074 self.PathJoin('build', 'gyp_chromium'), | 1074 self.PathJoin('build', 'gyp_chromium'), |
| 1075 '-G', | 1075 '-G', |
| 1076 'output_dir=' + output_dir, | 1076 'output_dir=' + output_dir, |
| 1077 ] | 1077 ] |
| 1078 | 1078 |
| 1079 # Ensure that we have an environment that only contains | 1079 # Ensure that we have an environment that only contains |
| 1080 # the exact values of the GYP variables we need. | 1080 # the exact values of the GYP variables we need. |
| 1081 env = os.environ.copy() | 1081 env = os.environ.copy() |
| 1082 | |
| 1083 # This is a terrible hack to work around the fact that | |
| 1084 # //tools/clang/scripts/update.py is invoked by GYP and GN but | |
| 1085 # currently relies on an environment variable to figure out | |
| 1086 # what revision to embed in the command line #defines. | |
| 1087 # For GN, we've made this work via a gn arg that will cause update.py | |
| 1088 # to get an additional command line arg, but getting that to work | |
| 1089 # via GYP_DEFINES has proven difficult, so we rewrite the GYP_DEFINES | |
| 1090 # to get rid of the arg and add the old var in, instead. | |
| 1091 # See crbug.com/582737 for more on this. This can hopefully all | |
| 1092 # go away with GYP. | |
| 1093 if 'llvm_force_head_revision=1' in gyp_defines: | |
| 1094 env['LLVM_FORCE_HEAD_REVISION'] = 1 | |
|
Dirk Pranke
2016/04/25 22:12:16
this should've been '1'.
| |
| 1095 gyp_defines = gyp_defines.replace('llvm_force_head_revision=1', '') | |
| 1096 | |
| 1082 env['GYP_GENERATORS'] = 'ninja' | 1097 env['GYP_GENERATORS'] = 'ninja' |
| 1083 if 'GYP_CHROMIUM_NO_ACTION' in env: | 1098 if 'GYP_CHROMIUM_NO_ACTION' in env: |
| 1084 del env['GYP_CHROMIUM_NO_ACTION'] | 1099 del env['GYP_CHROMIUM_NO_ACTION'] |
| 1085 if 'GYP_CROSSCOMPILE' in env: | 1100 if 'GYP_CROSSCOMPILE' in env: |
| 1086 del env['GYP_CROSSCOMPILE'] | 1101 del env['GYP_CROSSCOMPILE'] |
| 1087 env['GYP_DEFINES'] = gyp_defines | 1102 env['GYP_DEFINES'] = gyp_defines |
| 1088 if vals['gyp_crosscompile']: | 1103 if vals['gyp_crosscompile']: |
| 1089 env['GYP_CROSSCOMPILE'] = '1' | 1104 env['GYP_CROSSCOMPILE'] = '1' |
| 1090 return cmd, env | 1105 return cmd, env |
| 1091 | 1106 |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1417 # Then check to see if the arg contains any metacharacters other than | 1432 # Then check to see if the arg contains any metacharacters other than |
| 1418 # double quotes; if it does, quote everything (including the double | 1433 # double quotes; if it does, quote everything (including the double |
| 1419 # quotes) for safety. | 1434 # quotes) for safety. |
| 1420 if any(a in UNSAFE_FOR_CMD for a in arg): | 1435 if any(a in UNSAFE_FOR_CMD for a in arg): |
| 1421 arg = ''.join('^' + a if a in ALL_META_CHARS else a for a in arg) | 1436 arg = ''.join('^' + a if a in ALL_META_CHARS else a for a in arg) |
| 1422 return arg | 1437 return arg |
| 1423 | 1438 |
| 1424 | 1439 |
| 1425 if __name__ == '__main__': | 1440 if __name__ == '__main__': |
| 1426 sys.exit(main(sys.argv[1:])) | 1441 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |