mkw icon indicating copy to clipboard operation
mkw copied to clipboard

Investigate Bazel with remote build

Open riptl opened this issue 2 years ago • 0 comments

I recently tried out https://bazel.build/ and I think it has a lot of qualities to make @riidefi happy. While benefiting from all the goodies of a modern build system, we can keep almost the entire pack directory and sources.py (in Starlark, closely related to Python).

Pros:

  • Designed for "hermetic" (repeatable/deterministic) builds, perfect match for decomp
    • Considers build tools as sources so it can automatically fetch all compilers and tools
  • Great performance, on-par or sometimes faster than Ninja-based build systems
  • Supports dependency tracking, no more need for --match or --regen_asm
  • Great support for remote build execution, allowing us to host some fat Windows server somewhere that does all compile jobs
    • No more need to use Windows as dev OS
    • No more Wine
    • Much faster builds on non-Windows
  • Allows us to get rid of the Python subprocess crap
  • Bazel config language ends up being very readable (although a bit verbose)
    • Newcomers can easily add more sources without prior Bazel knowledge
    • example https://github.com/envoyproxy/envoy/blob/main/source/server/BUILD

Cons:

  • Despite being readable, it's still the most complex build system I've seen yet.
    • Tough learning curve so this project will probably only have 1-2 people that fully understand the Bazel toolchain
    • But tbh, still great for learning, Bazel sells well on the job market
  • Java-based (however much like Gradle bundles the JRE and spawns a daemon process, so no noticeable overhead)
  • The builtin C/C++ toolchain doesn't fit well with decomp because it isn't granular enough to track per-object flags, so we'd need to write our own C rule set

riptl avatar Jul 24 '22 08:07 riptl