![]() # directory where kythe release has been installed export KYTHE_RELEASE_DIR =/opt/kythe-v0.0.50 These instructions assume your environment is already set up to successfully However the same result could be achieved by invoking CMake manually, then using the generic runextractor compdb command. The runextractor tool has a convenience subcommand for cmake-based repositories that first invokes CMake to generate a compile_commands.json, then processes the listed compilation actions. An optional last step is to merge these into one kzip with /opt/kythe/tools/kzip merge -output $KYTHE_OUTPUT_DIRECTORY/ip $KYTHE_OUTPUT_DIRECTORY/*.kzip. If successful, the output directory should contain one kzip for each compilation action.Invoke runextractor: runextractor compdb -extractor /opt/kythe/extractors/cxx_extractor.Set environment variables - see above section.For ninja, the command is ninja -t compdb > compile_commands.json Begin by building your project with compile_commands.json enabled.This example uses Ninja, but the first step can be adapted for others. KYTHE_CORPUS: The corpus label for extracted files.Įxtracting from a compile_commands.json file.KYTHE_OUTPUT_DIRECTORY: The absolute path for storing output.This is generally the root of the repository. KYTHE_ROOT_DIRECTORY: The absolute path for file input to be extracted.Runextractor is configured via a set of environment variables: runextractor invokes an extractor for each compilation action listed in compile_commands.json and generates a kzip in the output directory for each.īuild systems capable of emitting a compile_commands.json include CMake, Ninja, gn, waf, and others. Runextractor is a generic extraction tool that works with any build system capable of emitting a compile_commands.json file. Tar -no-same-owner -xvzf /tmp/ -directory /optĮcho 'KYTHE_DIR=/opt/kythe-$KYTHE_VERSION' > $BASH_ENV # Build the repository with extraction enabledīazel -bazelrc = $KYTHE_DIR/extractors.bazelrc \īuild -override_repository kythe_release = $KYTHE_DIR \ # Download and unpack the latest Kythe release You can use the Kythe release to extract compilations from other Bazel based # Extract all Java/C++ compilations in Kytheīazel build -k \ -experimental_action_listener \ -experimental_action_listener \ -experimental_extra_action_top_level_only \įind -L bazel-out -name '*.kzip' Extracting other Bazel based repositories Extracting the Kythe repositoryĪdd the make Bazel extract Java compilations to do the This effectively allows Bazel toĮxtract each compilation as it is run during the build. That use Kythe’s Java and C++ extractors. Kythe uses Bazel to build itself and has implemented Bazel opt/kythe/extractors/cxx_extractor -x c++ kythe/cxx/common/scope_guard.h Extracting Compilations using Bazel # Extract a C++ compilation # /opt/kythe/extractors/cxx_extractor Kythe/java/com/google/devtools/kythe/platform/kzip/ *.java Java -Xbootclasspath/p:third_party/javac/javac *.jar \ -jar /opt/kythe/extractors/javac_extractor.jar \Ĭom.8Wrapper \ # Environment variables common to Kythe extractors export KYTHE_ROOT_DIRECTORY = " $PWD " # Root of source code corpus export KYTHE_OUTPUT_DIRECTORY = "/tmp/pilations/" # Output directory export KYTHE_VNAMES = " $PWD /kythe/data/vnames.json" # Optional: VNames configuration mkdir -p " $KYTHE_OUTPUT_DIRECTORY " # Extract a Java compilation # java -Xbootclasspath/p:third_party/javac/javac*.jar \ # .8Wrapper \ # Extracting Compilations # Generate Kythe protobuf sources This document assumes that the latest release archive from Extracting from a compile_commands.json file.Extracting other Bazel based repositories.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |