include commit-hash in version (#185)

This commit is contained in:
Ferdinand Schober
2024-09-02 19:46:07 +02:00
committed by GitHub
parent 8926d8f803
commit 1f7a7309eb
4 changed files with 17 additions and 2 deletions

View File

@@ -1,4 +1,18 @@
use std::process::Command;
fn main() { fn main() {
// commit hash
let git_describe = Command::new("git")
.arg("describe")
.arg("--always")
.arg("--dirty")
.arg("--tags")
.output()
.unwrap();
let git_describe = String::from_utf8(git_describe.stdout).unwrap();
println!("cargo::rustc-env=GIT_DESCRIBE={git_describe}");
// composite_templates // composite_templates
#[cfg(feature = "gtk")] #[cfg(feature = "gtk")]
glib_build_tools::compile_resources( glib_build_tools::compile_resources(

View File

@@ -53,7 +53,7 @@
libadwaita libadwaita
librsvg librsvg
xorg.libXtst xorg.libXtst
] ++ lib.optionals stdenv.isDarwin ] ++ lib.optionals stdenv.isDarwin
(with darwin.apple_sdk_11_0.frameworks; [ (with darwin.apple_sdk_11_0.frameworks; [
CoreGraphics CoreGraphics
ApplicationServices ApplicationServices

View File

@@ -12,6 +12,7 @@ rustPlatform.buildRustPackage {
version = version; version = version;
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
git
pkg-config pkg-config
cmake cmake
makeWrapper makeWrapper

View File

@@ -50,7 +50,7 @@ impl ConfigToml {
} }
#[derive(Parser, Debug)] #[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)] #[command(author, version=env!("GIT_DESCRIBE"), about, long_about = None)]
struct CliArgs { struct CliArgs {
/// the listen port for lan-mouse /// the listen port for lan-mouse
#[arg(short, long)] #[arg(short, long)]