1
0
mirror of https://github.com/jht5945/buildj.git synced 2025-12-27 17:20:06 +08:00

fix: quick fix buildj

This commit is contained in:
2021-02-04 23:34:14 +08:00
parent 9b152d2af1
commit 1e933bde6b
3 changed files with 6 additions and 3 deletions

2
Cargo.lock generated
View File

@@ -87,7 +87,7 @@ dependencies = [
[[package]]
name = "buildj"
version = "0.1.5"
version = "0.1.6"
dependencies = [
"dirs 3.0.1",
"json",

View File

@@ -1,6 +1,6 @@
[package]
name = "buildj"
version = "0.1.5"
version = "0.1.6"
authors = ["Hatter Jiang <jht5945@gmail.com>"]
edition = "2018"
homepage = "https://buildj.ruststack.org/"

View File

@@ -2,7 +2,10 @@ use std::process::Command;
fn main() {
let output = Command::new("git").args(&["rev-parse", "HEAD"]).output().unwrap();
let git_hash = String::from_utf8(output.stdout).unwrap();
let mut git_hash = String::from_utf8(output.stdout).unwrap();
if git_hash.is_empty() {
git_hash = "0000000000000000000000000000000000000000".to_string();
}
println!("cargo:rustc-env=GIT_HASH={}", git_hash);
let date_output = Command::new("date").args(&["+%Y-%m-%dT%H:%M:%S%z"]).output().unwrap();
let date = String::from_utf8(date_output.stdout).unwrap();