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::{ 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}; use xtask::{exec, AYA_BUILD_INTEGRATION_BPF, LIBBPF_DIR};
@ -281,7 +281,7 @@ fn main() {
let Package { targets, .. } = integration_ebpf_package; let Package { targets, .. } = integration_ebpf_package;
for Target { name, kind, .. } in targets { for Target { name, kind, .. } in targets {
if *kind != ["bin"] { if *kind != [TargetKind::Bin] {
continue; continue;
} }
let dst = out_dir.join(name); 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()) { if matches!(publish, Some(publish) if publish.is_empty()) {
Ok(()) Ok(())
} else { } else {
let target = target.as_ref().and_then(|target| { let target = (!targets.iter().any(Target::is_proc_macro))
let proc_macro = targets.iter().any(|Target { kind, .. }| { .then(|| target.clone())
kind.iter().any(|kind| kind == "proc-macro") .flatten();
});
(!proc_macro).then_some(target)
});
let diff = check_package_api( let diff = check_package_api(
&name, &name,
toolchain, toolchain,
target.cloned(), target,
bless, bless,
workspace_root.as_std_path(), workspace_root.as_std_path(),
) )

Loading…
Cancel
Save