| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """ | 5 """ |
| 6 GN-related configuration functions, e.g., to produce a Config object from a GN | 6 GN-related configuration functions, e.g., to produce a Config object from a GN |
| 7 args.gn file). | 7 args.gn file). |
| 8 """ | 8 """ |
| 9 | 9 |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 """ | 47 """ |
| 48 Return the arguments for gn for the given configuration. This function returns | 48 Return the arguments for gn for the given configuration. This function returns |
| 49 a dictionary with boolean values as boolean. | 49 a dictionary with boolean values as boolean. |
| 50 """ | 50 """ |
| 51 gn_args = {} | 51 gn_args = {} |
| 52 | 52 |
| 53 gn_args["is_debug"] = bool(config.is_debug) | 53 gn_args["is_debug"] = bool(config.is_debug) |
| 54 gn_args["is_official_build"] = bool(config.is_official_build) | 54 gn_args["is_official_build"] = bool(config.is_official_build) |
| 55 gn_args["is_asan"] = config.sanitizer == Config.SANITIZER_ASAN | 55 gn_args["is_asan"] = config.sanitizer == Config.SANITIZER_ASAN |
| 56 | 56 |
| 57 if config.target_os != Config.OS_ANDROID: | |
| 58 gn_args["ffmpeg_branding"] = "ChromeOS" | |
| 59 | |
| 60 if config.is_clang is not None: | 57 if config.is_clang is not None: |
| 61 gn_args["is_clang"] = bool(config.is_clang) | 58 gn_args["is_clang"] = bool(config.is_clang) |
| 62 else: | 59 else: |
| 63 gn_args["is_clang"] = config.target_os not in (Config.OS_ANDROID, | 60 gn_args["is_clang"] = config.target_os not in (Config.OS_ANDROID, |
| 64 Config.OS_FNL, | 61 Config.OS_FNL, |
| 65 Config.OS_WINDOWS) | 62 Config.OS_WINDOWS) |
| 66 | 63 |
| 67 if config.values.get("use_goma"): | 64 if config.values.get("use_goma"): |
| 68 gn_args["use_goma"] = True | 65 gn_args["use_goma"] = True |
| 69 gn_args["goma_dir"] = config.values["goma_dir"] | 66 gn_args["goma_dir"] = config.values["goma_dir"] |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 values = {} | 156 values = {} |
| 160 with open(gn_file, "r") as f: | 157 with open(gn_file, "r") as f: |
| 161 for line in f.readlines(): | 158 for line in f.readlines(): |
| 162 line = re.sub("\s*#.*", "", line) | 159 line = re.sub("\s*#.*", "", line) |
| 163 result = re.match("^\s*(\w+)\s*=\s*(.*)\s*$", line) | 160 result = re.match("^\s*(\w+)\s*=\s*(.*)\s*$", line) |
| 164 if result: | 161 if result: |
| 165 key = result.group(1) | 162 key = result.group(1) |
| 166 value = result.group(2) | 163 value = result.group(2) |
| 167 values[key] = ast.literal_eval(TRANSLATIONS.get(value, value)) | 164 values[key] = ast.literal_eval(TRANSLATIONS.get(value, value)) |
| 168 return values | 165 return values |
| OLD | NEW |