| 194 | # Note: this function is reused by update-compile-commands.py. When renaming |
| 195 | # this, please update that file too! |
| 196 | def detect_reclient(): |
| 197 | if not GCLIENT_FILE_PATH.exists(): |
| 198 | return Reclient.NONE |
| 199 | content = GCLIENT_FILE_PATH.read_text() |
| 200 | try: |
| 201 | config_dict = {} |
| 202 | exec(content, config_dict) |
| 203 | except SyntaxError as e: |
| 204 | print("# Can't detect reclient due to .gclient syntax errors.") |
| 205 | return Reclient.NONE |
| 206 | v8_solution = get_v8_solution(config_dict["solutions"]) |
| 207 | if not v8_solution: |
| 208 | print("# Can't detect reclient due to missing v8 gclient solution.") |
| 209 | return Reclient.NONE |
| 210 | custom_vars = v8_solution.get("custom_vars", {}) |
| 211 | if "rbe_instance" in custom_vars: |
| 212 | return Reclient.CUSTOM |
| 213 | if "download_remoteexec_cfg" in custom_vars: |
| 214 | return Reclient.GOOGLE |
| 215 | return Reclient.NONE |
| 216 | |
| 217 | |
| 218 | # Note: this function is reused by update-compile-commands.py. When renaming |