You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be great to be able to specify which targets are valid and can be used in a project and workspace. Ideally both on the workspace overall as well as on individual projects.
Both to give users an explicit error when trying to build for an unsupported target (instead of a link or compile error somewhere in the code, or worse: runtime panic), as well as to avoid bringing in dependencies for platforms that are not used into Cargo.lock and when vendoring.
We currently have both issues.
We have crates that can only compile and only makes sense for certain targets, specifically native arch vs WASM, some of our crates work for both and some of them only work for one of them. And it is hard to "compile out" the code for the incompatible target in 50+ crates.
Reduce amount of listed dependencies for targets we do not use. We want keep our dependencies as clear and few as possible to be able to review and manage everything we use, and then it is additional work if dependencies that we don't even use from platforms we don't use or support are brought in.
For example the following targets we do not support: fuchsia, redox, emscripten, freebsd, android, cloudabi.
And here are a few dependencies in our current Cargo.lock from these unused platforms/targets that we haven't been to get rid of: stdweb, android_glue, errno-dragonfly, fuchsia-zircon, fuchsia-zircon-sys, redox_syscall.
Still really want this, have so many extra dependencies lingering in our Cargo.lock that makes it harder to manage and get a good overview. And it also triggers cargo-deny more often than it should.
Regarding cargo-deny, it now supports --target or config like below to filter out crates that are present in Cargo.lock if they are not active in the selected targets.
[graph]
# By specifying allowed targets here, bans like "wasm-bindgen" can be added even though# those crates exist in Cargo.lock for de-selected targets.targets = [
"x86_64-unknown-linux-gnu",
"aarch64-apple-darwin",
"x86_64-apple-darwin",
"x86_64-pc-windows-msvc",
]
[[bans.deny]]
name = "wasm-bindgen"
It would be great to be able to specify which targets are valid and can be used in a project and workspace. Ideally both on the workspace overall as well as on individual projects.
Both to give users an explicit error when trying to build for an unsupported target (instead of a link or compile error somewhere in the code, or worse: runtime panic), as well as to avoid bringing in dependencies for platforms that are not used into
Cargo.lock
and when vendoring.We currently have both issues.
We have crates that can only compile and only makes sense for certain targets, specifically native arch vs WASM, some of our crates work for both and some of them only work for one of them. And it is hard to "compile out" the code for the incompatible target in 50+ crates.
Reduce amount of listed dependencies for targets we do not use. We want keep our dependencies as clear and few as possible to be able to review and manage everything we use, and then it is additional work if dependencies that we don't even use from platforms we don't use or support are brought in.
For example the following targets we do not support: fuchsia, redox, emscripten, freebsd, android, cloudabi.
And here are a few dependencies in our current
Cargo.lock
from these unused platforms/targets that we haven't been to get rid of:stdweb
,android_glue
,errno-dragonfly
,fuchsia-zircon
,fuchsia-zircon-sys
,redox_syscall
.Issues:
cargo
Allow specifying a set of supported targets in Cargo.tomlcargo
Nested workspacesThe text was updated successfully, but these errors were encountered: