Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/cargo/ops/cargo_read_manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,15 @@ fn read_nested_packages(path: &Path,
visited: &mut HashSet<PathBuf>) -> CargoResult<()> {
if !visited.insert(path.to_path_buf()) { return Ok(()) }

let manifest = try!(find_project_manifest_exact(path, "Cargo.toml"));
let manifest_path = try!(find_project_manifest_exact(path, "Cargo.toml"));

let (manifest, nested) = try!(read_manifest(&manifest_path, source_id, config));
let manifest = match manifest {
EitherManifest::Real(manifest) => manifest,
EitherManifest::Virtual(..) => return Ok(()),
};
let pkg = Package::new(manifest, &manifest_path);

let (pkg, nested) = try!(read_package(&manifest, source_id, config));
let pkg_id = pkg.package_id().clone();
if !all_packages.contains_key(&pkg_id) {
all_packages.insert(pkg_id, pkg);
Expand Down
35 changes: 34 additions & 1 deletion tests/workspaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::io::{Read, Write};
use std::fs::File;

use cargotest::sleep_ms;
use cargotest::support::{project, execs};
use cargotest::support::{project, execs, git};
use cargotest::support::registry::Package;
use hamcrest::{assert_that, existing_file, existing_dir, is_not};

Expand Down Expand Up @@ -877,3 +877,36 @@ fn rebuild_please() {
assert_that(p.cargo("run").cwd(p.root().join("bin")),
execs().with_status(101));
}

#[test]
fn workspace_in_git() {
let git_project = git::new("dep1", |project| {
project
.file("Cargo.toml", r#"
[workspace]
members = ["foo"]
"#)
.file("foo/Cargo.toml", r#"
[package]
name = "foo"
version = "0.1.0"
"#)
.file("foo/src/lib.rs", "")
}).unwrap();
let p = project("foo")
.file("Cargo.toml", &format!(r#"
[package]
name = "lib"
version = "0.1.0"

[dependencies.foo]
git = '{}'
"#, git_project.url()))
.file("src/lib.rs", r#"
pub fn foo() -> u32 { 0 }
"#);
p.build();

assert_that(p.cargo("build"),
execs().with_status(0));
}