feat: ship Rust login manager and GitLab release pipeline

Replace the legacy Go implementation as the production path, quarantine the reference tree, add deterministic release packaging and version metadata, and run verification through GitLab CI.
This commit is contained in:
2026-09-25 21:33:46 +05:30
parent 1723ab53b8
commit faf5b27328
49 changed files with 6795 additions and 747 deletions

41
build.rs Normal file
View File

@@ -0,0 +1,41 @@
use std::{env, process::Command};
fn main() {
for variable in [
"LATCHD_VERSION",
"LATCHD_COMMIT",
"LATCHD_BUILD_TIME",
"SOURCE_DATE_EPOCH",
] {
println!("cargo:rerun-if-env-changed={variable}");
}
let version = env::var("LATCHD_VERSION")
.ok()
.filter(|value| !value.is_empty())
.unwrap_or_else(|| env!("CARGO_PKG_VERSION").to_owned());
let commit = env::var("LATCHD_COMMIT")
.ok()
.filter(|value| !value.is_empty())
.or_else(|| git_value(["rev-parse", "--short=12", "HEAD"]))
.unwrap_or_else(|| "unknown".to_owned());
let build_time = env::var("LATCHD_BUILD_TIME")
.ok()
.filter(|value| !value.is_empty())
.or_else(|| env::var("SOURCE_DATE_EPOCH").ok())
.unwrap_or_else(|| "unknown".to_owned());
println!("cargo:rustc-env=LATCHD_VERSION={version}");
println!("cargo:rustc-env=LATCHD_COMMIT={commit}");
println!("cargo:rustc-env=LATCHD_BUILD_TIME={build_time}");
}
fn git_value<const N: usize>(arguments: [&str; N]) -> Option<String> {
let output = Command::new("git").args(arguments).output().ok()?;
if !output.status.success() {
return None;
}
let value = String::from_utf8(output.stdout).ok()?;
let value = value.trim();
(!value.is_empty()).then(|| value.to_owned())
}