You should first read the Bazel governance plan. Then you can read this page that explains how to set-up and work on the Bazel code and how to submit a patch to Bazel.
For now we only have partial support for the Eclipse IDE for Java. We don't have IDE support for others languages in Bazel right now.
To work with Eclipse, run from the root of the source tree sh scripts/setup-eclipse.sh
and it will create the .project
and the .classpath
files (if a .project
file is present, only the .classpath
will get overwritten). You can then import the project in Eclipse.
You might see some errors in Eclipse concerning Truth assertions
To test out bazel, you need to compile it. There is currently two ways of compiling it:
sh compile.sh
build a Bazel binary without Bazel, it should only be used to bootstrap Bazel itself. The resulting binary can be found at output/bazel
.bazel build //src:bazel
builds the Bazel binary using Bazel and the resulting binary can be found at bazel-bin/src/bazel
.In addition to the Bazel binary, you might want to build the various tools Bazel uses:
//src/java_tools/buildjar:JavaBuilder_deploy.jar
.*_deploy.jar
files), it can be found at //src/java_tools/singlejar:SingleJar_deploy.jar
.//third_party/ijar
.tools/objc/
by compile.sh
.tools/objc/
by compile.sh
.tools/objc/
by compile.sh
.tools/objc/
by compile.sh
.tools/objc/
by compile.sh
.tools/objc/
by compile.sh
.//third_party/iossim
When modifying Bazel, you want to make sure that the following still works:
sh bootstrap_test.sh all
after having removed the output
directory: it rebuilds Bazel with ./compile.sh
, Bazel with the compile.sh
Bazel and Bazel with the Bazel-built binary. It compares if the constructed Bazel builts are identical and then run all bazel tests with bazel test //src/...
.bazel test //third_party/ijar/test/...
base_workspace
directory. bazel test --nobuild_tests_only //...
in that directory should build and test everything (you might need to set-up extra tools following the instructions in the README files for each example).Bazel has support for debugging its Java code:
misc = ["-g"]
attributes to the toolchain
rule of the tools/jdk/BUILD
file or by using the --javacopt="-g"
option on the Bazel command-line.--host_jvm_debug
before the command (e.g., bazel --batch --host_jvm_debug build //src:bazel
).jdb
for instance, just run jdb -attach localhost:5005
. From within Eclipse, use the remote Java application launch configuration.If you want to debug the C++ client, ensure that you have the -g
option activated for C++ build, rebuild Bazel and use your favorite C++ debugger.
Bazel is organized in several parts:
src/main/cpp
.src/main/protobuf
.src/main/java
and src/test/java
)src/main/native
.We do not currently accept pull requests on GitHub.
We will make changes to this process as necessary, and we're hoping to move closer to a fully open development model in the future (also see Is Bazel developed fully in the open?).