Description
I often find myself running into the limitation described in the README:
path dependencies (in Cargo.toml) that point outside the Cargo project won't work because cross use docker containers only mounts the Cargo project so the container doesn't have access to the rest of the filesystem.
I have a project that looks like this:
.
├── b3sum
│ ├── Cargo.toml
│ └── ...
├── c
│ ├── [a bunch of C source files...]
│ ├── blake3_c_rust_bindings
│ │ ├── Cargo.toml
│ │ └── ...
│ └── test.py
├── Cargo.toml
├── reference_impl
│ ├── Cargo.toml
│ └── ...
├── src
│ ├── ...
├── tests
│ └── ...
└── test_vectors
├── Cargo.toml
└── ...
The details don't super duper matter, but for example, the b3sum
crate depends on the root crate, and everything wants to depend on reference_impl
for testing. And maybe this is a little weird :) but the blake3_c_rust_bindings
builds and links the C source files that are in its parent directory, so that cargo test
can exercise them.
Currently I only cross test
the root crate, because of the path limitation. Every so often I think about reworking this entire thing so that I could cross test
all the different components. But I haven't thought of a natural way to do it. Today it occurred to me that all these problems could go away if there was a flag that let me do something like "share the entire project directory with the container, and then run Cargo in a subdirectory." In fact, literally running Cargo in the root directory and adding in e.g. --manifest-path=./b3sum/Cargo.toml
seems to almost work, but I run into this error:
Updating crates.io index
error: failed to write /project/b3sum/Cargo.lock
Caused by:
failed to open: /project/b3sum/Cargo.lock
Caused by:
Read-only file system (os error 30)
I'm going to keep playing with this and see if I can find a workaround. In the meantime, I wanted to ask whether something like this had been considered before. Is there a known workaround? Is there a particular reason cross
can't support something like this? Is my project layout an abomination? :)