Ok(ws)
}
- pub fn current_manifest(&self) -> &Path {
- &self.current_manifest
- }
-
/// Creates a "temporary workspace" from one package which only contains
/// that package.
///
.collect()
}
};
- Ok(specs)
+ if specs.is_empty() {
+ bail!("Workspace contains no members to be compiled. \
+ Be sure all workspace members haven't been excluded")
+ } else {
+ Ok(specs)
+ }
}
}
&specs)?;
let (packages, resolve_with_overrides) = resolve;
- if specs.is_empty() {
- bail!("manifest path `{}` contains no package: The manifest is virtual, \
- and the workspace has no members.",
- ws.current_manifest().display())
- }
-
let to_builds = specs.iter().map(|p| {
let pkgid = p.query(resolve_with_overrides.iter())?;
let p = packages.get(pkgid)?;
&specs)?;
let (packages, resolve_with_overrides) = resolve;
- if specs.is_empty() {
- bail!("manifest path `{}` contains no package: The manifest is virtual, \
- and the workspace has no members.",
- ws.current_manifest().display())
- };
-
let pkgs = specs.iter().map(|p| {
let pkgid = p.query(resolve_with_overrides.iter())?;
packages.get(pkgid)
.with_status(0));
}
+#[test]
+fn cargo_compile_with_workspace_excluded() {
+ let p = project("foo")
+ .file("Cargo.toml", r#"
+ [package]
+ name = "foo"
+ version = "0.1.0"
+ authors = []
+ "#)
+ .file("src/main.rs", "fn main() {}")
+ .build();
+
+ assert_that(
+ p.cargo("build").arg("--all").arg("--exclude").arg("foo"),
+ execs().with_stderr_does_not_contain("[..]virtual[..]")
+ .with_status(101));
+}
+
#[test]
fn cargo_compile_manifest_path() {
let p = project("foo")