Whats the advantage of using Bazel over CMake ? What does one do about package management ?
For packages, you download things by specifying an archive (zip file, git repo, etc), and a SHA256 hash. Think of it as extremely-precise version pinning. You can also refer to other Bazel projects and use their internal rules if permitted. 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 th…
Bazel 1.0
151–160 of 204 posts
Re: Bazel 1.0
#152Earlier quoted context omitted.
Bazel is almost a standard for build systems at this point. 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...
Build rules for bazel are straightforward when you’re on the happy path & trying to do something that bazel already understands. It’s when you’re not on the happy path that things get awkward. 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…
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.
Re: Bazel 1.0
#153One of the major time savers of bazel is Remote Build Execution (RBE), which allows you to build modules in parallel in the cloud. So if you have 1000 CPUs, you can really just have a client do `bazel build -j 1000 //...` and you can get a huge speed-up. Remote (and local) builds all happen in a sandbox, so you don't have to worry about e.g. preparing a docker image with the worker / build slave environment. (You do,…
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.
Re: Bazel 1.0
#154Earlier quoted context omitted.
There are alternatives that satisfy this (valid, IMO) requirement. For example, there is build2 ( https://build2.org ; full disclousure: I am involved with the project) that tries to achieve the same objectives (correct & fast builds, uniform interface accross platforms, being language agnostic, etc) though not necessarily using the same mechanisms (build2, for example, tries to be fairly light-weight). Here is the i…
I checked as I was interested, but it seems that build2 doesn't do distributed builds. edit: remote->distributed
Re: Bazel 1.0
#155Earlier quoted context omitted.
JVM startup for `java -version` is around 150ms on my machine: $ time java -version openjdk version "11.0.1" 2018-10-16 OpenJDK Runtime Environment 18.9 (build 11.0.1+13) OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode) real 0m0.159s user 0m0.116s sys 0m0.052s This is how long it takes for a program like git to do actual work. Once you start running an actual program like Maven, it blows up to 500ms for `m…
Java 13 takes 97ms on Windows 10, and I haven't bothered to produce a Java native image before attempting it. PS C:\Workdir> Measure-Command { java -version } openjdk version "13" 2019-09-17 OpenJDK Runtime Environment (build 13+33) OpenJDK 64-Bit Server VM (build 13+33, mixed mode, sharing) Days : 0 Hours : 0 Minutes : 0 Seconds : 0 Milliseconds : 97 Ticks : 975572 TotalDays : 1.12913425925926E-06 TotalHours : 2.709…
Re: Bazel 1.0
#156Earlier quoted context omitted.
Build rules for bazel are straightforward when you’re on the happy path & trying to do something that bazel already understands. It’s when you’re not on the happy path that things get awkward. 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…
There's genrule() which basically runs a shell script. With that, you can build anything for which you can write a command-line. And you can go as far as invoke a binary that is built by another bazel rule. 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.
It’s just a SMOP, right?
Re: Bazel 1.0
#157That seems... short
Re: Bazel 1.0
#158Earlier quoted context omitted.
For packages, you download things by specifying an archive (zip file, git repo, etc), and a SHA256 hash. Think of it as extremely-precise version pinning. You can also refer to other Bazel projects and use their internal rules if permitted. 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 th…
(1) sounds like table stakes for any build system - `make` has done all that for decades
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.
Re: Bazel 1.0
#159Earlier quoted context omitted.
JVM startup is sub-second. Still not great for e.g. small command line utilities, but completely fine otherwise.
JVM startup for `java -version` is around 150ms on my machine: $ time java -version openjdk version "11.0.1" 2018-10-16 OpenJDK Runtime Environment 18.9 (build 11.0.1+13) OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode) real 0m0.159s user 0m0.116s sys 0m0.052s This is how long it takes for a program like git to do actual work. Once you start running an actual program like Maven, it blows up to 500ms for `m…
real 0m0.074s user 0m0.063s sys 0m0.025s
Re: Bazel 1.0
#160Earlier quoted context omitted.
Xoogler here who used the internal version of Bazel ( blaze ) extensively, liked it and now opted to use it for our 2 person startup ( at least for the backend ). 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.
What languages are you using with Bazel? I have a project that uses Typescript and Python. Are you using Bazel with interpreted languages?