7848: Bump cargo_metadata r=matklad a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
This commit is contained in:
bors[bot] 2021-03-02 12:31:15 +00:00 committed by GitHub
commit 8eee9149e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 47 additions and 37 deletions

26
Cargo.lock generated
View file

@ -111,6 +111,15 @@ version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b"
[[package]]
name = "camino"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9bb47ab72bdba43021afa16dc1ef4d80c980d366b17ed37ea8d2ebe2087075b9"
dependencies = [
"serde",
]
[[package]]
name = "cargo-platform"
version = "0.1.1"
@ -122,10 +131,11 @@ dependencies = [
[[package]]
name = "cargo_metadata"
version = "0.12.3"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7714a157da7991e23d90686b9524b9e12e0407a108647f52e9328f4b3d51ac7f"
checksum = "081e3f0755c1f380c2d010481b6fa2e02973586d5f2b24eebb7a2a1d98b143d8"
dependencies = [
"camino",
"cargo-platform",
"semver",
"semver-parser",
@ -779,9 +789,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.86"
version = "0.2.87"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7282d924be3275cec7f6756ff4121987bc6481325397dde6ba3e7802b1a8b1c"
checksum = "265d751d31d6780a3f956bb5b8022feba2d94eeee5a84ba64f4212eedca42213"
[[package]]
name = "libloading"
@ -1005,9 +1015,9 @@ checksum = "a9a7ab5d64814df0fe4a4b5ead45ed6c5f181ee3ff04ba344313a6c80446c5d4"
[[package]]
name = "once_cell"
version = "1.7.0"
version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10acf907b94fc1b1a152d08ef97e7759650268cf986bf127f387e602b02c7e5a"
checksum = "ea78b9742c52ac729753c1590e9adc5248ea9bdaf974597efd46c74cfaa5fb54"
[[package]]
name = "oorandom"
@ -1116,9 +1126,9 @@ dependencies = [
[[package]]
name = "pin-project-lite"
version = "0.2.4"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "439697af366c49a6d0a010c56a0d97685bc140ce0d377b13a2ea2aa42d64a827"
checksum = "0cf491442e4b033ed1c722cb9f0df5fcfcf4de682466c46469c36bc47dc5548a"
[[package]]
name = "proc-macro-hack"

View file

@ -12,7 +12,7 @@ doctest = false
[dependencies]
crossbeam-channel = "0.5.0"
log = "0.4.8"
cargo_metadata = "0.12.2"
cargo_metadata = "0.13"
serde_json = "1.0.48"
jod-thread = "0.1.1"

View file

@ -194,7 +194,7 @@ impl FlycheckActor {
cargo_metadata::Message::BuildScriptExecuted(_)
| cargo_metadata::Message::BuildFinished(_)
| cargo_metadata::Message::TextLine(_)
| cargo_metadata::Message::Unknown => {}
| _ => {}
},
}
}
@ -329,8 +329,7 @@ impl CargoActor {
// Skip certain kinds of messages to only spend time on what's useful
match &message {
cargo_metadata::Message::CompilerArtifact(artifact) if artifact.fresh => (),
cargo_metadata::Message::BuildScriptExecuted(_)
| cargo_metadata::Message::Unknown => (),
cargo_metadata::Message::BuildScriptExecuted(_) => (),
_ => self.sender.send(message).unwrap(),
}
}

View file

@ -20,7 +20,7 @@ proc_macro_api = { path = "../proc_macro_api", version = "0.0.0" }
test_utils = { path = "../test_utils", version = "0.0.0" }
[dev-dependencies]
cargo_metadata = "0.12.2"
cargo_metadata = "0.13"
# used as proc macro test targets
serde_derive = "1.0.106"

View file

@ -8,6 +8,7 @@ use test_utils::assert_eq_text;
mod fixtures {
use cargo_metadata::Message;
use std::path::PathBuf;
use std::process::Command;
// Use current project metadata to get the proc-macro dylib path
@ -24,7 +25,7 @@ mod fixtures {
if artifact.target.kind.contains(&"proc-macro".to_string()) {
let repr = format!("{} {}", crate_name, version);
if artifact.package_id.repr.starts_with(&repr) {
return artifact.filenames[0].clone();
return PathBuf::from(&artifact.filenames[0]);
}
}
}

View file

@ -12,7 +12,7 @@ doctest = false
[dependencies]
log = "0.4.8"
rustc-hash = "1.1.0"
cargo_metadata = "0.12.2"
cargo_metadata = "0.13"
serde = { version = "1.0.106", features = ["derive"] }
serde_json = "1.0.48"
anyhow = "1.0.26"

View file

@ -1,14 +1,14 @@
//! Handles build script specific information
use std::{
ffi::OsStr,
io::BufReader,
path::{Path, PathBuf},
path::PathBuf,
process::{Command, Stdio},
sync::Arc,
};
use anyhow::Result;
use cargo_metadata::camino::Utf8Path;
use cargo_metadata::{BuildScript, Message};
use itertools::Itertools;
use paths::{AbsPath, AbsPathBuf};
@ -162,8 +162,8 @@ fn collect_from_workspace(
let res = res.entry(package_id.repr.clone()).or_default();
// cargo_metadata crate returns default (empty) path for
// older cargos, which is not absolute, so work around that.
if out_dir != PathBuf::default() {
let out_dir = AbsPathBuf::assert(out_dir);
if !out_dir.as_str().is_empty() {
let out_dir = AbsPathBuf::assert(PathBuf::from(out_dir.into_os_string()));
res.out_dir = Some(out_dir);
res.cfgs = cfgs;
}
@ -178,7 +178,7 @@ fn collect_from_workspace(
// Skip rmeta file
if let Some(filename) = message.filenames.iter().find(|name| is_dylib(name))
{
let filename = AbsPathBuf::assert(filename.clone());
let filename = AbsPathBuf::assert(PathBuf::from(&filename));
let res = res.entry(package_id.repr.clone()).or_default();
res.proc_macro_dylib_path = Some(filename);
}
@ -187,9 +187,9 @@ fn collect_from_workspace(
Message::CompilerMessage(message) => {
progress(message.target.name.clone());
}
Message::Unknown => (),
Message::BuildFinished(_) => {}
Message::TextLine(_) => {}
_ => {}
}
}
}
@ -209,8 +209,8 @@ fn collect_from_workspace(
}
// FIXME: File a better way to know if it is a dylib
fn is_dylib(path: &Path) -> bool {
match path.extension().and_then(OsStr::to_str).map(|it| it.to_string().to_lowercase()) {
fn is_dylib(path: &Utf8Path) -> bool {
match path.extension().map(|e| e.to_string().to_lowercase()) {
None => false,
Some(ext) => matches!(ext.as_str(), "dll" | "dylib" | "so"),
}
@ -227,9 +227,7 @@ fn inject_cargo_env(package: &cargo_metadata::Package, build_data: &mut BuildDat
let mut manifest_dir = package.manifest_path.clone();
manifest_dir.pop();
if let Some(cargo_manifest_dir) = manifest_dir.to_str() {
env.push(("CARGO_MANIFEST_DIR".into(), cargo_manifest_dir.into()));
}
env.push(("CARGO_MANIFEST_DIR".into(), manifest_dir.into_string()));
// Not always right, but works for common cases.
env.push(("CARGO".into(), "cargo".into()));
@ -251,7 +249,6 @@ fn inject_cargo_env(package: &cargo_metadata::Package, build_data: &mut BuildDat
env.push(("CARGO_PKG_REPOSITORY".into(), package.repository.clone().unwrap_or_default()));
env.push(("CARGO_PKG_LICENSE".into(), package.license.clone().unwrap_or_default()));
let license_file =
package.license_file.as_ref().map(|buf| buf.display().to_string()).unwrap_or_default();
let license_file = package.license_file.as_ref().map(|buf| buf.to_string()).unwrap_or_default();
env.push(("CARGO_PKG_LICENSE_FILE".into(), license_file));
}

View file

@ -1,5 +1,6 @@
//! FIXME: write short doc here
use std::path::PathBuf;
use std::{convert::TryInto, ops, process::Command, sync::Arc};
use anyhow::{Context, Result};
@ -249,11 +250,12 @@ impl CargoWorkspace {
let edition = edition
.parse::<Edition>()
.with_context(|| format!("Failed to parse edition {}", edition))?;
let pkg = packages.alloc(PackageData {
id: id.repr.clone(),
name: name.clone(),
version: version.to_string(),
manifest: AbsPathBuf::assert(manifest_path.clone()),
manifest: AbsPathBuf::assert(PathBuf::from(&manifest_path)),
targets: Vec::new(),
is_member,
edition,
@ -268,7 +270,7 @@ impl CargoWorkspace {
let tgt = targets.alloc(TargetData {
package: pkg,
name: meta_tgt.name.clone(),
root: AbsPathBuf::assert(meta_tgt.src_path.clone()),
root: AbsPathBuf::assert(PathBuf::from(&meta_tgt.src_path)),
kind: TargetKind::new(meta_tgt.kind.as_slice()),
is_proc_macro,
});
@ -305,7 +307,8 @@ impl CargoWorkspace {
packages[source].active_features.extend(node.features);
}
let workspace_root = AbsPathBuf::assert(meta.workspace_root);
let workspace_root =
AbsPathBuf::assert(PathBuf::from(meta.workspace_root.into_os_string()));
let build_data_config = BuildDataConfig::new(
cargo_toml.to_path_buf(),
config.clone(),

View file

@ -29,7 +29,7 @@ fn diagnostic_severity(
},
DiagnosticLevel::Note => lsp_types::DiagnosticSeverity::Information,
DiagnosticLevel::Help => lsp_types::DiagnosticSeverity::Hint,
DiagnosticLevel::Unknown => return None,
_ => return None,
};
Some(res)
}