-
Couldn't load subscription status.
- Fork 2.7k
Don't require dev-dependencies when not needed in certain cases #5012
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
Changes from all commits
7de30dd
ee78456
3fc0715
df5f7d6
da41b4e
9c5eecd
31f6f84
70170d1
d46db71
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -176,7 +176,11 @@ fn install_one(root: &Filesystem, | |
|
|
||
| let ws = match overidden_target_dir { | ||
| Some(dir) => Workspace::ephemeral(pkg, config, Some(dir), false)?, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't the optional deps flag be set for this as well? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ephemeral() already sets that internally |
||
| None => Workspace::new(pkg.manifest_path(), config)?, | ||
| None => { | ||
| let mut ws = Workspace::new(pkg.manifest_path(), config)?; | ||
| ws.set_require_optional_deps(false); | ||
| ws | ||
| } | ||
| }; | ||
| let pkg = ws.current()?; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps the name
optional_depscould change since it's affecting dev-dependencies?Additionally, I think that we'd want this flag to affect target-specific dependencies, right? If this is a sort of "one shot" compilation there should also be no need to resolve and require windows-specific dependencies when on Linux, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind if we leave that as a TODO for the future? What you say makes sense but it is not actually needed in Debian right now, because we union over all targets when translating dependencies - so e.g. winapi etc are all pulled in regardless of what target you're building for. This means we have to have less special-cases in the packaging, and also supports cross-compilation later.
If I understood correctly, on Fedora they are patching out windows dependencies so they don't appear in Cargo.toml, so this functionality wouldn't be needed either. (Perhaps @ignatenkobrain can confirm).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok sure yeah, I think a TODO should suffice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unsure if it's appropriate to mention "targets" in the sense of "platform" here on this line. The term "target" in the context of CompileFilter and
core::Targetandcargo buildoptions, seems rather to mean "lib/bin/examples/tests" etc and not platform.OTOH the functionality you mention does seem to be missing - if I add
[target."XXXX".dependencies] YYY = "999"to Cargo.toml thencargo installstill fails with this PR, despite the fact that "XXXX" does not match the current platform. I'm just unsure of the appropriate place to add this TODO, please advise. Perhaps onstruct Method?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm ok, perhaps an issue can be filed? I think the
-Z avoid-dev-depsflag added here may in the long run want to be something like--minimal-cargo-lockwhich prunes all non-relevant dependencies like platform-specific dependencies that don't apply, dev-deps if you're not building tests, etc. In that sense I think the feature/TODO here is slightly broader than a comment in the code. Would you be ok filing that?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed as #5133