From 71fc65a174f7f5fd9517ed46a0ba1c996bccf795 Mon Sep 17 00:00:00 2001 From: arctic-alpaca <67190338+arctic-alpaca@users.noreply.github.com> Date: Fri, 13 Jan 2023 12:48:13 +0100 Subject: [PATCH] Specify toolchain selection is only for BPF program --- README.md | 2 +- xtask/src/build_ebpf.rs | 12 ++++++------ xtask/src/run.rs | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 86867c5..202a084 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ cargo xtask build-ebpf To perform a release build you can use the `--release` flag. You may also change the target architecture with the `--target` flag. -If you require a specific version of the toolchain, you can use the `--toolchain` flag (only nightly toolchains are supported). +If you require a specific version of the toolchain for the BPF program, you can use the `--bpf_toolchain` flag (only nightly toolchains are supported). ## Build Userspace diff --git a/xtask/src/build_ebpf.rs b/xtask/src/build_ebpf.rs index 4eb1282..e2630f7 100644 --- a/xtask/src/build_ebpf.rs +++ b/xtask/src/build_ebpf.rs @@ -34,9 +34,9 @@ pub struct Options { /// Set the endianness of the BPF target #[clap(default_value = "bpfel-unknown-none", long)] pub target: Architecture, - /// Set the rust toolchain (only nightly toolchains are supported) + /// Set the rust toolchain for the BPF program (only nightly toolchains are supported) #[clap(default_value = "+nightly", long)] - pub toolchain: String, + pub bpf_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 toolchain = if opts.toolchain.starts_with('+') { - opts.toolchain + let bpf_toolchain = if opts.bpf_toolchain.starts_with('+') { + opts.bpf_toolchain } else { - format!("+{}", opts.toolchain) + format!("+{}", opts.bpf_toolchain) }; let mut args = vec![ - toolchain.as_str(), + bpf_toolchain.as_str(), "build", "--verbose", target.as_str(), diff --git a/xtask/src/run.rs b/xtask/src/run.rs index ca4279e..ae70523 100644 --- a/xtask/src/run.rs +++ b/xtask/src/run.rs @@ -19,9 +19,9 @@ pub struct Options { /// Arguments to pass to your application #[clap(name = "args", last = true)] pub run_args: Vec, - /// Set the rust toolchain (only nightly toolchains are supported) + /// Set the rust toolchain for the BPF program (only nightly toolchains are supported) #[clap(default_value = "+nightly", long)] - pub toolchain: String, + 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, - toolchain: opts.toolchain.clone(), + bpf_toolchain: opts.bpf_toolchain.clone(), }) .context("Error while building eBPF program")?; build(&opts).context("Error while building userspace application")?;