Skip to content

Repository files navigation

trunk

A collection of C++/Java opensource projects with BUILD files so they can be easily built with bazel.

To try:

$ git clone https://github.com/mzhaom/trunk && cd trunk
$ git submodule update --init third_party/abseil third_party/protobuf \
    third_party/grpc third_party/gtest/github third_party/glog/upstream \
    third_party/gflags/upstream third_party/gperftools/upstream \
    third_party/libunwind/upstream
$ bazel build //examples/...

Building with google/tcmalloc as the allocator additionally needs:

$ git submodule update --init third_party/tcmalloc third_party/re2
$ bazel build --config=tcmalloc //examples:hello

Note that --config=tcmalloc is incompatible with //examples/asan:leak, which links gperftools' heap checker and so brings its own allocator.

Building the folly stack additionally needs:

$ git submodule update --init third_party/folly/upstream \
    third_party/fizz/upstream third_party/wangle/upstream \
    third_party/proxygen/upstream
$ bazel build @proxygen//:proxygen

Currently C++ projects can be only built on Linux x64 system.

Prerequisites

  • Bazel — the version in .bazelversion is what the tree is built and tested with; use bazelisk or run ./install-bazel.sh, which reads that file.
  • A C++20 compiler (gcc >= 11 or clang; gcc 13 is what this is tested with). Pass --config=clang to build with a downloaded clang release instead of the system compiler.
  • python3-dev. protobuf builds its python runtime against the system python, so the interpreter headers have to be present: sudo apt-get install python3-dev.

How dependencies are wired up

Dependencies are materialized in the tree as git submodules under third_party/ rather than being downloaded as opaque archives. Bazel 9 dropped WORKSPACE, so this is expressed in MODULE.bazel with local_path_override: every module listed with an override resolves to the checked out submodule, never to an archive from the Bazel Central Registry. Only rule sets and the leaf dependencies of the vendored modules still come from the registry.

Projects that ship no Bazel build of their own (currently folly, fizz, wangle and proxygen) are pulled from a fork under github.com/bazelment whose bazel-<tag> branch carries the upstream release tag plus the Bazel overlay and patches. Those four are version locked to each other and have to be bumped as a set.

WORKSPACE.legacy is the pre-bzlmod setup, kept for reference while the remaining third_party projects are ported.

C++

Java

  • grpc-java gRPC in Java
  • guava Guava: Google Core Libraries for Java
  • netty Netty is a NIO client server framework which enables quick and easy development of network applications such as protocol servers and clients.

About

Make bazel an out of box solution for C++/Java developers

Topics

Resources

Stars

242 stars

Watchers

28 watching

Forks

Releases

Packages

Used by

Contributors

Languages