|
|
@ -1,4 +1,5 @@
|
|
|
|
use std::{
|
|
|
|
use std::{
|
|
|
|
|
|
|
|
ffi::OsString,
|
|
|
|
fmt::Write as _,
|
|
|
|
fmt::Write as _,
|
|
|
|
io::BufReader,
|
|
|
|
io::BufReader,
|
|
|
|
path::PathBuf,
|
|
|
|
path::PathBuf,
|
|
|
@ -12,12 +13,9 @@ use xtask::AYA_BUILD_INTEGRATION_BPF;
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Parser)]
|
|
|
|
#[derive(Debug, Parser)]
|
|
|
|
pub struct BuildOptions {
|
|
|
|
pub struct BuildOptions {
|
|
|
|
/// Pass --release to `cargo build`.
|
|
|
|
/// Arguments to pass to `cargo build`.
|
|
|
|
#[clap(long)]
|
|
|
|
#[clap(long)]
|
|
|
|
pub release: bool,
|
|
|
|
pub cargo_arg: Vec<OsString>,
|
|
|
|
/// Pass --target to `cargo build`.
|
|
|
|
|
|
|
|
#[clap(long)]
|
|
|
|
|
|
|
|
pub target: Option<String>,
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Parser)]
|
|
|
|
#[derive(Debug, Parser)]
|
|
|
@ -28,26 +26,22 @@ pub struct Options {
|
|
|
|
#[clap(short, long, default_value = "sudo -E")]
|
|
|
|
#[clap(short, long, default_value = "sudo -E")]
|
|
|
|
pub runner: String,
|
|
|
|
pub runner: String,
|
|
|
|
/// Arguments to pass to your application.
|
|
|
|
/// Arguments to pass to your application.
|
|
|
|
#[clap(name = "args", last = true)]
|
|
|
|
#[clap(last = true)]
|
|
|
|
pub run_args: Vec<String>,
|
|
|
|
pub run_args: Vec<OsString>,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Build the project
|
|
|
|
/// Build the project
|
|
|
|
pub fn build(opts: BuildOptions) -> Result<Vec<(String, PathBuf)>> {
|
|
|
|
pub fn build(opts: BuildOptions) -> Result<Vec<(String, PathBuf)>> {
|
|
|
|
let BuildOptions { release, target } = opts;
|
|
|
|
let BuildOptions { cargo_arg } = opts;
|
|
|
|
let mut cmd = Command::new("cargo");
|
|
|
|
let mut cmd = Command::new("cargo");
|
|
|
|
cmd.env(AYA_BUILD_INTEGRATION_BPF, "true").args([
|
|
|
|
cmd.env(AYA_BUILD_INTEGRATION_BPF, "true")
|
|
|
|
|
|
|
|
.args([
|
|
|
|
"build",
|
|
|
|
"build",
|
|
|
|
"--tests",
|
|
|
|
"--tests",
|
|
|
|
"--message-format=json",
|
|
|
|
"--message-format=json",
|
|
|
|
"--package=integration-test",
|
|
|
|
"--package=integration-test",
|
|
|
|
]);
|
|
|
|
])
|
|
|
|
if release {
|
|
|
|
.args(cargo_arg);
|
|
|
|
cmd.arg("--release");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if let Some(target) = target {
|
|
|
|
|
|
|
|
cmd.args(["--target", &target]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let mut child = cmd
|
|
|
|
let mut child = cmd
|
|
|
|
.stdout(Stdio::piped())
|
|
|
|
.stdout(Stdio::piped())
|
|
|
|