1#!/usr/bin/env python3 2# Copyright 2023 The Chromium Authors 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6import os 7import sys 8 9 10def missing_cfg_error_message(): 11 """This assumes that corp machine has gcert binary in known location.""" 12 import shutil 13 if shutil.which("gcert") is not None: 14 return """ 15To build with gn arg 'use_remoteexec=true' as a googler on a corp machine 16set "download_remoteexec_cfg" in .gclient like 17 18solutions = [ 19 { 20 "name" : "src", 21 # ... 22 "custom_vars" : { 23 "download_remoteexec_cfg": True, 24 }, 25 }, 26] 27 28and re-run `gclient sync`. 29 30See http://go/chrome-linux-build#setup-remote-execution 31for more details.""" 32 elif sys.platform == 'linux': 33 return """ 34To build with gn arg 'use_remoteexec=true' as a googler on a non corp machine 35see http://go/chrome-linux-build#setup-remote-execution for setup instructions. 36 37To build with gn arg 'use_remoteexec=true' as a non-googler set the appropriate 38`reclient_cfg_dir` value in args.gn. 39See 40https://chromium.googlesource.com/chromium/src/+/main/docs/linux/build_instructions.md#use-reclient 41for more details.""" 42 else: 43 return """ 44To build with gn arg 'use_remoteexec=true' as a googler on a non corp machine 45see http://go/chrome-linux-build#setup-remote-execution for setup instructions. 46 47Building with gn arg 'use_remoteexec=true' as a non-googler is not currently 48supported on your os (%s). 49""" % sys.platform 50 51 52def main(): 53 if len(sys.argv) != 2: 54 print("This should have a path to reclient config file in its args.", 55 file=sys.stderr) 56 return 1 57 58 # Check path to reclient_cc_cfg_file. 59 if os.path.isfile(sys.argv[1]): 60 return 0 61 62 print("reclient config file '%s' doesn't exist" % 63 (os.path.abspath(sys.argv[1])), 64 file=sys.stderr) 65 print(missing_cfg_error_message(), file=sys.stderr) 66 67 return 1 68 69 70if __name__ == "__main__": 71 sys.exit(main()) 72