mirror of https://github.com/aya-rs/aya
integration-ebpf: invalidate on bpf-linker
Extract the symlink-to-bpf-linker logic from integration-test to xtask and use it in a new build script in integration-ebpf, causing ebpf probes to be rebuilt when bpf-linker changes. Previously bpf-linker changes would rebuild integration-test, but not integration-ebpf, resulting in stale tests. Note that this still doesn't address the possibility that a new bpf-linker is added to the PATH ahead of the cached one. Solving this in the general case would require rebuild-if-changed-env=PATH *and* rebuild-if-changed={every-directory-in-PATH} which would likely mean far too much cache invalidation.reviewable/pr677/r9
parent
0168396604
commit
e276c07f73
@ -0,0 +1,23 @@
|
||||
use std::{env, path::PathBuf};
|
||||
|
||||
use xtask::{create_symlink_to_binary, AYA_BUILD_INTEGRATION_BPF};
|
||||
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-env-changed={}", AYA_BUILD_INTEGRATION_BPF);
|
||||
|
||||
let build_integration_bpf = env::var(AYA_BUILD_INTEGRATION_BPF)
|
||||
.as_deref()
|
||||
.map(str::parse)
|
||||
.map(Result::unwrap)
|
||||
.unwrap_or_default();
|
||||
|
||||
if build_integration_bpf {
|
||||
let out_dir = env::var_os("OUT_DIR").unwrap();
|
||||
let out_dir = PathBuf::from(out_dir);
|
||||
let bpf_linker_symlink = create_symlink_to_binary(&out_dir, "bpf-linker").unwrap();
|
||||
println!(
|
||||
"cargo:rerun-if-changed={}",
|
||||
bpf_linker_symlink.to_str().unwrap()
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue