{
log!(4, "normalizing toml targets; lib={}; bin={}", lib, bin);
- fn target_profiles(target: &TomlTarget) -> Vec<Profile> {
+ enum TestDep { Needed, NotNeeded }
+
+ fn target_profiles(target: &TomlTarget,
+ dep: Option<TestDep>) -> Vec<Profile> {
let mut ret = vec!(Profile::default_dev(), Profile::default_release());
match target.test {
Some(true) | None => ret.push(Profile::default_test()),
+ Some(false) => {}
+ }
+
+ match dep {
+ Some(Needed) => ret.push(Profile::default_test().test(false)),
_ => {}
- };
+ }
ret
}
- fn lib_targets(dst: &mut Vec<Target>, libs: &[TomlLibTarget], metadata: &Metadata) {
+ fn lib_targets(dst: &mut Vec<Target>, libs: &[TomlLibTarget],
+ dep: TestDep, metadata: &Metadata) {
let l = &libs[0];
let path = l.path.clone().unwrap_or_else(|| format!("src/{}.rs", l.name));
let crate_types = l.crate_type.clone().and_then(|kinds| {
LibKind::from_strs(kinds).ok()
}).unwrap_or_else(|| vec!(Lib));
- for profile in target_profiles(l).iter() {
+ for profile in target_profiles(l, Some(dep)).iter() {
dst.push(Target::lib_target(l.name.as_slice(), crate_types.clone(),
&Path::new(path.as_slice()), profile,
metadata));
for bin in bins.iter() {
let path = bin.path.clone().unwrap_or_else(|| default(bin));
- for profile in target_profiles(bin).iter() {
+ for profile in target_profiles(bin, None).iter() {
dst.push(Target::bin_target(bin.name.as_slice(),
&Path::new(path.as_slice()),
profile));
match (lib, bin) {
(Some(ref libs), Some(ref bins)) => {
- lib_targets(&mut ret, libs.as_slice(), metadata);
+ lib_targets(&mut ret, libs.as_slice(), Needed, metadata);
bin_targets(&mut ret, bins.as_slice(),
|bin| format!("src/bin/{}.rs", bin.name));
},
(Some(ref libs), None) => {
- lib_targets(&mut ret, libs.as_slice(), metadata);
+ lib_targets(&mut ret, libs.as_slice(), NotNeeded, metadata);
},
(None, Some(ref bins)) => {
bin_targets(&mut ret, bins.as_slice(),