-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #132 from luojia65/luojia65/syterboot
[rust] rearrange code and implement first part of SyterBoot example
- Loading branch information
Showing
12 changed files
with
412 additions
and
287 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use std::process::Command; | ||
|
||
fn main() { | ||
let output = Command::new("git").args(&["rev-parse", "HEAD"]).output(); | ||
match output { | ||
Ok(output) => { | ||
let git_hash = String::from_utf8(output.stdout).unwrap(); | ||
let git_hash = &git_hash[..8]; | ||
println!("cargo:rustc-env=SYTERKIT_GIT_HASH={}", git_hash); | ||
} | ||
Err(e) => { | ||
panic!( | ||
"git command failed on host when compiling SyterKit: {} | ||
during compilation, git must be found, as it is used to generate the git hash version of the current package.", | ||
e | ||
); | ||
} | ||
} | ||
let syterkit_rustc_version = { | ||
let version = rustc_version::version_meta().unwrap(); | ||
let hash_date_extra = match (version.commit_hash, version.commit_date) { | ||
(Some(commit_hash), Some(commit_date)) => { | ||
format!(" ({} {})", &commit_hash[..8], commit_date) | ||
} | ||
(Some(commit_hash), None) => format!(" ({})", &commit_hash[..8]), | ||
(None, Some(commit_date)) => format!(" ({})", commit_date), | ||
(None, None) => "".to_string(), | ||
}; | ||
format!("{}{}", version.semver, hash_date_extra) | ||
}; | ||
println!( | ||
"cargo:rustc-env=SYTERKIT_RUSTC_VERSION={}", | ||
syterkit_rustc_version | ||
); | ||
} |
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,6 +1,6 @@ | ||
[package] | ||
name = "syterkit-macros" | ||
version = "0.1.0" | ||
version = "0.0.0" | ||
edition = "2021" | ||
|
||
[lib] | ||
|
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
Oops, something went wrong.