-
Notifications
You must be signed in to change notification settings - Fork 7.1k
feat: support local development using Buck2 #8504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
295b531 to
ec91a29
Compare
|
@bolinfest Hi! I was pointed to this PR by the bazel community, some folks were a bit surprised to see this as Openai is generally using Bazel internally for many projects :) I don't want to derail the experiments, but I was also curious why not use Bazel, given the feature gaps you mentioned in Buck?
We can do this in Bazel from day 1 using Buildbuddy free tier :)
Last time I checked, Buck2 did not support any sandboxing for local execution, only remote. Has that been fixed?
There's a slightly different approach with Bazel - it integrates with Cargo.lock/Cargo.toml and generates external repositories with BUILD files. I maintain a ruleset that does this. It sounds like this was the missing piece you may have been unaware of? The advantage of using Bazel is that it seems like the rust/cargo support may be more mature - rules_rs and rules_rust go through a lot of effort to match cargo's build script execution environment very closely, which should make the reindeer fixups in this PR unnecessary. If you're open to it, I'm happy to prototype a Bazel integration in parallel to this Buck one - it should support test caching and remote build/test out-of-the-box, and I'm hopeful it will also support remote cross-builds to simplify the release story (though it depends on the complexity of the dep tree, we'll see). WDYT? |
|
@dzbarsky Hello! Honestly, I decided to try Buck2 first because I have personal contacts with the Buck2 and Reindeer folks (incidentally, I also created Buck "1"). Also, Buck2 is written in Rust, so I would certainly expect its Rust build rules to be performant. I'm not keen to require folks to install a JVM to be able to run Bazel. As you can see in this PR, the DotSlash file for
I haven't looked, tbh. Though what sort of "sandboxing" does it leverage? Is it using micro-VMs/containers or something else?
External repositories? That sounds a bit complicated...
If you're willing to give it a shot, I'm certainly interested! For sure, distributed builds and caching [however we get it] should materially speed things up for both iterative development and CI jobs. |
I mean build rules are starlark, so it comes down to which starlark interpreter is faster :)
You don't need a JVM to run bazel, it ships as a self-contained executable. All you need is a
Depends on the platform. OSX uses
Sorry, that's a bazelism. It just means "code that is pulled from elsewhere instead of vendored", but it's completely transparent. The user experience is just
Cool, i'll give it a try, hopefully it shouldn't be too bad. It sounds from the above that you are (understandly) much more familiar with Buck than Bazel so hopefully a working demo should show what I mean a lot more clearly :) |
This is an experiment to get the Rust portion of the Codex repo setup to build with Buck2.
The motivation is to get build time benefits, both for local/incremental builds as well as in CI, though of note:
BUCKbuild files for existing crates: https://github.com/facebookincubator/reindeer (I am not aware of a comparable offering for Bazel)Unfortunately,
buck2 testdoes not currently cache test results as Bazel does:facebook/buck2#183
This is pretty important, as we want incremental invocations of:
./scripts/buck2 test //codex-rs/ato be as fast as possible, so I'll follow up on this.