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 else: | 67 else: |
68 gn_args["use_goma"] = False | 68 gn_args["use_goma"] = False |
69 | 69 |
70 gn_args["dcheck_always_on"] = config.dcheck_always_on | 70 gn_args["dcheck_always_on"] = config.dcheck_always_on |
71 | 71 |
72 if config.target_os == Config.OS_ANDROID: | 72 if config.target_os == Config.OS_ANDROID: |
73 gn_args["target_os"] = "android" | 73 gn_args["target_os"] = "android" |
74 elif config.target_os == Config.OS_FNL: | 74 elif config.target_os == Config.OS_FNL: |
75 gn_args["target_os"] = "fnl" | 75 gn_args["target_os"] = "fnl" |
76 gn_args["use_aura"] = False | 76 gn_args["use_aura"] = False |
77 gn_args["use_glib"] = False | |
78 gn_args["use_ozone"] = True | 77 gn_args["use_ozone"] = True |
79 gn_args["target_sysroot"] = config.values.get("target_sysroot", "") | 78 gn_args["target_sysroot"] = config.values.get("target_sysroot", "") |
80 gn_args["toolchain_prefix"] = config.values.get("toolchain_prefix", "") | 79 gn_args["toolchain_prefix"] = config.values.get("toolchain_prefix", "") |
81 elif config.target_os == Config.OS_IOS: | 80 elif config.target_os == Config.OS_IOS: |
82 gn_args["target_os"] = "ios" | 81 gn_args["target_os"] = "ios" |
83 gn_args["ios_deployment_target"] = "7.0" | 82 gn_args["ios_deployment_target"] = "7.0" |
84 gn_args["clang_use_chrome_plugins"] = False | 83 gn_args["clang_use_chrome_plugins"] = False |
85 if config.is_simulator: | 84 if config.is_simulator: |
86 gn_args["use_libjpeg_turbo"] = False | 85 gn_args["use_libjpeg_turbo"] = False |
87 gn_args["use_ios_simulator"] = config.is_simulator | 86 gn_args["use_ios_simulator"] = config.is_simulator |
88 elif config.target_os == Config.OS_LINUX: | 87 elif config.target_os == Config.OS_LINUX: |
89 gn_args["use_aura"] = False | 88 gn_args["use_aura"] = False |
90 gn_args["use_glib"] = False | |
91 | 89 |
92 gn_args["target_cpu"] = config.target_cpu | 90 gn_args["target_cpu"] = config.target_cpu |
93 | 91 |
94 if "use_nacl" in config.values: | 92 if "use_nacl" in config.values: |
95 gn_args["mojo_use_nacl"] = config.values.get("use_nacl", False) | 93 gn_args["mojo_use_nacl"] = config.values.get("use_nacl", False) |
96 | 94 |
97 if "mojo_use_go" in config.values: | 95 if "mojo_use_go" in config.values: |
98 gn_args["mojo_use_go"] = config.values.get("mojo_use_go", False) | 96 gn_args["mojo_use_go"] = config.values.get("mojo_use_go", False) |
99 if gn_args["mojo_use_go"]: | 97 if gn_args["mojo_use_go"]: |
100 gn_args["go_build_tool"] = config.values.get("go_build_tool") | 98 gn_args["go_build_tool"] = config.values.get("go_build_tool") |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 values = {} | 159 values = {} |
162 with open(gn_file, "r") as f: | 160 with open(gn_file, "r") as f: |
163 for line in f.readlines(): | 161 for line in f.readlines(): |
164 line = re.sub("\s*#.*", "", line) | 162 line = re.sub("\s*#.*", "", line) |
165 result = re.match("^\s*(\w+)\s*=\s*(.*)\s*$", line) | 163 result = re.match("^\s*(\w+)\s*=\s*(.*)\s*$", line) |
166 if result: | 164 if result: |
167 key = result.group(1) | 165 key = result.group(1) |
168 value = result.group(2) | 166 value = result.group(2) |
169 values[key] = ast.literal_eval(TRANSLATIONS.get(value, value)) | 167 values[key] = ast.literal_eval(TRANSLATIONS.get(value, value)) |
170 return values | 168 return values |
OLD | NEW |