-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Environment variable DEP_FOO_KEY is not generated for dev-dependencies #10927
Comments
I believe dev-dependencies only impact the compilation of test binaries and not regular builds,. so environment variables injected by a dev-dependency should not show up for a |
Well, I do understand this fact, however, even in a dev/test build - e.g. while unit or integration tests are executed the build scripts do run but the DEP_FOO_KEY env var seems not be passed on. Sorry if I was not clear enough on this in my initial description. |
Build scripts don't know about the different kinds of builds (tests, check, etc.). I think it is unlikely that it will be changed to run again when doing different things like commands that trigger the use of dev-dependencies. There are other issues for tracking that (like #4001 and #9394). I'm going to leave this open, but I suspect it is not something that will get addressed without some major overhaul of how build scripts work. |
Previously we tried building ykllvm in `OUT_DIR` but, unfortunately, that means when testing we can't access the Cargo variable we defined in rust-lang/cargo#10927. Previously, things accidentally worked because we also required PATH to be set to `/path/to/ykllvm/bin`, but that means you could pick up unexpected versions of clang/clang++, for example. This commit rethinks things. It builds a copy of ykllvm in `target/<debug|release>/ykllvm`. [Technically this breaks Cargo's rules, but since we're having to worm around a Cargo restriction, I think we can deal with this: if Cargo's rules change in the future, we can change the location easily enough.] `yk-config` gains `--cc` and `--cxx` flags which give the user the path to the C/C++ compiler. I've tried to keep this commit as minimal as possible: it would certainly be possible to do various bits of cleaning-up at the same time, but I think that would obscure what we're most interested in.
Previously we tried building ykllvm in `OUT_DIR` but, unfortunately, that means when testing we can't access the Cargo variable we defined in rust-lang/cargo#10927. Previously, things accidentally worked because we also required PATH to be set to `/path/to/ykllvm/bin`, but that means you could pick up unexpected versions of clang/clang++, for example. This commit rethinks things. It builds a copy of ykllvm in `target/<debug|release>/ykllvm`. [Technically this breaks Cargo's rules, but since we're having to worm around a Cargo restriction, I think we can deal with this: if Cargo's rules change in the future, we can change the location easily enough.] `yk-config` gains `--cc` and `--cxx` flags which give the user the path to the C/C++ compiler. I've tried to keep this commit as minimal as possible: it would certainly be possible to do various bits of cleaning-up at the same time, but I think that would obscure what we're most interested in.
Previously we tried building ykllvm in `OUT_DIR` but, unfortunately, that means when testing we can't access the Cargo variable we defined in rust-lang/cargo#10927. Previously, things accidentally worked because we also required PATH to be set to `/path/to/ykllvm/bin`, but that means you could pick up unexpected versions of clang/clang++, for example. This commit rethinks things. It builds a copy of ykllvm in `target/<debug|release>/ykllvm`. [Technically this breaks Cargo's rules, but since we're having to worm around a Cargo restriction, I think we can deal with this: if Cargo's rules change in the future, we can change the location easily enough.] `yk-config` gains `--cc` and `--cxx` flags which give the user the path to the C/C++ compiler. I've tried to keep this commit as minimal as possible: it would certainly be possible to do various bits of cleaning-up at the same time, but I think that would obscure what we're most interested in.
Previously we tried building ykllvm in `OUT_DIR` but, unfortunately, that means when testing we can't access the Cargo variable we defined in rust-lang/cargo#10927. Previously, things accidentally worked because we also required PATH to be set to `/path/to/ykllvm/bin`, but that means you could pick up unexpected versions of clang/clang++, for example. This commit rethinks things. It builds a copy of ykllvm in `target/<debug|release>/ykllvm`. [Technically this breaks Cargo's rules, but since we're having to worm around a Cargo restriction, I think we can deal with this: if Cargo's rules change in the future, we can change the location easily enough.] `yk-config` gains `--cc` and `--cxx` flags which give the user the path to the C/C++ compiler. One minor annoyance is that I've had to delete yksmp's tests, as that, as written, they don't fit into cargo's model. We should bring these back, but fixing them here feels like one thing too many. I've tried to keep this commit as minimal as possible: it would certainly be possible to do various bits of cleaning-up at the same time, but I think that would obscure what we're most interested in.
What isn't too clear to me is why dev dependencies should be made available. Depending on the answer to that, we might want to close this in favor of #4511 |
Problem
Creating a
DEP_FOO_KEY
environment variable in a build script is properly provided to all dependent crates if the crate providing this env-var is a usual dependency. However, as soon as this crate becomes a dev-dependency theDEP_FOO_KEY
is no longer passed from the build script to the dependent crates.This is unexpected behaviour.
Steps
links
section in it'scargo.toml
and a build script that generates aDEP_FOO_KEY
env variableIf in this example the crate FOO is maintained as a normal dependency of BAR the build script of BAR will show the expected env-var.
Possible Solution(s)
No response
Notes
No response
Version
The text was updated successfully, but these errors were encountered: