mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 11:44:28 +00:00
Add default 'package_id' link meta for crates (with value equal to 'name')
This commit is contained in:
parent
a594a999fb
commit
ffcbd8d767
@ -634,6 +634,26 @@ pub fn build_link_meta(sess: Session,
|
||||
}
|
||||
}
|
||||
|
||||
fn crate_meta_pkgid(sess: Session, output: &Path, opt_pkg_id: Option<@str>)
|
||||
-> @str {
|
||||
match opt_pkg_id {
|
||||
Some(v) if !v.is_empty() => v,
|
||||
_ => {
|
||||
let pkg_id = session::expect(sess,
|
||||
output.filestem_str(),
|
||||
|| format!("output file name `{}` doesn't\
|
||||
appear to have a stem",
|
||||
output.display())).to_managed();
|
||||
if pkg_id.is_empty() {
|
||||
sess.fatal("missing crate link meta `package_id`, and the \
|
||||
inferred name is blank");
|
||||
}
|
||||
warn_missing(sess, "package_id", pkg_id);
|
||||
pkg_id
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let ProvidedMetas {
|
||||
name: opt_name,
|
||||
vers: opt_vers,
|
||||
@ -642,15 +662,16 @@ pub fn build_link_meta(sess: Session,
|
||||
} = provided_link_metas(sess, c);
|
||||
let name = crate_meta_name(sess, output, opt_name);
|
||||
let vers = crate_meta_vers(sess, opt_vers);
|
||||
let pkg_id = crate_meta_pkgid(sess, output, opt_pkg_id);
|
||||
let dep_hashes = cstore::get_dep_hashes(sess.cstore);
|
||||
let extras_hash =
|
||||
crate_meta_extras_hash(symbol_hasher, cmh_items,
|
||||
dep_hashes, opt_pkg_id);
|
||||
dep_hashes, Some(pkg_id));
|
||||
|
||||
LinkMeta {
|
||||
name: name,
|
||||
vers: vers,
|
||||
package_id: opt_pkg_id,
|
||||
package_id: Some(pkg_id),
|
||||
extras_hash: extras_hash
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user