From 167f1d87121cf33d10bc7fd6b7f40e98e806f731 Mon Sep 17 00:00:00 2001 From: arctic-alpaca <67190338+arctic-alpaca@users.noreply.github.com> Date: Fri, 13 Jan 2023 13:03:35 +0100 Subject: [PATCH] Fix naming conventions in xtask for toolchain parameter --- xtask/src/build_ebpf.rs | 10 +++++----- xtask/src/run.rs | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/xtask/src/build_ebpf.rs b/xtask/src/build_ebpf.rs index e2630f7..12d99da 100644 --- a/xtask/src/build_ebpf.rs +++ b/xtask/src/build_ebpf.rs @@ -36,7 +36,7 @@ pub struct Options { pub target: Architecture, /// Set the rust toolchain for the BPF program (only nightly toolchains are supported) #[clap(default_value = "+nightly", long)] - pub bpf_toolchain: String, + pub toolchain: String, /// Build the release target #[clap(long)] pub release: bool, @@ -45,13 +45,13 @@ pub struct Options { pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { let dir = PathBuf::from("{{project-name}}-ebpf"); let target = format!("--target={}", opts.target); - let bpf_toolchain = if opts.bpf_toolchain.starts_with('+') { - opts.bpf_toolchain + let toolchain = if opts.toolchain.starts_with('+') { + opts.toolchain } else { - format!("+{}", opts.bpf_toolchain) + format!("+{}", opts.toolchain) }; let mut args = vec![ - bpf_toolchain.as_str(), + toolchain.as_str(), "build", "--verbose", target.as_str(), diff --git a/xtask/src/run.rs b/xtask/src/run.rs index ae70523..48d4e6d 100644 --- a/xtask/src/run.rs +++ b/xtask/src/run.rs @@ -10,6 +10,9 @@ pub struct Options { /// Set the endianness of the BPF target #[clap(default_value = "bpfel-unknown-none", long)] pub bpf_target: Architecture, + /// Set the rust toolchain for the BPF program (only nightly toolchains are supported) + #[clap(default_value = "+nightly", long)] + pub bpf_toolchain: String, /// Build and run the release target #[clap(long)] pub release: bool, @@ -19,9 +22,6 @@ pub struct Options { /// Arguments to pass to your application #[clap(name = "args", last = true)] pub run_args: Vec, - /// Set the rust toolchain for the BPF program (only nightly toolchains are supported) - #[clap(default_value = "+nightly", long)] - pub bpf_toolchain: String, } /// Build the project @@ -44,7 +44,7 @@ pub fn run(opts: Options) -> Result<(), anyhow::Error> { build_ebpf(BuildOptions { target: opts.bpf_target, release: opts.release, - bpf_toolchain: opts.bpf_toolchain.clone(), + toolchain: opts.bpf_toolchain.clone(), }) .context("Error while building eBPF program")?; build(&opts).context("Error while building userspace application")?;