mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
Check for the existence of Cargo.toml when reading packages.
Fixes #82.
This commit is contained in:
parent
97d1d358af
commit
c0865e85e3
@ -1,7 +1,7 @@
|
||||
use std::io::File;
|
||||
use util;
|
||||
use core::{Package,Manifest,SourceId};
|
||||
use util::{CargoResult, human};
|
||||
use util::{CargoResult, human, important_paths};
|
||||
|
||||
pub fn read_manifest(contents: &[u8], source_id: &SourceId)
|
||||
-> CargoResult<(Manifest, Vec<Path>)>
|
||||
@ -24,7 +24,8 @@ pub fn read_package(path: &Path, source_id: &SourceId)
|
||||
pub fn read_packages(path: &Path, source_id: &SourceId)
|
||||
-> CargoResult<Vec<Package>>
|
||||
{
|
||||
let (pkg, nested) = try!(read_package(&path.join("Cargo.toml"), source_id));
|
||||
let manifest = try!(important_paths::find_project_manifest_exact(path, "Cargo.toml"));
|
||||
let (pkg, nested) = try!(read_package(&manifest, source_id));
|
||||
let mut ret = vec!(pkg);
|
||||
|
||||
for p in nested.iter() {
|
||||
|
@ -354,3 +354,26 @@ test!(nested_deps_recompile {
|
||||
FRESH, bar.display(),
|
||||
COMPILING, p.root().display())));
|
||||
})
|
||||
|
||||
test!(error_message_for_missing_manifest {
|
||||
let p = project("foo")
|
||||
.file("Cargo.toml", r#"
|
||||
[project]
|
||||
|
||||
name = "foo"
|
||||
version = "0.5.0"
|
||||
authors = ["wycats@example.com"]
|
||||
|
||||
[dependencies.bar]
|
||||
|
||||
path = "src/bar"
|
||||
"#)
|
||||
.file("src/bar/not-a-manifest", "");
|
||||
|
||||
assert_that(p.cargo_process("cargo-build"),
|
||||
execs()
|
||||
.with_status(101)
|
||||
.with_stderr(format!("Could not find `Cargo.toml` in `{}`\n",
|
||||
p.root().join_many(&["src", "bar"]).display())));
|
||||
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user