Whats the advantage of using Bazel over CMake ? What does one do about package management ?
The biggest advantages of Bazel over something like CMake are:
1) It is very general, so you can easily express dependencies of this sort:
- concat three text files, then
- run them through a parser generator, then
- use the generated parser in a C library, then
- use that C library in a Go server library and a Rust client library, then
- package the Go server into a Docker container and build an iOS binary that uses the Rust client
This is a cross-language dependency chain that also runs a few Unix tools. In this example, if you edit the Rust client, only the Rust library and the iOS client will be rebuilt. If you edit one of the text files that compose the grammar, everything will get rebuilt.
The dependencies are also a DAG, so if your projects have a shared Go library and you change that, the Go server would get rebuilt, as would the Docker container.
While all this might seem distressingly general, it removes the need for things like "bootstrap.sh" files, "build.rs" files, and all of the unstated dependencies they entail.
2) If you download all of the toolchains (C++, Java, Rust, Go, etc), it's impossible to have "works on my machine" problems. Exceptions are use of "local_*" rules, and Apple binaries (you need machine-local SDKs).
3) This allows great caching. You can run the equivalent of ccache for all of this stuff, locally or shared on a LAN. RBE is even more advanced.