Skip to content

Commit

Permalink
Add the short git commit hash to the version
Browse files Browse the repository at this point in the history
  • Loading branch information
alloncm committed Dec 13, 2024
1 parent b9588e2 commit 16d721b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
8 changes: 8 additions & 0 deletions common/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
use std::process::Command;

fn main() {
let output = Command::new("git").args(&["rev-parse", "--short", "HEAD"]).output().unwrap();
let git_hash = String::from_utf8(output.stdout).unwrap();
let version = env!("CARGO_PKG_VERSION");
println!("cargo:rustc-env=MAGENBOY_VERSION={}", std::format!("{}-{}", version, git_hash));
}
2 changes: 1 addition & 1 deletion common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ pub mod menu;
pub mod joypad_menu;
pub mod interpolation;

pub const VERSION:&str = env!("CARGO_PKG_VERSION");
pub const VERSION:&str = env!("MAGENBOY_VERSION");
5 changes: 4 additions & 1 deletion libretro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ crate-type = ["cdylib"]
magenboy_core = {path = "../core", features = ["apu"]}
magenboy_common = {path = "../common/", features = ["std"]}
libretro-sys = "0.1.1"
log = "0.4"
log = "0.4"

[build-dependencies]
magenboy_common = {path = "../common"}
2 changes: 1 addition & 1 deletion libretro/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fn main() {
info_filename.pop();
info_filename = info_filename.join(executable_filename);
info_filename.set_extension("info");
let version = var("CARGO_PKG_VERSION").unwrap();
let version = magenboy_common::VERSION;
let authors = var("CARGO_PKG_AUTHORS").unwrap();
let content = std::format!(
r##"display_name = "MagenBoy - GameBoy & GameBoy Color"
Expand Down

0 comments on commit 16d721b

Please sign in to comment.