-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: more detailed game info: build time of app (#30)
- Loading branch information
1 parent
adc276b
commit fdfd87a
Showing
5 changed files
with
37 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,40 @@ | ||
use std::process::Command; | ||
|
||
fn main() { | ||
fn get_version() { | ||
let version_output = Command::new("git") | ||
.args(["rev-parse", "HEAD"]) | ||
.output() | ||
.unwrap(); | ||
|
||
let git_hash = String::from_utf8(version_output.stdout).unwrap(); | ||
|
||
println!("cargo:rustc-env=GIT_HASH={}", git_hash); | ||
} | ||
|
||
fn get_branch() { | ||
let branch_output = Command::new("git") | ||
.args(["rev-parse", "--abbrev-ref", "HEAD"]) | ||
.output() | ||
.unwrap(); | ||
|
||
let git_branch = String::from_utf8(branch_output.stdout).unwrap(); | ||
|
||
println!("cargo:rustc-env=GIT_HASH={}", git_hash); | ||
|
||
println!("cargo:rustc-env=GIT_BRANCH={}", git_branch); | ||
} | ||
|
||
fn get_build_date() { | ||
let build_date = Command::new("date") | ||
.args(["+%Y-%m-%d %H:%M:%S"]) | ||
.output() | ||
.unwrap(); | ||
|
||
let date = String::from_utf8(build_date.stdout).unwrap(); | ||
|
||
println!("cargo:rustc-env=BUILD_DATE={}", date); | ||
} | ||
|
||
fn main() { | ||
get_version(); | ||
get_branch(); | ||
get_build_date(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters