Skip to content

Commit 7428329

Browse files
committed
Add git commit info and date to generated crates.
1 parent fa0c4ad commit 7428329

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

src/generate/device.rs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,29 @@ pub fn render(
2020
) -> Result<TokenStream> {
2121
let mut out = TokenStream::new();
2222

23+
let commit_info = {
24+
let tmp = include_str!(concat!(env!("OUT_DIR"), "/commit-info.txt"));
25+
26+
if tmp.is_empty() {
27+
" (unknown commit)"
28+
} else {
29+
tmp
30+
}
31+
};
32+
2333
let doc = format!(
2434
"Peripheral access API for {0} microcontrollers \
25-
(generated using svd2rust v{1})\n\n\
26-
You can find an overview of the API [here].\n\n\
27-
[here]: https://docs.rs/svd2rust/{1}/svd2rust/#peripheral-api",
35+
(generated using svd2rust v{1}{2})\n\n\
36+
You can find an overview of the API as of release v{1} [here].\n\n\
37+
Docs containing API features to be included in the [next] \
38+
release can be generated by cloning the svd2rust [repository], \
39+
checking out the above commit, and running `cargo doc`.\n\n\
40+
[here]: https://docs.rs/svd2rust/{1}/svd2rust/#peripheral-api\n\
41+
[next]: https://github.com/rust-embedded/svd2rust/blob/master/CHANGELOG.md#unreleased\n\
42+
[repository]: https://github.com/rust-embedded/svd2rust",
2843
d.name.to_uppercase(),
29-
env!("CARGO_PKG_VERSION")
44+
env!("CARGO_PKG_VERSION"),
45+
commit_info
3046
);
3147

3248
if target == Target::Msp430 {

0 commit comments

Comments
 (0)