-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[WIP] Accessing each build script's OUT_DIR
#15891
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
base: master
Are you sure you want to change the base?
Conversation
75ff71c
to
0d5b7b0
Compare
c0d23d2
to
6c8bc08
Compare
let env = self | ||
.compilation | ||
.extra_env | ||
.entry(script_meta) | ||
.or_insert_with(Vec::new) | ||
.push(("OUT_DIR".to_string(), out_dir)); | ||
.or_insert_with(Vec::new); | ||
env.push(("OUT_DIR".to_string(), out_dir.clone())); | ||
env.push((out_dir_name, out_dir)); |
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.
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.
In a separate commit maybe? Or should I update the latest commit itself?
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.
Unless the commit is ginormous (e.g. adding all of cargo add
into cargo
), I would generally update docs as part of commit that added the feature, like tests.
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 think only docs are remaining. Everything else should be done.
5581004
to
c9e3081
Compare
c9e3081
to
08f83e3
Compare
65b6c7f
to
4117277
Compare
anyhow::bail!( | ||
"found duplicate build script file stem {}, \ | ||
but all build scripts must have a unique file stem", | ||
stem | ||
); | ||
} |
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.
Can we gather this into a HashMap<Name, Vec<Path>>
and then iterate through and if Vec<Path>
has more than one element, we then error? That would led us report all errors at once and report the full path for each conflicting build script so users can better understand what they need to change
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.
Sure, I was just following how earlier validate_unique_name
functions were written.
4117277
to
d48d421
Compare
This PR is continuation of my work on GSoC Project : Build Script Delegation
What does this PR try to resolve?
Through this PR, I want the user to be able to access each build script's
OUT_DIR
.How to test and review this PR?
There is a feature gate
multiple-build-scripts
that can be passed viacargo-features
inCargo.toml
. So, you have to addPreferably on the top of the
Cargo.toml
and use nightly toolchain to use the featureThen, you can access the
OUT_DIR
of given build script by accessing it like a compile time environment variable, for example: