For fairly large C++ codebases, RBE is really a competitive advantage. I've seen RBE cut down iteration time by an order of magnitude. I love CMake, and CMake can get you plenty of parallelism, but CMake doesn't really provide a tool for building several CMake sub-projects in parallel, and bazel handles this really well.
Sadly Bazel RBE is still primarily a Google Cloud product. Also, GCE is slow to work on supporting auto-scale, so you have to pay for unused workers. (Like most products in Google Cloud, Google is ripping you off with alpha-quality stuff). There's some very rough open source RBE stuff on Github that you can run yourself, but nothing really production-grade yet.
gg ( https://github.com/StanfordSNR/gg ) is a promising-looking alternative. It's research code, but it might be the community's best hope for a non-Google alternative (that e.g. supports AWS Lambda for parallelism). Bazel is great, but without independence (e.g. what Kubernetes achieved) it's difficult to see bazel as dependable as make or CMake long term.
It's a remote execution client, that you can use with your current cmake project, along with buildgrid: https://gitlab.com/BuildGrid/buildgrid which is a basically a FOSS RBE.
Along with workers: https://gitlab.com/BuildGrid/buildbox/buildbox-worker
With these FOSS alternatives, you can tailor/scale your builds yourself without relying on RBE.
All of these utilize the Remote Execution protocol, so you can plug and play with other clients/workers/servers that use the protocol.
[0]: https://nixos.wiki/wiki/Distributed_build
[1]: https://github.com/LnL7/nix-docker#running-as-a-remote-build...
Can you expand on what you mean here? GCE has had autoscaling for years and it's quite configurable, I don't see why you would need to keep unused workers around unless your build load is extremely spiky.
There's a lot of good stuff in Google Cloud, but be sure to get Google to pay you to wade through the construction with free credits.
Disclaimer: I work on the Bazel team at Google.
If you're talking about [1], it is billed in minutes. You can have 10 concurrent workers. Custom Workers is in alpha.
The most recent effort is called colcon, which you can find here: https://colcon.readthedocs.io/en/released/
In the past (for example with catkin_tools, colcon's predecessor), the biggest barrier to use with conventional CMake packages has always been that they don't export dependency information in an easily machine-consumable way, so any regular CMake package brought into the workspace needed to have a package.xml file patched into it.
Colcon still has the ability to bring in extra metadata for things like ensuring environment variables and so on are set up correctly in the final workspace, but it's gotten a lot better at parsing/interpreting the native expressions of dependency and figuring out what to do. See for example how you build the multiple projects which make up the Gazebo simulator with colcon:
https://colcon.readthedocs.io/en/released/user/quick-start.h...
Of course, colcon also supports adding python/setuptools repos, and includes experimental support for bazel, gradle, cargo, and other buildsystems which can do an "install" step into a reasonably sane FHS tree. So in that way it's kind of like a cross-language supercharged virtualenv— it gives you the benefits of building multiple pieces of a system from source, semi-isolated, without the hassle of dealing with containers or VMs, where you also have to have all your tools in the isolated environment.
Build systems should be easy to build. Bazel is not by a far shot due to java being a mess in this area (ironic given it being advertised as a cross platform language).
These issues are not important for everyone perhaps. (Heck the entire Kubernetes ecosystem pulls random binaries from docker hub without any cryptographic signatures.) but it's still a shame; especially for a build system.
The part where this starts to suck is when their tools become pseudo-standards and everyone has to live with their decisions.
1. A corporation spends significant resources developing a project.
2. Then they release to allow the public to use it at zero cost. Often they even invest in supporting that external use.
3. The project provides enough value to so many users (who chose it of their own volition) that it becomes nearly a standard.
And this is somehow a bad thing?
Most Google projects are like this, including Android which is the main reason why vendors struggle with os updates.
Currently doing this for BSD using OpenJDK 11.
Irrespective of Bazel, that's an lot of software than can't run on NixOS ARM, including build-related stuff:
* Elasticsearch, Cassandra
* Eclipse, IntelliJ, Netbeans
* Jenkins
* Java toolchain, Android toolchain
> (ironic given it being advertised as a cross platform language
Indeed that is one of Java's hallmark features. Servers, desktops, phones, toasters.
---
FWIW it's not unheard of to require compiling on one platform for another. This is how most of the embedded world works.
Other idea, distributions like Debian, seems to build OpenJDK as well, so maybe that would be a way to get the initial package (through an existing distro) https://buildd.debian.org/status/logs.php?pkg=openjdk-11 - see the armel/armhf/arm64 architectures (arm64 equals aarch64).
That might get you bootstrapped to the point where you can use that to re-compile the community edition of Java.
The command line client as well as some low level file utilities.
But Bazel is distributed as a standalone package in several packaging systems; no need to install Java yourself.
Though I doubt many people know this; there's virtually no reason you would be exposed to its language implementation choices.
EDIT: Actually I believe Bazel is changing its .deb package to not be standalone, in order to comply with Debian requirements.
Um, doesn't it still have a client that starts up a persistent server and you then have to wait for that server to start up (which, being Java, takes forever) and then deal with those server processes hanging around?
That sounds like being exposed to its language implementation choices.
As opposed to, say, having fast start-up times and not using a server design like basically every other build too.
But my information might be out of date. That's what always soured me on it previously, though.
It starts a server for (1) concurrency control (2) management of worker processes some languages use (3) caching the build graph (recall that Bazel works with very large code bases).
These reasons are independent of implementation in C++, Go, Rust, Java AOT, etc.
(And yes it doesn't have to use a persistent process to solve these problems. That is the solution it chooses.)
> not using a server design like basically every other build too
Buck, Pants, sbt, Gradle
I think the server is kept around for a number of reasons that have nothing to do with Java startup time. Probably the biggest one is file-watching, using inotify, FSEvents, etc.
https://stackoverflow.com/questions/57982028/how-does-bazel-...
Java can be compiled into native binaries using GraalVM. Not to mention you dont actually have to install Java as it comes in bundled.
Bazel-like in many ways; written in Go.
The default install of my dev machine (Ubuntu) installed two different versions of python and perl5, neither of which I use. Other languages have been installed indirectly because I installed one tool or another. As long as the language itself doesn't get in the way (e.g. the tool is picky about the language version and requires extra work to install it) why should I care ?
Plus, even if one does not use them, shipping a minimal runtime is hardly any different from having libc or libc++ dynamically linked.
Major examples: rules_python flat out does not work for python 3, rules_docker does not work without python 2, rules_proto cannot generate stubs for languages, you cannot specify third party deps at a package level and there is no explanation as to why (they will say it would destroy hermetic builds or reproducable builds but that doesn't make sense when you think about ways to support both).
Solution: Design a simple, straightforward build tool.
Problem: There are N+1 confusing build systems with arcane rules.
I’m happy to see people inventing new build systems, programming languages, game engines, ORMs, or anything else where the conventional wisdom is to use the existing tools. It may be crazy optimistic but we need people to keep these skill sets alive.
However, solutions pushed by corporations with grandiose claims do strike a nerve with me. If only because they are typically pushed with the idea that they will spread through some technical superiority. I'm much more open to this getting more use strictly from who is pushing it, not what it is capable of.
* Asana * Databricks * Dropbox * Google * Huawei * Lyft * Pinterest * Stripe * TwoSigma * Uber ...
This is not a new project that needs pushing.
After all, there are only tools. If you need a better tool, build it and ignore the naysayers. Everything is an experiment. If it inspires people, the better.
Technical debt is when you prioritize short-term gains and pay for it with additional maintenance burdens long-term. In my experience, Bazel adoption can be the opposite—replace your custom scripts with Bazel, make the investment now, and deal with less maintenance later.
I’ve dealt with some really painful in-house build systems, and migrated some of them to Bazel. That was paying off technical debt.
Yes, a big design requirement is to be polyglot, but if that's all you want, Make has been around thirty years.
Bazel attempts to solve the problem of performance and correctness in large codebases.
Most build tools do not scale well.
Did you ever use it, or at least see what a bazel build rule looks like [1] before calling it arcane?
[1] https://docs.bazel.build/versions/1.0.0/tutorial/cpp.html#un...
E.g. How easy is it to integrate a new C++ compiler into bazel? (and I don’t just mean what you get by changing CC to point somewhere else. I want the full integration with the bazel build system in order to get those hermetic builds that are the whole point of using bazel in the first place).
How easy is it to build things which are not in the set of blessed languages? What if I have a Haskell component? Can I easily integrate that into my bazel build? Last time I tried the answer was definitely not.
If you can use the pre-defined BUILD rules then bazel is pretty great. If you can’t and have to start wading into the weeds of bazel’s hinterland then it rapidly stops being so. If you’re inside Google, then you’re probably fine because a blaze/bazel engineer is ultimately only an email away. For the rest of us outside the Googleplex, extending bazel is an extended exercise in frustration in my experience.
You can also define your own rules in a subset of Python (by wrapping other rules including genrule()), so adding new languages should be simple enough.
what a standard, used by a whopping 2% of the C++ community : https://www.jetbrains.com/lp/devecosystem-2019/cpp/
- I couldn't find an easy way to list targets
- in particular, a way to show me the path to the build artifacts (so that I could inspect it in my editor)
- I couldn't find a way to do build configurations (especially intersections of build configurations)
- it didn't seem great at handling non-file build steps (set up a cluster / server / whatever so I can run my tests)
- the documentation was slow to load and hard to find things in (you basically had to use search, instead of browsing a good table of contents)
As I said, though, I'm a newcomer; it's quite possible there are good ways to do those things, I just hadn't managed to find it in the documenting yet. That and the issues are by no means unique to bazel.
I also do like some aspects of it (like enforced out-of-tree builds), but that's off-topic ;)
bazel query //some/package:*
Listing targets in a package including subpackages: bazel query //some/package/...
These and more are covered in the documentation on querying: https://docs.bazel.build/versions/1.0.0/query.html#target-pa...Non-file steps: normally in bazel you would consider the server setup a part of the test. So `blaze build :my_test` creates an artifact, and blaze run or blaze test runs the artifact which does non-hermetic stuff like setting up a server.
* Build rules were extremely simple to write
* Sandboxing meant we could safely share a global cache of build artifacts, massively reducing build times
* It runs a persistent server process that caches dependency and file change state, so incremental builds are fast
* Buck had a lot of android-specific magic to make APK generation fast as well, not sure if that's in bazel.
A lot of the stuff that's nice about these build systems only really becomes an issue on large codebases (thousands of engineers, tens of millions of LOC).
The main weakness of buck (not sure about bazel) was handling 3rd party code; either you'd checkin prebuilts or port the build to buck.
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.
Bazel's dependency graph tends to be much more detailed than Makefiles, extends all the way to toolchains at the base, and all the way up to build products and test results.
It can also be composed together across huge file layouts in ways make doesn't support.
You don't need a giant codebase to start benefitting from it. Even if you have a smaller codebase, and properly use bazel to setup tests, you only test what needs testing, and that makes a huge difference in productivity.
[1] https://dataform.co/blog/typescript-monorepo-with-bazel/
For example, you could configure your CI to push test results to a remote cache, and when developers check out a clean master, ”bazel test //...” against that cache will report all tests as pass without running anything.
I hope the release of 1.0 is an indication that Bazel is taking interface stability more seriously.
I have to say, having used a number of Google's tools over the years: basel, coral sdk, maps api and perhaps others, I'm always surprised at how 'how ya doing' the experience is. Don't get me wrong, I appreciate their tools and its openness, but I wish Google spend a bit more time doing software engineering, and less throwing shit against a wall ascertaining stickiness.
This is fixed now: https://github.com/tensorflow/tensorflow/commit/991aec351b57...
If you use Bazelisk (https://github.com/bazelbuild/bazelisk), you'll automatically get the matching Bazel version for TensorFlow in the future (and all other projects that have adopted the .bazelversion file).
Though, manually specifying a maximum Bazel version doesn't seem like it should be necessary. The authors of Bazel know what features they have changed since the version specified as the minimum, and Bazel itself knows what features the BUILD file uses. That information together could be used to calculate the maximum version.
Also, unless they had wildly different versioning pre 1.0, they could have just said "we are releasing 1.0". semver already states that 0.y.z should not be considered a stable API [1].
The thing that kills me about Bazel is that it is quite painful to deal with Java. I never seem to get a working version on a Linux distribution. On Windows it's always sitting down in the taskbar showing ads. Oracle calls you to demand money. You check the bounds of an array and they sue you. It's just not worth it. So I don't actually use Bazel.
Bazel != Blaze (internal version of Bazel).
1. Google has a well maintained monorepo. Most companies don't. That diminishes the meaning of a good build system in the very first place; even if Bazel is powerful, with separate repos it's power isn't the shiniest.
2. Google open sources a part of Blaze, which is the external Bazel, but not all to it. That's what Google does with basically everything it open-sources. The outcome then, is that the external tool require you to build a lot of other not open-sourced tools to replicate the excellence of the entire Google internal eco-system that makes the internal tool so amazing. Same goes with Bazel. It works amazingly internally because there are so many people supporting it, and so many other tools work nicely with it. But not all the features and tools are open-sourced together with Bazel, so the diff of experiences internally VS externally is significant.
TL, DR: if you're a small company without a good monorepo strategy and someone experienced on this, DON'T EXPECT BAZEL TO BE YOUR MAGIC CURE.
Disclaimer: my current company uses Bazel pre-1.0 and it's definitely dramatically worse than what I used internally at Google. I haven't tried 1.0 but I don't expect the ecosystem problem to be solved in 1.0 anyways. Also Bazel sort of sucks for python anyways. Really hoping someone can prove me wrong and say 1.0 is actually the lit shit.
I've never experienced any of this. Maybe because I use OpenJDK?
Pretty much every other build system (e.g., make) is rooted in having a proper dependency graph. This is not a unique property of Bazel.
[1] https://www.microsoft.com/en-us/research/uploads/prod/2018/0...
Doing Java since it was introduced in 1996 and never got to see Java ads on the taskbar, must be a special version.
Short-term, it will take a while after 1.0 for the surrounding tools and libraries to stabilize. It will take a little while for better documentation, blog posts, etc.
Personally, I find it a huge step up from e.g. CMake for C or C++ projects. But I’ve been using it for a while.
That seems... short
Gradle can become really slow in large projects.
You use the one tool to compile C++, Java, Python, Go, Rust, etc.