# This doc explains how to generate compile_commands.json for Zircon: # https://fuchsia.googlesource.com/fuchsia/+/master/docs/zircon/editors.md if os.path.exists(os.path.join(zircon_dir, 'compile_commands.json')): zircon_database = ycm_core.CompilationDatabase(zircon_dir) os.chdir(fuchsia_root) fuchsia_build = subprocess.check_output( [os.path.join(fuchsia_paths.FUCHSIA_ROOT, 'scripts/fx'), 'get-build-dir'] ).strip().decode('utf-8') fuchsia_clang = os.path.realpath(fuchsia_paths.CLANG_PATH) fuchsia_sysroot = os.path.join(fuchsia_paths.PREBUILT_PATH, 'third_party', 'sysroot', fuchsia_paths.get_os()) # Get the clang include paths. fuchsia_cpp_v1_includes = fuchsia_paths.recursive_search(fuchsia_clang, 'include/c++/v1') fuchsia_cpp_includes = glob.glob('%s/lib/clang/*/include' % fuchsia_clang)[0] ninja_path = os.path.join(fuchsia_root, 'buildtools', 'ninja') # Get the name of the zircon project from GN args. # Reading the args.gn is significantly faster than running `gn args` so we do # that. target_cpu = None args = open(os.path.join(fuchsia_build, 'args.gn')).read() match = re.search(r'target_cpu\s*=\s*"([^"]+)"', args) if match: target_cpu = match.groups()[0]
fuchsia_root = os.path.realpath(fuchsia_paths.FUCHSIA_ROOT) zircon_database = None zircon_dir = os.path.join(fuchsia_root, 'zircon') # This doc explains how to generate compile_commands.json for Zircon: # https://fuchsia.googlesource.com/fuchsia/+/master/docs/zircon/editors.md if os.path.exists(os.path.join(zircon_dir, 'compile_commands.json')): zircon_database = ycm_core.CompilationDatabase(zircon_dir) os.chdir(fuchsia_root) fuchsia_build = subprocess.check_output( [os.path.join(fuchsia_paths.FUCHSIA_ROOT, 'scripts/fx'), 'get-build-dir']).strip().decode('utf-8') fuchsia_clang = os.path.realpath(fuchsia_paths.CLANG_PATH) fuchsia_sysroot = os.path.join(fuchsia_paths.PREBUILT_PATH, 'third_party', 'sysroot', fuchsia_paths.get_os()) # Get the clang include paths. fuchsia_cpp_v1_includes = fuchsia_paths.recursive_search( fuchsia_clang, 'include/c++/v1') fuchsia_cpp_includes = glob.glob('%s/lib/clang/*/include' % fuchsia_clang)[0] ninja_path = os.path.realpath(fuchsia_paths.NINJA_PATH) # Get the name of the zircon project from GN args. # Reading the args.gn is significantly faster than running `gn args` so we do # that. target_cpu = None args = open(os.path.join(fuchsia_build, 'args.gn')).read() match = re.search(r'target_cpu\s*=\s*"([^"]+)"', args) if match: