Add toolchain parameter to xtask

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

@ -13,7 +13,8 @@ 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
You may also change the target architecture with the `--target` flag.
If you require a specific (nightly) version of the toolchain, you can use the `--toolchain` flag.
## Build Userspace

@ -34,6 +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
#[clap(default_value = "+nightly", long)]
pub toolchain: String,
/// Build the release target
#[clap(long)]
pub release: bool,
@ -43,7 +46,7 @@ pub fn build_ebpf(opts: Options) -> Result<(), anyhow::Error> {
let dir = PathBuf::from("{{project-name}}-ebpf");
let target = format!("--target={}", opts.target);
let mut args = vec![
"+nightly",
opts.toolchain.as_str(),
"build",
"--verbose",
target.as_str(),

@ -19,6 +19,9 @@ pub struct Options {
/// Arguments to pass to your application
#[clap(name = "args", last = true)]
pub run_args: Vec<String>,
/// Set the rust toolchain
#[clap(default_value = "+nightly", long)]
pub toolchain: String,
}
/// Build the project
@ -41,6 +44,7 @@ pub fn run(opts: Options) -> Result<(), anyhow::Error> {
build_ebpf(BuildOptions {
target: opts.bpf_target,
release: opts.release,
toolchain: opts.toolchain.clone(),
})
.context("Error while building eBPF program")?;
build(&opts).context("Error while building userspace application")?;

Loading…
Cancel
Save