You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
889 B
Rust
27 lines
889 B
Rust
use anyhow::{Context as _, anyhow};
|
|
use aya_build::Toolchain;
|
|
|
|
fn main() -> anyhow::Result<()> {
|
|
let cargo_metadata::Metadata { packages, .. } = cargo_metadata::MetadataCommand::new()
|
|
.no_deps()
|
|
.exec()
|
|
.context("MetadataCommand::exec")?;
|
|
let ebpf_package = packages
|
|
.into_iter()
|
|
.find(|cargo_metadata::Package { name, .. }| name.as_str() == "{{project-name}}-ebpf")
|
|
.ok_or_else(|| anyhow!("{{project-name}}-ebpf package not found"))?;
|
|
let cargo_metadata::Package {
|
|
name,
|
|
manifest_path,
|
|
..
|
|
} = ebpf_package;
|
|
let ebpf_package = aya_build::Package {
|
|
name: name.as_str(),
|
|
root_dir: manifest_path
|
|
.parent()
|
|
.ok_or_else(|| anyhow!("no parent for {manifest_path}"))?
|
|
.as_str(),
|
|
};
|
|
aya_build::build_ebpf([ebpf_package], Toolchain::default())
|
|
}
|