Skip to content
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

check/build on workspace forces build of package not required by current target #6185

Closed
temoto opened this issue Oct 19, 2018 · 2 comments
Closed
Labels
A-workspaces Area: workspaces C-bug Category: bug

Comments

@temoto
Copy link

temoto commented Oct 19, 2018

Problem

# project/Cargo.toml
[workspace]
members = ["cmd/iodin"]

# project/cmd/iodin/Cargo.toml
#...
[dependencies]
[target.'cfg(target_os = "macos")'.dependencies]
[target.'cfg(target_os = "linux")'.dependencies]
pigiron = { path = "../../hardware/pigiron" }  # impossible to build on macos

Steps

  • cargo commands in binary directory work as expected
cd project/cmd/iodin
cargo check
    Finished dev [unoptimized + debuginfo] target(s) in 0.05s
  • but in workspace it tries to compile dependency that was not required by target
cd project
cargo check
   Compiling pigiron v0.1.0 (/Users/temoto/dev/github.com/temoto/vender/hardware/pigiron)
error: failed to run custom build command for `pigiron v0.1.0 (/Users/temoto/dev/github.com/temoto/vender/hardware/pigiron)`
...

Possible Solution(s)

For workaround I just use bash script instead of cargo at top level.

Notes

Output of cargo version:

  • cargo 1.31.0-nightly (5dbac98 2018-10-08)
  • toolchain: nightly-x86_64-apple-darwin (default)
  • OS: OSX Darwin Kernel Version 16.7.0
@alexcrichton alexcrichton added C-bug Category: bug A-workspaces Area: workspaces labels Oct 27, 2018
@ehuss
Copy link
Contributor

ehuss commented Aug 8, 2019

I think this is to be expected (albeit surprising), as all path dependencies are implicitly added as workspace members. One workaround should be to add it to the workspace exclude list. I don't think it would be feasible for target dependencies to be automatically excluded because we don't have the target configuration before the workspace is constructed.

@epage
Copy link
Contributor

epage commented Oct 24, 2023

With #6179 and #9208, we'd have the tools to allow a package to be a no-op when building workspace members which I feel takes care of this problem. I'm closing in favor of those. If there is a reason we should keep this open, let us know!

@epage epage closed this as not planned Won't fix, can't repro, duplicate, stale Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-workspaces Area: workspaces C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

4 participants