|
24 | 24 |
|
25 | 25 | use std::collections::{HashMap, HashSet};
|
26 | 26 | use std::default::Default;
|
27 |
| -use std::path::PathBuf; |
| 27 | +use std::path::{Path, PathBuf}; |
28 | 28 | use std::sync::Arc;
|
29 | 29 |
|
30 | 30 | use core::{Package, Source, Target};
|
31 | 31 | use core::{PackageId, PackageIdSpec, Profile, Profiles, TargetKind, Workspace};
|
32 | 32 | use core::resolver::{Method, Resolve};
|
33 | 33 | use ops::{self, BuildOutput, DefaultExecutor, Executor};
|
34 | 34 | use util::config::Config;
|
35 |
| -use util::{profile, CargoResult}; |
| 35 | +use util::{profile, CargoResult, CargoResultExt}; |
36 | 36 |
|
37 | 37 | /// Contains information about how a package should be compiled.
|
38 | 38 | #[derive(Debug)]
|
@@ -235,7 +235,17 @@ pub fn compile_ws<'a>(
|
235 | 235 | ref target_rustc_args,
|
236 | 236 | } = *options;
|
237 | 237 |
|
238 |
| - let target = target.clone(); |
| 238 | + let target = match target { |
| 239 | + &Some(ref target) if target.ends_with(".json") => { |
| 240 | + let path = Path::new(target) |
| 241 | + .canonicalize() |
| 242 | + .chain_err(|| format_err!("Target path {:?} is not a valid file", target))?; |
| 243 | + Some(path.into_os_string() |
| 244 | + .into_string() |
| 245 | + .map_err(|_| format_err!("Target path is not valid unicode"))?) |
| 246 | + } |
| 247 | + other => other.clone(), |
| 248 | + }; |
239 | 249 |
|
240 | 250 | if jobs == Some(0) {
|
241 | 251 | bail!("jobs must be at least 1")
|
|
0 commit comments