padlock-cli 0.10.0

Struct memory layout analyzer for C, C++, Rust, Go, and Zig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
fn main() {
    // Embed the short git SHA at compile time so `padlock --version` is traceable.
    // Falls back to "unknown" when git is unavailable (e.g. vendored source tarballs).
    let sha = std::process::Command::new("git")
        .args(["rev-parse", "--short", "HEAD"])
        .output()
        .ok()
        .filter(|o| o.status.success())
        .and_then(|o| String::from_utf8(o.stdout).ok())
        .map(|s| s.trim().to_string())
        .unwrap_or_else(|| "unknown".to_string());

    println!("cargo:rustc-env=BUILD_GIT_SHA={sha}");
    // Re-run when HEAD moves (commit, checkout) or a ref changes.
    println!("cargo:rerun-if-changed=.git/HEAD");
    println!("cargo:rerun-if-changed=.git/refs/");
}