cross icon indicating copy to clipboard operation
cross copied to clipboard

path dependencies that are other-workspace workspace-members should mount their workspace

Open Emilgardis opened this issue 1 year ago • 4 comments

Checklist

Describe your issue

Cross doesn't consider the workspace path when mounting path dependencies, only looking at the crate path. Cross should instead look for the workspace root of the crate.

What target(s) are you cross-compiling for?

No response

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 (4090bec 2024-10-15)

Example

cargo add --path <path_to_other_worksace_member> cross build

Additional information / notes

context: https://matrix.to/#/!ZFqvHUjUqgONNObpSJ:matrix.org/$CxCTfTP9p1jSYn63720JpkCqiKVr3wnK04pFfOnlt1o?via=matrix.org&via=beeper.com&via=gnome.org

Emilgardis avatar Feb 06 '25 19:02 Emilgardis

To solve this, we need to resolve if the crate is in a workspace, and then get the workspace root here https://github.com/cross-rs/cross/blob/main/src/cargo.rs#L89-L92

Emilgardis avatar Feb 06 '25 19:02 Emilgardis

I'm not sure this is actually possible :/ I can't see anyway to relate a path dependency to it's workspace root (if it has one).

Emilgardis avatar Feb 06 '25 19:02 Emilgardis

Is there any work around for this?

mendess avatar Feb 17 '25 11:02 mendess

Yes, manually specify the path and use it as a env.volumes. see https://github.com/cross-rs/cross/blob/main/docs/config_file.md#buildenv

Emilgardis avatar Feb 17 '25 15:02 Emilgardis