Use TargetKind enum and Target::is_proc_macro

These are added in cargo_metadata 0.19.0.
reviewable/pr1095/r2
Tamir Duberstein 2 months ago
parent ea139050cf
commit 5ab67dce08
No known key found for this signature in database

@ -8,7 +8,7 @@ use std::{
};
use cargo_metadata::{
Artifact, CompilerMessage, Message, Metadata, MetadataCommand, Package, Target,
Artifact, CompilerMessage, Message, Metadata, MetadataCommand, Package, Target, TargetKind,
};
use xtask::{exec, AYA_BUILD_INTEGRATION_BPF, LIBBPF_DIR};
@ -281,7 +281,7 @@ fn main() {
let Package { targets, .. } = integration_ebpf_package;
for Target { name, kind, .. } in targets {
if *kind != ["bin"] {
if *kind != [TargetKind::Bin] {
continue;
}
let dst = out_dir.join(name);

@ -56,16 +56,13 @@ pub fn public_api(options: Options, metadata: Metadata) -> Result<()> {
if matches!(publish, Some(publish) if publish.is_empty()) {
Ok(())
} else {
let target = target.as_ref().and_then(|target| {
let proc_macro = targets.iter().any(|Target { kind, .. }| {
kind.iter().any(|kind| kind == "proc-macro")
});
(!proc_macro).then_some(target)
});
let target = (!targets.iter().any(Target::is_proc_macro))
.then(|| target.clone())
.flatten();
let diff = check_package_api(
&name,
toolchain,
target.cloned(),
target,
bless,
workspace_root.as_std_path(),
)

Loading…
Cancel
Save