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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 gn_args["use_glib"] = False | 67 gn_args["use_glib"] = False |
68 gn_args["use_system_harfbuzz"] = False | 68 gn_args["use_system_harfbuzz"] = False |
69 elif config.target_os == Config.OS_LINUX: | 69 elif config.target_os == Config.OS_LINUX: |
70 gn_args["is_desktop_linux"] = False | 70 gn_args["is_desktop_linux"] = False |
71 gn_args["use_aura"] = False | 71 gn_args["use_aura"] = False |
72 gn_args["use_glib"] = False | 72 gn_args["use_glib"] = False |
73 gn_args["use_system_harfbuzz"] = False | 73 gn_args["use_system_harfbuzz"] = False |
74 | 74 |
75 gn_args["target_cpu"] = config.target_cpu | 75 gn_args["target_cpu"] = config.target_cpu |
76 | 76 |
| 77 extra_args = config.values.get("gn_args") |
| 78 if extra_args: |
| 79 for arg in extra_args.split(): |
| 80 (name, val) = arg.split('=') |
| 81 gn_args[name] = val |
| 82 |
77 return gn_args | 83 return gn_args |
78 | 84 |
79 | 85 |
80 def CommandLineForGNArgs(gn_args): | 86 def CommandLineForGNArgs(gn_args): |
81 """ | 87 """ |
82 Returns the list of gn arguments to use with the gn command line. | 88 Returns the list of gn arguments to use with the gn command line. |
83 """ | 89 """ |
84 def _ToCommandLine(key, value): | 90 def _ToCommandLine(key, value): |
85 if type(value) is bool: | 91 if type(value) is bool: |
86 return "%s=%s" % (key, "true" if value else "false") | 92 return "%s=%s" % (key, "true" if value else "false") |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 values = {} | 127 values = {} |
122 with open(gn_file, "r") as f: | 128 with open(gn_file, "r") as f: |
123 for line in f.readlines(): | 129 for line in f.readlines(): |
124 line = re.sub("\s*#.*", "", line) | 130 line = re.sub("\s*#.*", "", line) |
125 result = re.match("^\s*(\w+)\s*=\s*(.*)\s*$", line) | 131 result = re.match("^\s*(\w+)\s*=\s*(.*)\s*$", line) |
126 if result: | 132 if result: |
127 key = result.group(1) | 133 key = result.group(1) |
128 value = result.group(2) | 134 value = result.group(2) |
129 values[key] = ast.literal_eval(TRANSLATIONS.get(value, value)) | 135 values[key] = ast.literal_eval(TRANSLATIONS.get(value, value)) |
130 return values | 136 return values |
OLD | NEW |