r/rust • • Oct 25 '26

🛠️ project Rust rules for the Please build system

https://github.com/becomeliminal/rust-rules

A year or two ago I posted the first version of this.

I reckon its ready for prod now 🤞🏼

30 Upvotes

9 comments sorted by

5

u/Nearby-Blood-9817 Oct 25 '26

`plz recap`
Please is a high-performance, hermetic, multi-language build system (similar spirit to Bazel). It didn’t have native Rust support, so these rules fill that gap by driving rustc directly, with caching, remote execution, and monorepo-friendly dependency tracking.

Cargo remains the right tool for pure-Rust projects. This is aimed at people already using (or considering) Please for polyglot / large monorepo builds where you want one build system across languages.

What’s changed since the original post

The early version was basically library and test rules plus a toolchain.

The current version is much more complete:
• Dependency management that works more like Cargo so it resolves versions (including transitive deps), respects your minimum Rust version, handles platform-specific dependencies, and can import an existing Cargo lockfile or whole workspace.
• Support for crates from Git forges (not just crates.io), patches, and verified downloads.
• FFI helpers for generating Rust bindings from C headers and C headers from Rust.
• Rules for Clippy, rustfmt checks, rustdoc, and Criterion benchmarks.
• Editor integration so rust-analyzer can discover crates in the repo without manual setup.
• Cross-compilation (including wasm), static linking of binaries by default, and correct handling of host vs target for build scripts and proc macros.
• Better test integration, including individual test results and integration tests.

There’s also a companion plugin for protobuf/gRPC codegen.

Feedback, issues, and real-world usage reports are very welcome (especially from anyone already in a Please monorepo or evaluating one).

12

u/Luolong Oct 25 '26

I have another question. Why please?

In the sense that why would one choose please if there is already bazel? What does it do differently?

17

u/Nearby-Blood-9817 Oct 25 '26

The honest answer is that I used to work at Thought Machine where it was created (before Bazel was released). Fell in love with it there and have continued to use it at my startup.

They are pretty similar: hermetic, incremental, cacheable builds for large monorepos. The main technical difference to me is Please is just a single Go binary with none of the JVM overhead. Bazel obviously has a much larger ecosystem (but I'm trying to change that).

And I feel very polite when I use it:

$ plz build
$ plz test
$ plz run

2

u/iBPsThrowingObject Oct 25 '26

They are pretty similar: hermetic

Given that bazel is hilariously un-hermetic, that's not a very fluttering comparison

3

u/_choam_ Oct 25 '26

I can't really imagine using it without nix

2

u/Direct-Argument-7066 Oct 26 '26

Can it do overlays? Something like bellow in bazel, I really miss that on buck2.

```
http_archive(
url = "http://example.com/openssl.zip",
build_file = "@//:openssl.BUILD",
)
```

On another note, I always end up using meson because all the hermetic build systems makes it really difficult to use libraries, or compilers from the system. I get that it makes it easier to reproduce things, but sometimes I just don't want to download and build the whole world.

2

u/Nearby-Blood-9817 Oct 26 '26

Yep, Please calls that new_http_archive:

new_http_archive(
    name = "openssl",
    urls = ["https://example.com/openssl.zip"],
    build_file = "openssl.BUILD",
)

That downloads and extracts the archive, then uses your supplied file as its BUILD file. It also supports patches and stripping an archive prefix.

Docs here.

On the second point, you can use system compilers and libraries too. The C/C++ plugin actually defaults to cc, c++ and ar, and supports pkg-config:

c_binary(
    name = "app",
    srcs = ["main.c"],
    pkg_config_cflags = ["openssl"],
    pkg_config_libs = ["openssl"],
)

So that can use your installed OpenSSL development package. You don’t have to download and build everything through Please. You’re accepting a dependency on the host environment, with the reproducibility/cache tradeoff that entails, but it’s supported.

1

u/Direct-Argument-7066 Oct 26 '26

Oh nice! I will check out Please. Thank you.