Skip to content

Commit

Permalink
Fix tests and have rustpkg inject pkgid instead of link meta.
Browse files Browse the repository at this point in the history
  • Loading branch information
metajack committed Nov 25, 2013
1 parent 7408c14 commit 003c35e
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 83 deletions.
25 changes: 9 additions & 16 deletions src/librustpkg/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,23 +290,16 @@ pub fn compile_input(context: &BuildContext,
addl_lib_search_paths.insert(p);
});

// Inject the link attributes so we get the right package name and version
if attr::find_linkage_metas(crate.attrs).is_empty() {
let name_to_use = match what {
Test => format!("{}test", pkg_id.short_name).to_managed(),
Bench => format!("{}bench", pkg_id.short_name).to_managed(),
_ => pkg_id.short_name.to_managed()
};
debug!("Injecting link name: {}", name_to_use);
// Inject the pkgid attribute so we get the right package name and version

if !attr::contains_name(crate.attrs, "pkgid") {
// FIXME (#9639): This needs to handle non-utf8 paths
let link_options =
~[attr::mk_name_value_item_str(@"name", name_to_use),
attr::mk_name_value_item_str(@"vers", pkg_id.version.to_str().to_managed())] +
~[attr::mk_name_value_item_str(@"package_id",
pkg_id.path.as_str().unwrap().to_managed())];

debug!("link options: {:?}", link_options);
crate.attrs = ~[attr::mk_attr(attr::mk_list_item(@"link", link_options))];
let pkgid_attr =
attr::mk_name_value_item_str(@"pkgid",
pkg_id.path.as_str().unwrap().to_managed());

debug!("pkgid attr: {:?}", pkgid_attr);
crate.attrs = ~[attr::mk_attr(pkgid_attr)];
}

debug!("calling compile_crate_from_input, workspace = {},
Expand Down
17 changes: 0 additions & 17 deletions src/test/compile-fail/dup-link-name.rs

This file was deleted.

25 changes: 0 additions & 25 deletions src/test/run-pass/crateresolve6.rs

This file was deleted.

22 changes: 0 additions & 22 deletions src/test/run-pass/crateresolve7.rs

This file was deleted.

2 changes: 1 addition & 1 deletion src/test/run-pass/crateresolve8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#[pkgid="crateresolve8#0.1"];

extern mod crateresolve8(vers = "0.1", package_id="crateresolve8");
extern mod crateresolve8(vers = "0.1", package_id="crateresolve8#0.1");
//extern mod crateresolve8(vers = "0.1");

pub fn main() {
Expand Down
4 changes: 2 additions & 2 deletions src/test/run-pass/issue-6919.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

#[pkgid="issue-6919"];

extern mod iss ( name = "iss6919_3" );
extern mod issue6919_3;

pub fn main() {
iss::D.k;
issue6919_3::D.k;
}

0 comments on commit 003c35e

Please sign in to comment.