-
Notifications
You must be signed in to change notification settings - Fork 410
Option to share parent directories with the container? #405
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
Comments
Ok, it seems like running |
A possible work-around is to create a
Than you can run
I'm not sure this will work for everyone, but it did for me, so I thought I might share :) |
Coming back to this, the I haven't tried the workspace approach yet, in part because of some bad experiences I had in the past with workspaces. (Nothing to do with Cross. But I found that it was hard to test |
#443 should also help, it's not well documented though |
@Emilgardis could you give an example of using volumes to allow a path like |
@oconnor663 I've created a sample repository showing how to do this: The README explains how to mount specific volumes based on environment variables for the given project structure, and then how to build the project. Maybe this should be added to |
do note though, if your project structure is like that, you should look into https://doc.rust-lang.org/book/ch14-03-cargo-workspaces.html, but that doesn't help for cross right now. We have #684 in the pipeline, which will make workspaces (and path dependencies) work seamlessly, without having to use volumes as shown in the example |
#684 is merged supporting workspaces, and we also use the same mount location as on the host for the project if any additional volumes are mounted. This means if you mounted the parent directory of the project, you can access all data from the parent directory while running cross. This means that the project will always work, as will manifest paths and workspaces. |
I often find myself running into the limitation described in the README:
I have a project that looks like this:
The details don't super duper matter, but for example, the
b3sum
crate depends on the root crate, and everything wants to depend onreference_impl
for testing. And maybe this is a little weird :) but theblake3_c_rust_bindings
builds and links the C source files that are in its parent directory, so thatcargo 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 couldcross 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: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? :)The text was updated successfully, but these errors were encountered: