Expose build identity in version output
ci / test (push) Has been cancelled
ci / fuzz-smoke (push) Has been cancelled
ci / windows-client (push) Has been cancelled
ci / package-release (linux-x86_64, ubuntu-latest) (push) Has been cancelled
ci / package-release (macos-aarch64, macos-14) (push) Has been cancelled
ci / package-release (macos-x86_64, macos-13) (push) Has been cancelled
ci / package-release (windows-x86_64, windows-latest) (push) Has been cancelled
ci / remote-bench (push) Has been cancelled

This commit is contained in:
DuProcess
2026-06-27 13:45:48 -04:00
parent 606fad72e3
commit 48a59496b2
9 changed files with 60 additions and 5 deletions
Generated
+1 -1
View File
@@ -436,7 +436,7 @@ dependencies = [
[[package]] [[package]]
name = "dosh" name = "dosh"
version = "0.1.1" version = "0.1.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"base64", "base64",
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "dosh" name = "dosh"
version = "0.1.1" version = "0.1.2"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
+26
View File
@@ -0,0 +1,26 @@
use std::process::Command;
fn git(args: &[&str]) -> Option<String> {
let output = Command::new("git").args(args).output().ok()?;
if !output.status.success() {
return None;
}
let text = String::from_utf8(output.stdout).ok()?;
Some(text.trim().to_string())
}
fn main() {
println!("cargo:rerun-if-changed=.git/HEAD");
println!("cargo:rerun-if-changed=.git/index");
let hash = git(&["rev-parse", "--short=12", "HEAD"]).unwrap_or_else(|| "unknown".into());
let date = git(&["show", "-s", "--format=%cs", "HEAD"]).unwrap_or_else(|| "unknown".into());
let dirty = Command::new("git")
.args(["diff", "--quiet", "--ignore-submodules", "--"])
.status()
.map(|status| if status.success() { "" } else { "+dirty" })
.unwrap_or("");
println!("cargo:rustc-env=DOSH_GIT_HASH={hash}{dirty}");
println!("cargo:rustc-env=DOSH_COMMIT_DATE={date}");
}
+5
View File
@@ -5,6 +5,11 @@ use dosh::config::load_server_config;
use dosh::native::{host_public_key, host_public_key_line, load_or_create_host_key}; use dosh::native::{host_public_key, host_public_key_line, load_or_create_host_key};
#[derive(Debug, Parser)] #[derive(Debug, Parser)]
#[command(
name = "dosh-auth",
version = dosh::build_info::VERSION,
long_version = dosh::build_info::LONG_VERSION
)]
struct Args { struct Args {
#[arg(long, default_value_t = 1)] #[arg(long, default_value_t = 1)]
protocol: u8, protocol: u8,
+5 -1
View File
@@ -11,7 +11,11 @@ use std::sync::mpsc;
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
#[derive(Debug, Parser)] #[derive(Debug, Parser)]
#[command(name = "dosh-bench")] #[command(
name = "dosh-bench",
version = dosh::build_info::VERSION,
long_version = dosh::build_info::LONG_VERSION
)]
struct Args { struct Args {
#[arg(long, default_value = "local")] #[arg(long, default_value = "local")]
server: String, server: String,
+5 -1
View File
@@ -69,7 +69,11 @@ fn terminal_size() -> (u16, u16) {
} }
#[derive(Debug, Clone, Parser)] #[derive(Debug, Clone, Parser)]
#[command(name = "dosh-client", version)] #[command(
name = "dosh-client",
version = dosh::build_info::VERSION,
long_version = dosh::build_info::LONG_VERSION
)]
struct Args { struct Args {
#[arg()] #[arg()]
server: Option<String>, server: Option<String>,
+5 -1
View File
@@ -51,7 +51,11 @@ static AGENT_SOCK_COUNTER: AtomicU64 = AtomicU64::new(0);
const NATIVE_HANDSHAKE_TTL_SECS: u64 = 30; const NATIVE_HANDSHAKE_TTL_SECS: u64 = 30;
#[derive(Debug, Parser)] #[derive(Debug, Parser)]
#[command(name = "dosh-server")] #[command(
name = "dosh-server",
version = dosh::build_info::VERSION,
long_version = dosh::build_info::LONG_VERSION
)]
struct Args { struct Args {
#[command(subcommand)] #[command(subcommand)]
command: Command, command: Command,
+11
View File
@@ -0,0 +1,11 @@
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
pub const GIT_HASH: &str = env!("DOSH_GIT_HASH");
pub const COMMIT_DATE: &str = env!("DOSH_COMMIT_DATE");
pub const LONG_VERSION: &str = concat!(
env!("CARGO_PKG_VERSION"),
" (",
env!("DOSH_GIT_HASH"),
", ",
env!("DOSH_COMMIT_DATE"),
")"
);
+1
View File
@@ -1,4 +1,5 @@
pub mod auth; pub mod auth;
pub mod build_info;
pub mod config; pub mod config;
pub mod crypto; pub mod crypto;
pub mod native; pub mod native;