-
Notifications
You must be signed in to change notification settings - Fork 444
Description
Checklist
- I've looked through the issues and pull requests for similar reports
Describe your issue
I have a mega repo that looks something like:
./ # git root
| --- workspace
| --- crate1
| --- crate2
| --- folder/crate3 # [dependencies] crate1.path = "../../crate1"
| --- some/other/path/schemas
I'm trying to get crate1 to reference cap'n'proto schemas that are located in the schemas folder. I have tried:
- Symlink schemas into crate1/schemas - not available within docker image since the symlink is pointing nowhere.
- Use volumes to set GIT_ROOT=../../ in workspace/Cross.toml. This works when building crate1 but building folder/crate3 results in GIT_ROOT pointing to
workspace/instead of "git root".
It would be much more convenient if it was guaranteed that relative paths within volumes were anchored relative to the location of Cross.toml / workspace Cargo.toml instead of floating with the crate that's getting built.
What target(s) are you cross-compiling for?
aarch64-unknown-linux-gnu
Which operating system is the host (e.g computer cross is on) running?
- macOS
- Windows
- Linux / BSD
- other OS (specify in description)
What architecture is the host?
- x86_64 / AMD64
- arm32
- arm64 (including Mac M1)
What container engine is cross using?
- docker
- podman
- other container engine (specify in description)
cross version
cross 0.2.5 (154b4ea 2025-12-15)
Example
No response
Additional information / notes
One workaround I've found is to have separate Cross.toml files within each crate set up the volume using the relative path correct for that crate but that's not generally scalable for workspaces with complex layouts. e.g.
./ # git root
| --- workspace/Cross.toml - # build.env.volumes = ["GIT_ROOT=../../"] # default for all workspace/crate
| --- crate1
| --- crate2
| --- folder/crate3/Cross.toml # - build.env.volumes = ["GIT_ROOT=../../../"] # override for crate3
| --- folder/crate4/Cross.toml # - build.env.volumes = ["GIT_ROOT=../../../"] # override for crate4
| --- folder/some-other-folder/crate5/Cross.toml # - build.env.volumes = ["GIT_ROOT=../../../../"] # override for crate5
| --- some/other/path/schemas
I think the relative paths should always get resolved relative to the file they are declared in. That makes it the least error prone. At a minimum, making them always relative to the workspace root would be fine too even though it would be mildly confusing why paths relative to the workspace are appearing within crate Cross.toml files.