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
2 changes: 1 addition & 1 deletion src/cargo/ops/cargo_rustc/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
///
/// If `plugin` is true, the pair corresponds to the host platform,
/// otherwise it corresponds to the target platform.
fn staticlib(&self, kind: Kind) -> CargoResult<(&str, &str)> {
pub fn staticlib(&self, kind: Kind) -> CargoResult<(&str, &str)> {
let (triple, pair) = if kind == Kind::Host {
(&self.config.rustc_info().host, &self.host_staticlib)
} else {
Expand Down
6 changes: 5 additions & 1 deletion src/cargo/ops/cargo_rustc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,11 @@ fn build_deps_args(cmd: &mut CommandPrototype, cx: &Context, unit: &Unit)
let layout = cx.layout(unit.pkg, unit.kind);

for filename in try!(cx.target_filenames(unit)) {
if filename.ends_with(".a") { continue }
if let Ok((prefix, suffix)) = cx.staticlib(unit.kind) {
if filename.starts_with(prefix) && filename.ends_with(suffix) {
continue
}
}
let mut v = OsString::new();
v.push(&unit.target.crate_name());
v.push("=");
Expand Down
2 changes: 1 addition & 1 deletion src/rustversion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2015-11-30
2016-01-25
3 changes: 1 addition & 2 deletions tests/test_cargo_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1738,13 +1738,12 @@ test!(predictable_filenames {

[lib]
name = "foo"
crate-type = ["staticlib", "dylib", "rlib"]
crate-type = ["dylib", "rlib"]
"#)
.file("src/lib.rs", "");

assert_that(p.cargo_process("build").arg("-v"),
execs().with_status(0));
assert_that(&p.root().join("target/debug/libfoo.a"), existing_file());
assert_that(&p.root().join("target/debug/libfoo.rlib"), existing_file());
let dylib_name = format!("{}foo{}", env::consts::DLL_PREFIX,
env::consts::DLL_SUFFIX);
Expand Down
3 changes: 2 additions & 1 deletion tests/test_cargo_compile_custom_build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,8 @@ test!(build_script_with_dynamic_native_dependency {
"#)
.file("bar/src/lib.rs", r#"
pub fn bar() {
#[link(name = "builder")]
#[cfg_attr(not(target_env = "msvc"), link(name = "builder"))]
#[cfg_attr(target_env = "msvc", link(name = "builder.dll"))]
extern { fn foo(); }
unsafe { foo() }
}
Expand Down
15 changes: 8 additions & 7 deletions tests/test_cargo_compile_plugins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,20 +152,21 @@ test!(plugin_with_dynamic_native_dependency {
.display());
}
"#)
.file("bar/src/lib.rs", &format!(r#"
.file("bar/src/lib.rs", r#"
#![feature(plugin_registrar, rustc_private)]
extern crate rustc_plugin;

use rustc_plugin::Registry;

#[link(name = "{}")]
extern {{ fn foo(); }}
#[cfg_attr(not(target_env = "msvc"), link(name = "builder"))]
#[cfg_attr(target_env = "msvc", link(name = "builder.dll"))]
extern { fn foo(); }

#[plugin_registrar]
pub fn bar(_reg: &mut Registry) {{
unsafe {{ foo() }}
}}
"#, libname));
pub fn bar(_reg: &mut Registry) {
unsafe { foo() }
}
"#);

assert_that(foo.cargo_process("build").env("SRC", &lib).arg("-v"),
execs().with_status(0));
Expand Down