| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 return [_ToCommandLine(x, y) for x, y in gn_args.iteritems()] | 98 return [_ToCommandLine(x, y) for x, y in gn_args.iteritems()] |
| 99 | 99 |
| 100 | 100 |
| 101 def ConfigForGNArgs(args): | 101 def ConfigForGNArgs(args): |
| 102 """ | 102 """ |
| 103 Return the Config object for the given gn arguments. This function takes a | 103 Return the Config object for the given gn arguments. This function takes a |
| 104 dictionary with boolean values as boolean. | 104 dictionary with boolean values as boolean. |
| 105 """ | 105 """ |
| 106 config_args = {} | 106 config_args = {} |
| 107 config_args["is_debug"] = args.get("is_debug", True) | 107 config_args["is_debug"] = args.get("is_debug", True) |
| 108 config_args["is_official_build"] = args.get("is_official_build", True) | 108 config_args["is_official_build"] = args.get("is_official_build", False) |
| 109 config_args["sanitizer"] = ( | 109 config_args["sanitizer"] = ( |
| 110 Config.SANITIZER_ASAN if args.get("is_asan") else None) | 110 Config.SANITIZER_ASAN if args.get("is_asan") else None) |
| 111 config_args["is_clang"] = args.get("is_clang", False) | 111 config_args["is_clang"] = args.get("is_clang", False) |
| 112 config_args["use_goma"] = args.get("use_goma", False) | 112 config_args["use_goma"] = args.get("use_goma", False) |
| 113 if config_args["use_goma"]: | 113 if config_args["use_goma"]: |
| 114 config_args["goma_dir"] = args.get("goma_dir") | 114 config_args["goma_dir"] = args.get("goma_dir") |
| 115 config_args["use_nacl"] = args.get("mojo_use_nacl", False) | 115 config_args["use_nacl"] = args.get("mojo_use_nacl", False) |
| 116 config_args["mojo_use_go"] = args.get("mojo_use_go", False) | 116 config_args["mojo_use_go"] = args.get("mojo_use_go", False) |
| 117 if config_args["mojo_use_go"]: | 117 if config_args["mojo_use_go"]: |
| 118 config_args["go_build_tool"] = args.get("go_build_tool") | 118 config_args["go_build_tool"] = args.get("go_build_tool") |
| (...skipping 16 matching lines...) Expand all Loading... |
| 135 values = {} | 135 values = {} |
| 136 with open(gn_file, "r") as f: | 136 with open(gn_file, "r") as f: |
| 137 for line in f.readlines(): | 137 for line in f.readlines(): |
| 138 line = re.sub("\s*#.*", "", line) | 138 line = re.sub("\s*#.*", "", line) |
| 139 result = re.match("^\s*(\w+)\s*=\s*(.*)\s*$", line) | 139 result = re.match("^\s*(\w+)\s*=\s*(.*)\s*$", line) |
| 140 if result: | 140 if result: |
| 141 key = result.group(1) | 141 key = result.group(1) |
| 142 value = result.group(2) | 142 value = result.group(2) |
| 143 values[key] = ast.literal_eval(TRANSLATIONS.get(value, value)) | 143 values[key] = ast.literal_eval(TRANSLATIONS.get(value, value)) |
| 144 return values | 144 return values |
| OLD | NEW |