diff --git a/aya-tool/Cargo.toml b/aya-tool/Cargo.toml index 80f2d6a0..f1378e6f 100644 --- a/aya-tool/Cargo.toml +++ b/aya-tool/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] bindgen = "0.63" -clap = { version = "3", features = ["derive"] } +clap = { version = "4", features = ["derive"] } anyhow = "1" thiserror = "1" tempfile = "3" diff --git a/test/integration-test/Cargo.toml b/test/integration-test/Cargo.toml index f365aac0..94c05cf1 100644 --- a/test/integration-test/Cargo.toml +++ b/test/integration-test/Cargo.toml @@ -7,7 +7,7 @@ publish = false [dependencies] anyhow = "1" aya = { path = "../../aya" } -clap = { version = "3", features = ["derive"] } +clap = { version = "4", features = ["derive"] } env_logger = "0.10" inventory = "0.2" integration-test-macros = { path = "../integration-test-macros" } diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index c241fe1d..f20827f6 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] aya-tool = { path = "../aya-tool" } -clap = { version = "3", features = ["derive"] } +clap = { version = "4", features = ["derive"] } anyhow = "1" syn = "1" quote = "1" diff --git a/xtask/src/build_ebpf.rs b/xtask/src/build_ebpf.rs index 9b9e56d5..efbc4f29 100644 --- a/xtask/src/build_ebpf.rs +++ b/xtask/src/build_ebpf.rs @@ -37,7 +37,7 @@ impl std::fmt::Display for Architecture { } #[derive(Debug, Parser)] -pub struct Options { +pub struct BuildEbpfOptions { /// Set the endianness of the BPF target #[clap(default_value = "bpfel-unknown-none", long)] pub target: Architecture, @@ -49,12 +49,12 @@ pub struct Options { pub libbpf_dir: PathBuf, } -pub fn build_ebpf(opts: Options) -> anyhow::Result<()> { +pub fn build_ebpf(opts: BuildEbpfOptions) -> anyhow::Result<()> { build_rust_ebpf(&opts)?; build_c_ebpf(&opts) } -fn build_rust_ebpf(opts: &Options) -> anyhow::Result<()> { +fn build_rust_ebpf(opts: &BuildEbpfOptions) -> anyhow::Result<()> { let mut dir = PathBuf::from(WORKSPACE_ROOT.to_string()); dir.push("test/integration-ebpf"); @@ -92,7 +92,7 @@ fn get_libbpf_headers>(libbpf_dir: P, include_path: P) -> anyhow: Ok(()) } -fn build_c_ebpf(opts: &Options) -> anyhow::Result<()> { +fn build_c_ebpf(opts: &BuildEbpfOptions) -> anyhow::Result<()> { let mut src = PathBuf::from(WORKSPACE_ROOT.to_string()); src.push("test/integration-ebpf/src/bpf"); diff --git a/xtask/src/build_test.rs b/xtask/src/build_test.rs index f2cf91b1..5d727ac0 100644 --- a/xtask/src/build_test.rs +++ b/xtask/src/build_test.rs @@ -10,7 +10,7 @@ pub struct Options { pub musl: bool, #[clap(flatten)] - pub ebpf_options: build_ebpf::Options, + pub ebpf_options: build_ebpf::BuildEbpfOptions, } pub fn build_test(opts: Options) -> anyhow::Result<()> { diff --git a/xtask/src/codegen/mod.rs b/xtask/src/codegen/mod.rs index 04157311..ab3fa96f 100644 --- a/xtask/src/codegen/mod.rs +++ b/xtask/src/codegen/mod.rs @@ -54,32 +54,32 @@ impl std::fmt::Display for Architecture { #[derive(Parser)] pub struct Options { - #[clap(long, action)] + #[arg(long, action)] libbpf_dir: PathBuf, // sysroot options. Default to ubuntu headers installed by the // libc6-dev-{arm64,armel}-cross packages. - #[clap(long, default_value = "/usr/include/x86_64-linux-gnu", action)] + #[arg(long, default_value = "/usr/include/x86_64-linux-gnu", action)] x86_64_sysroot: PathBuf, - #[clap(long, default_value = "/usr/aarch64-linux-gnu/include", action)] + #[arg(long, default_value = "/usr/aarch64-linux-gnu/include", action)] aarch64_sysroot: PathBuf, - #[clap(long, default_value = "/usr/arm-linux-gnueabi/include", action)] + #[arg(long, default_value = "/usr/arm-linux-gnueabi/include", action)] armv7_sysroot: PathBuf, - #[clap(long, default_value = "/usr/riscv64-linux-gnu/include", action)] + #[arg(long, default_value = "/usr/riscv64-linux-gnu/include", action)] riscv64_sysroot: PathBuf, - #[clap(subcommand)] + #[command(subcommand)] command: Option, } -#[derive(Parser)] +#[derive(clap::Subcommand)] enum Command { - #[clap(name = "aya")] + #[command(name = "aya")] Aya, - #[clap(name = "aya-bpf-bindings")] + #[command(name = "aya-bpf-bindings")] AyaBpfBindings, } diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 5cf9574c..90eb6ecc 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -9,7 +9,7 @@ use std::process::exit; use clap::Parser; #[derive(Parser)] -pub struct Options { +pub struct XtaskOptions { #[clap(subcommand)] command: Command, } @@ -19,12 +19,12 @@ enum Command { Codegen(codegen::Options), Docs, BuildIntegrationTest(build_test::Options), - BuildIntegrationTestEbpf(build_ebpf::Options), + BuildIntegrationTestEbpf(build_ebpf::BuildEbpfOptions), IntegrationTest(run::Options), } fn main() { - let opts = Options::parse(); + let opts = XtaskOptions::parse(); use Command::*; let ret = match opts.command { diff --git a/xtask/src/run.rs b/xtask/src/run.rs index 13f61f31..7d01ccff 100644 --- a/xtask/src/run.rs +++ b/xtask/src/run.rs @@ -3,7 +3,7 @@ use std::{os::unix::process::CommandExt, path::PathBuf, process::Command}; use anyhow::Context as _; use clap::Parser; -use crate::build_ebpf::{build_ebpf, Architecture, Options as BuildOptions}; +use crate::build_ebpf::{build_ebpf, Architecture, BuildEbpfOptions as BuildOptions}; #[derive(Debug, Parser)] pub struct Options {