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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 subp.add_argument('-m', '--master', | 77 subp.add_argument('-m', '--master', |
78 help='master name to look up config from') | 78 help='master name to look up config from') |
79 subp.add_argument('-c', '--config', | 79 subp.add_argument('-c', '--config', |
80 help='configuration to analyze') | 80 help='configuration to analyze') |
81 subp.add_argument('-f', '--config-file', metavar='PATH', | 81 subp.add_argument('-f', '--config-file', metavar='PATH', |
82 default=self.default_config, | 82 default=self.default_config, |
83 help='path to config file ' | 83 help='path to config file ' |
84 '(default is //tools/mb/mb_config.pyl)') | 84 '(default is //tools/mb/mb_config.pyl)') |
85 subp.add_argument('-g', '--goma-dir', | 85 subp.add_argument('-g', '--goma-dir', |
86 help='path to goma directory') | 86 help='path to goma directory') |
| 87 subp.add_argument('--gyp-script', metavar='PATH', |
| 88 default=self.PathJoin('build', 'gyp_chromium'), |
| 89 help='path to gyp script relative to project root ' |
| 90 '(default is %(default)s)') |
87 subp.add_argument('--android-version-code', | 91 subp.add_argument('--android-version-code', |
88 help='Sets GN arg android_default_version_code and ' | 92 help='Sets GN arg android_default_version_code and ' |
89 'GYP_DEFINE app_manifest_version_code') | 93 'GYP_DEFINE app_manifest_version_code') |
90 subp.add_argument('--android-version-name', | 94 subp.add_argument('--android-version-name', |
91 help='Sets GN arg android_default_version_name and ' | 95 help='Sets GN arg android_default_version_name and ' |
92 'GYP_DEFINE app_manifest_version_name') | 96 'GYP_DEFINE app_manifest_version_name') |
93 subp.add_argument('-n', '--dryrun', action='store_true', | 97 subp.add_argument('-n', '--dryrun', action='store_true', |
94 help='Do a dry run (i.e., do nothing, just print ' | 98 help='Do a dry run (i.e., do nothing, just print ' |
95 'the commands that will run)') | 99 'the commands that will run)') |
96 subp.add_argument('-v', '--verbose', action='store_true', | 100 subp.add_argument('-v', '--verbose', action='store_true', |
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 android_version_code = self.args.android_version_code | 1102 android_version_code = self.args.android_version_code |
1099 if android_version_code: | 1103 if android_version_code: |
1100 gyp_defines += ' app_manifest_version_code=%s' % android_version_code | 1104 gyp_defines += ' app_manifest_version_code=%s' % android_version_code |
1101 | 1105 |
1102 android_version_name = self.args.android_version_name | 1106 android_version_name = self.args.android_version_name |
1103 if android_version_name: | 1107 if android_version_name: |
1104 gyp_defines += ' app_manifest_version_name=%s' % android_version_name | 1108 gyp_defines += ' app_manifest_version_name=%s' % android_version_name |
1105 | 1109 |
1106 cmd = [ | 1110 cmd = [ |
1107 self.executable, | 1111 self.executable, |
1108 self.PathJoin('build', 'gyp_chromium'), | 1112 self.args.gyp_script, |
1109 '-G', | 1113 '-G', |
1110 'output_dir=' + output_dir, | 1114 'output_dir=' + output_dir, |
1111 ] | 1115 ] |
1112 | 1116 |
1113 # Ensure that we have an environment that only contains | 1117 # Ensure that we have an environment that only contains |
1114 # the exact values of the GYP variables we need. | 1118 # the exact values of the GYP variables we need. |
1115 env = os.environ.copy() | 1119 env = os.environ.copy() |
1116 | 1120 |
1117 # This is a terrible hack to work around the fact that | 1121 # This is a terrible hack to work around the fact that |
1118 # //tools/clang/scripts/update.py is invoked by GYP and GN but | 1122 # //tools/clang/scripts/update.py is invoked by GYP and GN but |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1466 # Then check to see if the arg contains any metacharacters other than | 1470 # Then check to see if the arg contains any metacharacters other than |
1467 # double quotes; if it does, quote everything (including the double | 1471 # double quotes; if it does, quote everything (including the double |
1468 # quotes) for safety. | 1472 # quotes) for safety. |
1469 if any(a in UNSAFE_FOR_CMD for a in arg): | 1473 if any(a in UNSAFE_FOR_CMD for a in arg): |
1470 arg = ''.join('^' + a if a in ALL_META_CHARS else a for a in arg) | 1474 arg = ''.join('^' + a if a in ALL_META_CHARS else a for a in arg) |
1471 return arg | 1475 return arg |
1472 | 1476 |
1473 | 1477 |
1474 if __name__ == '__main__': | 1478 if __name__ == '__main__': |
1475 sys.exit(main(sys.argv[1:])) | 1479 sys.exit(main(sys.argv[1:])) |
OLD | NEW |