/// Root output directory (for the local package's artifacts)
pub root_output: PathBuf,
- /// Output directory for rust dependencies
+ /// Output directory for rust dependencies.
+ /// May be for the host or for a specific target.
pub deps_output: PathBuf,
+ /// Output directory for the rust host dependencies.
+ pub host_deps_output: PathBuf,
+
/// Library search path for compiler plugins and build scripts
/// which have dynamic dependencies.
pub plugins_dylib_path: PathBuf,
native_dirs: HashSet::new(), // TODO: deprecated, remove
root_output: PathBuf::from("/"),
deps_output: PathBuf::from("/"),
+ host_deps_output: PathBuf::from("/"),
plugins_dylib_path: PathBuf::from("/"),
host_dylib_path: None,
target_dylib_path: None,
}
self.compilation.plugins_dylib_path = self.host.deps().to_path_buf();
+ self.compilation.host_deps_output = self.host.deps().to_path_buf();
let layout = self.target.as_ref().unwrap_or(&self.host);
self.compilation.root_output = layout.dest().to_path_buf();
-> CargoResult<(Test, Vec<ProcessError>)> {
let mut errors = Vec::new();
let config = options.compile_opts.config;
- let host_deps = find_host_deps(options, compilation);
// We don't build/rust doctests if target != host
if config.rustc()?.host != compilation.target {
p.arg("--test").arg(lib)
.arg("--crate-name").arg(&crate_name);
- p.arg("-L").arg(&host_deps);
-
for &rust_dep in &[&compilation.deps_output] {
let mut arg = OsString::from("dependency=");
arg.push(rust_dep);
p.arg("-L").arg(arg);
}
+
for native_dep in compilation.native_dirs.iter() {
p.arg("-L").arg(native_dep);
}
+ for &host_rust_dep in &[&compilation.host_deps_output] {
+ let mut arg = OsString::from("dependency=");
+ arg.push(host_rust_dep);
+ p.arg("-L").arg(arg);
+ }
+
for arg in test_args {
p.arg("--test-args").arg(arg);
}
}
Ok((Test::Doc, errors))
}
-
-fn find_host_deps(options: &TestOptions, compilation: &Compilation) -> OsString {
- let build_type = if options.compile_opts.release { "release" } else { "debug" };
- let mut dir = compilation.root_output.clone();
-
- // first pop off the build_type
- dir.pop();
- // if we see the target next, pop it off
- let target: &OsStr = compilation.target.as_ref();
- if dir.file_name().unwrap() == target {
- dir.pop();
- }
- // push the build_type back on
- dir.push(build_type);
- // and we are looking for the deps directory
- dir.push("deps");
-
- let mut host_deps = OsString::from("dependency=");
- host_deps.push(dir);
- host_deps
-}
proc-macro = true
[dependencies]
- base64 = "^0.6"
+ dep_of_proc_macro_dep = "^0.1"
"#)
.file("proc_macro_dep/src/lib.rs", r#"
- extern crate base64;
+ extern crate dep_of_proc_macro_dep;
extern crate proc_macro;
use proc_macro::TokenStream;
"".parse().unwrap()
}
"#);
+ Package::new("dep_of_proc_macro_dep", "0.1.0").publish();
workspace.build();
assert_that(workspace.cargo("test").arg("--all").arg("--target").arg(rustc_host()),
execs().with_status(0));