Fix naming conventions in xtask for toolchain parameter

pull/69/head
arctic-alpaca 2 years ago
parent 71fc65a174
commit 167f1d8712
No known key found for this signature in database
GPG Key ID: F911E2A7F537230E

@ -36,7 +36,7 @@ pub struct Options {
pub target: Architecture, pub target: Architecture,
/// Set the rust toolchain for the BPF program (only nightly toolchains are supported) /// Set the rust toolchain for the BPF program (only nightly toolchains are supported)
#[clap(default_value = "+nightly", long)] #[clap(default_value = "+nightly", long)]
pub bpf_toolchain: String, pub toolchain: String,
/// Build the release target /// Build the release target
#[clap(long)] #[clap(long)]
pub release: bool, pub release: bool,
@ -45,13 +45,13 @@ pub struct Options {
pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> { pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> {
let dir = PathBuf::from("{{project-name}}-ebpf"); let dir = PathBuf::from("{{project-name}}-ebpf");
let target = format!("--target={}", opts.target); let target = format!("--target={}", opts.target);
let bpf_toolchain = if opts.bpf_toolchain.starts_with('+') { let toolchain = if opts.toolchain.starts_with('+') {
opts.bpf_toolchain opts.toolchain
} else { } else {
format!("+{}", opts.bpf_toolchain) format!("+{}", opts.toolchain)
}; };
let mut args = vec![ let mut args = vec![
bpf_toolchain.as_str(), toolchain.as_str(),
"build", "build",
"--verbose", "--verbose",
target.as_str(), target.as_str(),

@ -10,6 +10,9 @@ pub struct Options {
/// Set the endianness of the BPF target /// Set the endianness of the BPF target
#[clap(default_value = "bpfel-unknown-none", long)] #[clap(default_value = "bpfel-unknown-none", long)]
pub bpf_target: Architecture, 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 /// Build and run the release target
#[clap(long)] #[clap(long)]
pub release: bool, pub release: bool,
@ -19,9 +22,6 @@ pub struct Options {
/// Arguments to pass to your application /// Arguments to pass to your application
#[clap(name = "args", last = true)] #[clap(name = "args", last = true)]
pub run_args: Vec<String>, pub run_args: Vec<String>,
/// 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 /// Build the project
@ -44,7 +44,7 @@ pub fn run(opts: Options) -> Result<(), anyhow::Error> {
build_ebpf(BuildOptions { build_ebpf(BuildOptions {
target: opts.bpf_target, target: opts.bpf_target,
release: opts.release, release: opts.release,
bpf_toolchain: opts.bpf_toolchain.clone(), toolchain: opts.bpf_toolchain.clone(),
}) })
.context("Error while building eBPF program")?; .context("Error while building eBPF program")?;
build(&opts).context("Error while building userspace application")?; build(&opts).context("Error while building userspace application")?;

Loading…
Cancel
Save