Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions crates/videoeditor/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//! Embed build provenance in `--version` so two different builds can never
//! masquerade as each other (a stale binary claiming to be "0.1.0" while the
//! source moved on is how template features silently "disappear").

use std::process::Command;

fn main() {
let git = |args: &[&str]| {
Command::new("git")
.args(args)
.output()
.ok()
.filter(|o| o.status.success())
.map(|o| String::from_utf8_lossy(&o.stdout).trim().to_string())
};
// crates.io tarballs and nix store sources have no .git — plain version
let build = match git(&["rev-parse", "--short=9", "HEAD"]) {
Some(hash) => {
let dirty = git(&["status", "--porcelain"])
.map(|s| !s.is_empty())
.unwrap_or(false);
if dirty {
format!(" ({hash}, dirty)")
} else {
format!(" ({hash})")
}
}
None => String::new(),
};
println!("cargo:rustc-env=VIDEOEDITOR_BUILD_INFO={build}");
println!("cargo:rerun-if-changed=../../.git/HEAD");
println!("cargo:rerun-if-changed=../../.git/index");
}
2 changes: 1 addition & 1 deletion crates/videoeditor/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::path::{Path, PathBuf};
#[derive(Parser)]
#[command(
name = "videoeditor",
version,
version = concat!(env!("CARGO_PKG_VERSION"), env!("VIDEOEDITOR_BUILD_INFO")),
about = "Scripted short-video renderer: script.md in, rendered vertical video out",
after_help = "AI agents (Claude Code, etc.): run `videoeditor guide` for the embedded \
director's guide — the full production workflow, script grammar, and \
Expand Down
Loading