Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lift up workspace rlibs while building #3478

Merged
merged 1 commit into from
Jan 12, 2017
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
5 changes: 3 additions & 2 deletions src/cargo/ops/cargo_rustc/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {

map.insert(crate_type.to_string(), Some((prefix.to_string(), suffix.to_string())));
}

let cfg = if has_cfg {
Some(try!(lines.map(Cfg::from_str).collect()))
} else {
Expand Down Expand Up @@ -448,7 +448,8 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
// we don't want to link it up.
if src_dir.ends_with("deps") {
// Don't lift up library dependencies
if self.ws.members().find(|&p| p != unit.pkg).is_some() && !unit.target.is_bin() {
if self.ws.members().find(|&p| p == unit.pkg).is_none() &&
!unit.target.is_bin() {
None
} else {
Some((
Expand Down
31 changes: 31 additions & 0 deletions tests/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -979,3 +979,34 @@ location searched: [..]
version required: *
"));
}

#[test]
fn workspace_produces_rlib() {
let p = project("foo")
.file("Cargo.toml", r#"
[project]
name = "top"
version = "0.5.0"
authors = []

[workspace]

[dependencies]
foo = { path = "foo" }
"#)
.file("src/lib.rs", "")
.file("foo/Cargo.toml", r#"
[project]
name = "foo"
version = "0.5.0"
authors = []
"#)
.file("foo/src/lib.rs", "");
p.build();

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

assert_that(&p.root().join("target/debug/libtop.rlib"), existing_file());
assert_that(&p.root().join("target/debug/libfoo.rlib"), existing_file());

}