mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
Extra log output + polish rough edges
This commit is contained in:
parent
93558906d8
commit
c040b89141
@ -165,7 +165,7 @@ impl Target {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
type TomlLibTarget = TomlTarget;
|
type TomlLibTarget = TomlTarget;
|
||||||
type TomlExecTarget = TomlTarget;
|
type TomlBinTarget = TomlTarget;
|
||||||
|
|
||||||
#[deriving(Decodable,Encodable,Eq,Clone,Show)]
|
#[deriving(Decodable,Encodable,Eq,Clone,Show)]
|
||||||
pub struct Project {
|
pub struct Project {
|
||||||
@ -182,8 +182,8 @@ pub struct Project {
|
|||||||
pub struct TomlManifest {
|
pub struct TomlManifest {
|
||||||
project: Box<Project>,
|
project: Box<Project>,
|
||||||
lib: Option<~[TomlLibTarget]>,
|
lib: Option<~[TomlLibTarget]>,
|
||||||
bin: Option<~[TomlExecTarget]>,
|
bin: Option<~[TomlBinTarget]>,
|
||||||
dependencies: Option<HashMap<String, String>>
|
dependencies: Option<HashMap<String, String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TomlManifest {
|
impl TomlManifest {
|
||||||
@ -228,20 +228,22 @@ impl Project {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Decodable,Encodable,Eq,Clone)]
|
#[deriving(Decodable,Encodable,Eq,Clone,Show)]
|
||||||
struct TomlTarget {
|
struct TomlTarget {
|
||||||
name: String,
|
name: String,
|
||||||
path: Option<String>
|
path: Option<String>
|
||||||
}
|
}
|
||||||
|
|
||||||
fn normalize(lib: &Option<~[TomlLibTarget]>, bin: &Option<~[TomlExecTarget]>) -> Vec<Target> {
|
fn normalize(lib: &Option<~[TomlLibTarget]>, bin: &Option<~[TomlBinTarget]>) -> Vec<Target> {
|
||||||
|
log!(4, "normalizing toml targets; lib={}; bin={}", lib, bin);
|
||||||
|
|
||||||
fn lib_targets(dst: &mut Vec<Target>, libs: &[TomlLibTarget]) {
|
fn lib_targets(dst: &mut Vec<Target>, libs: &[TomlLibTarget]) {
|
||||||
let l = &libs[0];
|
let l = &libs[0];
|
||||||
let path = l.path.clone().unwrap_or_else(|| format!("src/{}.rs", l.name));
|
let path = l.path.clone().unwrap_or_else(|| format!("src/{}.rs", l.name));
|
||||||
dst.push(Target::lib_target(l.name.as_slice(), &Path::new(path)));
|
dst.push(Target::lib_target(l.name.as_slice(), &Path::new(path)));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn bin_targets(dst: &mut Vec<Target>, bins: &[TomlExecTarget], default: |&TomlExecTarget| -> String) {
|
fn bin_targets(dst: &mut Vec<Target>, bins: &[TomlBinTarget], default: |&TomlBinTarget| -> String) {
|
||||||
for bin in bins.iter() {
|
for bin in bins.iter() {
|
||||||
let path = bin.path.clone().unwrap_or_else(|| default(bin));
|
let path = bin.path.clone().unwrap_or_else(|| default(bin));
|
||||||
dst.push(Target::bin_target(bin.name.as_slice(), &Path::new(path)));
|
dst.push(Target::bin_target(bin.name.as_slice(), &Path::new(path)));
|
||||||
|
@ -26,7 +26,7 @@ pub fn resolve(deps: &[Dependency], registry: &Registry) -> CargoResult<Vec<Name
|
|||||||
|
|
||||||
let opts = registry.query(curr.get_name());
|
let opts = registry.query(curr.get_name());
|
||||||
|
|
||||||
//assert!(!resolve.contains_key_equiv(&curr.get_name()), "already traversed {}", curr.get_name());
|
assert!(opts.len() > 0, "no matches for {}", curr.get_name());
|
||||||
// Temporary, but we must have exactly one option to satisfy the dep
|
// Temporary, but we must have exactly one option to satisfy the dep
|
||||||
assert!(opts.len() == 1, "invalid num of results {}", opts.len());
|
assert!(opts.len() == 1, "invalid num of results {}", opts.len());
|
||||||
|
|
||||||
|
@ -23,5 +23,6 @@ fn load_toml(root: toml::Value) -> CargoResult<TomlManifest> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn to_cargo_err(err: toml::Error) -> CargoError {
|
fn to_cargo_err(err: toml::Error) -> CargoError {
|
||||||
|
debug!("toml; err={}", err);
|
||||||
toml_error("Problem loading manifest", err)
|
toml_error("Problem loading manifest", err)
|
||||||
}
|
}
|
||||||
|
@ -71,6 +71,7 @@ fn prepare_rustc(root: &Path, target: &core::Target, dest: &Path, deps: &[core::
|
|||||||
util::process("rustc")
|
util::process("rustc")
|
||||||
.cwd(root.clone())
|
.cwd(root.clone())
|
||||||
.args(args.as_slice())
|
.args(args.as_slice())
|
||||||
|
.env("RUST_LOG", None) // rustc is way too noisy
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_base_args(into: &mut Args, target: &core::Target, dest: &Path) {
|
fn build_base_args(into: &mut Args, target: &core::Target, dest: &Path) {
|
||||||
|
@ -11,6 +11,7 @@ pub struct PathSource {
|
|||||||
|
|
||||||
impl PathSource {
|
impl PathSource {
|
||||||
pub fn new(paths: Vec<Path>) -> PathSource {
|
pub fn new(paths: Vec<Path>) -> PathSource {
|
||||||
|
log!(4, "new; paths={}", display(paths.as_slice()));
|
||||||
PathSource { paths: paths }
|
PathSource { paths: paths }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -28,7 +29,10 @@ impl Source for PathSource {
|
|||||||
Ok(self.paths.iter().filter_map(|path| {
|
Ok(self.paths.iter().filter_map(|path| {
|
||||||
match read_manifest(path) {
|
match read_manifest(path) {
|
||||||
Ok(ref pkg) => Some(pkg.get_summary().clone()),
|
Ok(ref pkg) => Some(pkg.get_summary().clone()),
|
||||||
Err(_) => None
|
Err(e) => {
|
||||||
|
log!(4, "failed to read manifest; path={}; err={}", path.display(), e);
|
||||||
|
None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}).collect())
|
}).collect())
|
||||||
}
|
}
|
||||||
@ -51,3 +55,7 @@ fn read_manifest(path: &Path) -> CargoResult<Package> {
|
|||||||
let joined = path.join("Cargo.toml");
|
let joined = path.join("Cargo.toml");
|
||||||
ops::read_manifest(joined.as_str().unwrap())
|
ops::read_manifest(joined.as_str().unwrap())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn display(paths: &[Path]) -> Vec<String> {
|
||||||
|
paths.iter().map(|p| p.display().to_str()).collect()
|
||||||
|
}
|
||||||
|
@ -51,6 +51,19 @@ impl ProcessBuilder {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn env(mut self, key: &str, val: Option<&str>) -> ProcessBuilder {
|
||||||
|
match val {
|
||||||
|
Some(v) => {
|
||||||
|
self.env.insert(key.to_strbuf(), v.to_strbuf());
|
||||||
|
},
|
||||||
|
None => {
|
||||||
|
self.env.remove(&key.to_strbuf());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: should InheritFd be hardcoded?
|
// TODO: should InheritFd be hardcoded?
|
||||||
pub fn exec(&self) -> CargoResult<()> {
|
pub fn exec(&self) -> CargoResult<()> {
|
||||||
let mut command = self.build_command();
|
let mut command = self.build_command();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user