-
Notifications
You must be signed in to change notification settings - Fork 81
support repos with .cargo/config.toml but no Cargo.toml at root #205
Comments
Interesting one! I think I can support it, but will report back if I can't. How would you call this pattern (for reference)? |
Marking as upstream for inclusion in the project-types crate. |
I guess the lack of workspace at the root of the repo makes me think "rootless" or something? Maybe "rootless xtask" or "rootless multi-workspace repo"? |
|
Okay, what do you think of this (extract from future help page):
|
Replying from my phone. Looks reasonable. I think the main things I noticed were:
I'm not a fan of the foo bar baz metavariables. Could we make them meaningful like ws, crate, ... subcrate? I did't think it's possible to double nest workspaces in cargo? I might be misunderstanding your example. It might also be worth including a / in the example root workspace name, to point out that it could be a path.
In my case, the target dir is specified by the At some point the complexity required to support edge cases like this stops being worthwhile, and just having a documented workaround is the best answer. If --super is automatically inferred by default, I guess you don't need --super - you need --no-super to turn the functionality off when it misbehaves? |
Absolutely! I started with
Yes, I thought it was, but checked later and edited that bit out.
Great idea, will do.
Hmmmm I think I'll open a different issue to read that section of the config, because it could be useful but not address it here. I don't think I'll implement it this round tho, so you may have to fiddle around with ignores even with this support :) Edit: actually, thinking about it more, having the ignore be more intelligent than
Yeah I'm not super sure about doing this in the first place, actually, due to how I also think Cargo Watch could help with the "xtask alias only works at the top level" problem, but I'll leave that for a future improvement that's not only scoped to this super workspace feature. (#207) |
Feel free to mark this as too niche and close it.
I thought I'd share a slightly contrarian take on the xtask pattern for full-stack rust (the original pattern is described in https://github.com/matklad/cargo-xtask/ and a variation for embedded development is described at https://ferrous-systems.com/blog/test-embedded-app/):
4 workspaces:
No
Cargo.toml
at the top levelA
.cargo/config.toml
at the top level with this in:This has the advantage that each workspace is isolated, and you can get away without
workspace-hack
packages. It also means that all of your custom build commands work fine from the root of the repo.Unfortunately, it also means that
cargo watch
doesn't play ball at the root of the repo (and the xtask alias is fragile enough that it doesn't work anywhere other than the root of the repo).As I said in at the top, feel free to close this. I can't even think how
cargo watch
would be able to make any sensible decision other than "watch the whole git repo" under this scheme.The fix at the project level would be to merge the
crates/
andbackend/
workspaces, and promote them to the top level of the repo (following the structure in the ferrous-systems article, above), then be a bit more careful with feature flag interactions (probably using a workspace-hack package or similar). It is also possible to usewatchexec
, as long as you add some workarounds for nested .gitignore problems (watchexec/watchexec#250)The text was updated successfully, but these errors were encountered: