What kinds of workflows do users have? #327
Replies: 5 comments 40 replies
-
In general, I don't think I want to hash out here which model is objectively better. The google approach is detailed here. I think we can probably agree that (1) that approach might be better for large organizations, and (2) that approach might be onerous for small organizations. Furthermore, I think we can agree that the google approach forces code organization decisions that break assumptions made by most existing rust tools, which is a huge bummer. In #319 (comment), @UebelAndre says
It sounds like you envision developers on individual projects writing cargo.toml files for each crate, but instead of building with cargo, you'd build with bazel. Is that accurate? Under what circumstances would developers on the same or different project or same or different organization try to ensure that the same versions of dependencies are used? |
Beta Was this translation helpful? Give feedback.
-
I'll add more context here but:
This is currently how workflows involving |
Beta Was this translation helpful? Give feedback.
-
When I filed this issue I had the impression that there existed an unverbalized mental model of rust-bazel-cargo-raze where developers are writing new code using new Cargo.tomls, even if such crate is never destined to be pushed to crates.io (or even built with Cargo). In this model, nobody would ever hand write a rust_library because every crate would consist of a toml and either be free floating (and unmoored from any common dependencies), or live in a single large cargo workspace and be "moored" by virtue of a shared lock file. Is this indeed the goal we're after? If so, I think we should (informally) come up with a "user journey" for this use case, and a set of goals and non-goals. We can then tie some of these new features being implemented to that larger vision. If "declare-in-cargo-build-in-bazel" is not the desired end-state, then what specifically is the goal? Is it just to make building a single arbitrary existing crate easier with cargo-raze? What role do rust_library and the other regular rules_rust rules play in this model? |
Beta Was this translation helpful? Give feedback.
-
I think this might be relevant here, but I think this project is quite a unique mix of different components. For the life of this project, I think it's valuable to continue to publish cargo raze to |
Beta Was this translation helpful? Give feedback.
-
One other thing of note, I don't think any of the examples are in alignment with the Google model of cargo-raze. |
Beta Was this translation helpful? Give feedback.
-
Summary of the discussion as of DEC 23 AM
We introduce two terms for mental models of how users might use cargo-raze. They are:
crate_universe
rule.(this isn't necessarily meant to say one could not apply both approached, but that they're distinct ways of thinking about the cargo-bazel integration)
@UebelAndre and I agree that both mental models (which map down to code organization strategies) have valid usecases and should be supported. I add here now that we should view all new features as foundational (meaning internal or applies to both), or as applying to support one or the other usecase. I further suggest that we include a section very high in the documentation describing the two models, and helping users decide which works best for their Bazel workspace(s).
In general, the rest of the discussion consists of how we developed the previous vocabulary, and details in particular about the future direction of the "tomls-everywhere" model.
Original Post Below
Branched from discussion in #319
The workflow type that I'm familiar with (cribbed from how Google manages third party dependencies) is that there is a single repository of third party crates in the monorepo. In general, there is a rule there that there be only one version of each dependency. For each language, a set of special arbiters of third party dependencies exists. These folks gatekeep the inclusion of new third party code.
In that model, the organization in general would only have one cargo.toml, because the organization would not integrate deeply with cargo. That singular cargo.toml would not map to any single application. Instead application developers write applications and libraries more like one would write C++ applications and libraries, using the blessed versions of dependencies in
//third_party
or whatever, and never interact with cargo.toml.The repo structure ends up looking like this
In #319, @UebelAndre alludes to I think a different workflow which is more deeply integrated into cargo, and in general treats the cargo.toml, not the BUILD file, as the source of truth. I think this is an interesting model that should not necessarily be dismissed, in large part because it's significantly closer to the existing cargo user experience.
I think that workspace looks more like this
Beta Was this translation helpful? Give feedback.
All reactions