Add the project skeleton and the approved design
Cargo.toml with the release profile and lints, the toolchain pinned to Rust 1.90.0, a build script that records the git commit for `cumulus --version`, and rustfmt settings and cargo aliases (`cargo lint`, `cargo linux`) as in skyshift. DESIGN.md holds the design approved after the question rounds; README.md has build instructions and the planned keys. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
commit
0e03c396bf
12 files changed
+659
No files matched your search
@@ -0,0 +1,32 @@
|
||||
//! Build script: records the git commit cumulus is built from, so
|
||||
//! `cumulus --version` can tell exactly which build you're running.
|
||||
//!
|
||||
//! Outside a git checkout, or without git installed, the commit is "unknown".
|
||||
//! (No Windows icon or manifest: a terminal program's icon only shows in
|
||||
//! Explorer, and a manifest changes nothing for it.)
|
||||
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
|
||||
fn main() {
|
||||
let commit = git_commit().unwrap_or_else(|| "unknown".to_string());
|
||||
println!("cargo::rustc-env=CUMULUS_COMMIT={commit}");
|
||||
|
||||
// Run again when the commit changes: HEAD moves on checkout, and the
|
||||
// branch files change on commit. Only watch files that exist, or cargo
|
||||
// would run this script on every build.
|
||||
println!("cargo::rerun-if-changed=build.rs");
|
||||
for path in [".git/HEAD", ".git/refs/heads", ".git/packed-refs"] {
|
||||
if Path::new(path).exists() {
|
||||
println!("cargo::rerun-if-changed={path}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The short hash of the current commit, if git can tell.
|
||||
fn git_commit() -> Option<String> {
|
||||
let output = Command::new("git").args(["rev-parse", "--short=9", "HEAD"]).output().ok()?;
|
||||
let hash = String::from_utf8(output.stdout).ok()?;
|
||||
let hash = hash.trim();
|
||||
(output.status.success() && !hash.is_empty()).then(|| hash.to_string())
|
||||
}
|
||||
Reference in new issue
Block a user