Specify toolchain selection is only for BPF program

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

@ -14,7 +14,7 @@ cargo xtask build-ebpf
To perform a release build you can use the `--release` flag. To perform a release build you can use the `--release` flag.
You may also change the target architecture with the `--target` 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 ## Build Userspace

@ -34,9 +34,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 target: Architecture, 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)] #[clap(default_value = "+nightly", long)]
pub toolchain: String, pub bpf_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 toolchain = if opts.toolchain.starts_with('+') { let bpf_toolchain = if opts.bpf_toolchain.starts_with('+') {
opts.toolchain opts.bpf_toolchain
} else { } else {
format!("+{}", opts.toolchain) format!("+{}", opts.bpf_toolchain)
}; };
let mut args = vec![ let mut args = vec![
toolchain.as_str(), bpf_toolchain.as_str(),
"build", "build",
"--verbose", "--verbose",
target.as_str(), target.as_str(),

@ -19,9 +19,9 @@ 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 (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 toolchain: String, 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,
toolchain: opts.toolchain.clone(), bpf_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