We welcome contributions! This page covers setting up your machine to develop Bazel and, when you've made a patch, how to submit it.
In general, we prefer contributions that fix bugs or add features (as opposed to stylistic, refactoring, or "cleanup" changes). Please check with us on the dev list before investing a lot of time in a patch.
$ git push https://bazel.googlesource.com/bazel HEAD:refs/for/masterGerrit upload requires that you:
For now we have support for IntelliJ, and partial support for the Eclipse IDE for Java. We don't have IDE support for other languages in Bazel right now.
To work with IntelliJ, follow the instructions at ij.bazel.build.
To work with Eclipse:
Import Bazel Workspace).
src > main > javaand
src > test > javaas directories and add
To test out bazel, you need to compile it. To compile a development version of Bazel, you need a working version of Bazel already, e.g., the latest release version compiled from source.
bazel build //src:bazel builds the Bazel binary using
bazel from your PATH
and the resulting binary can be found at
bazel-bin/src/bazel. This is the
recommended way of rebuilding Bazel once you have bootstrapped it.
In addition to the Bazel binary, you might want to build the various tools Bazel
uses. They are located in
//src/tools/... and their directories contain README files describing their
When modifying Bazel, you want to make sure that the following still works:
bazel build //:bazel-distfile. After unzipping it in a new empty directory, run
bash compile.sh allthere. It rebuilds Bazel with
./compile.sh, Bazel with the
compile.shBazel and Bazel with the Bazel-built binary. It compares if the constructed Bazel builts are identical and then runs all bazel tests with
bazel test //src/... //third_party/ijar/.... This is what we use at Google to ensure that we don't break Bazel when pushing new commits, too.
Start creating a debug configuration for both C++ and Java in your
with the following:
build:debug -c dbg build:debug --javacopt="-g" build:debug --copt="-g" build:debug --strip="never"
Then you can rebuild Bazel with
bazel build --config debug //src:bazel and use
your favorite debugger to start debugging.
For debugging the C++ client you can just run it from gdb or lldb as you normally would. But if you want to debug the Java code, you must attach to the server using the following:
--host_jvm_debugbefore the command (e.g.,
bazel --batch --host_jvm_debug build //src:bazel).
jdbfor instance, run
jdb -attach localhost:5005. From within Eclipse, use the remote Java application launch configuration.
Bazel is organized in several parts:
src/main/cppprovides the command-line interface.
tools/build_rules. If you want to add rules, consider using Skylark first.
com.google.devtools.build.lib.bazel.rules. You might want to read about the Challenges of Writing Rules first.