mirror of
https://github.com/rust-lang/cargo
synced 2024-10-01 05:23:56 +00:00
parent
5c55068218
commit
2d5d7b4e47
|
@ -151,6 +151,8 @@ impl<'a, 'b> Context<'a, 'b> {
|
|||
self.build_requirements(pkg, target, Target, &mut HashSet::new());
|
||||
}
|
||||
|
||||
self.compilation.extra_env.insert("NUM_JOBS".to_string(),
|
||||
Some(self.config.jobs().to_string()));
|
||||
self.compilation.root_output = self.layout(KindTarget).proxy().dest().clone();
|
||||
self.compilation.deps_output = self.layout(KindTarget).proxy().deps().clone();
|
||||
|
||||
|
|
|
@ -71,6 +71,8 @@ commands.
|
|||
* `OUT_DIR` - the folder in which all output should be placed.
|
||||
* `TARGET` - the target triple that is being compiled for. Native code should be
|
||||
compiled for this triple.
|
||||
* `NUM_JOBS` - the parallelism specified as the top-level parallelism. This can
|
||||
be useful to pass a `-j` parameter to a system like `make`.
|
||||
* `DEP_<name>_OUT_DIR` - This variable is present for all immediate dependencies
|
||||
of the package being built. The `<name>` will be the
|
||||
package's name, in uppercase, with `-` characters
|
||||
|
|
|
@ -791,6 +791,7 @@ test!(custom_build_env_vars {
|
|||
.file("src/foo.rs", format!(r#"
|
||||
use std::os;
|
||||
fn main() {{
|
||||
let _ncpus = os::getenv("NUM_JOBS").unwrap();
|
||||
let out = os::getenv("OUT_DIR").unwrap();
|
||||
assert!(out.as_slice().starts_with(r"{0}"));
|
||||
assert!(Path::new(out).is_dir());
|
||||
|
|
Loading…
Reference in a new issue