Skip to content

Commit 3f0e249

Browse files
bors[bot]cr1901
andauthored
Merge #439
439: Add commit and date info to generated crates r=Emilgardis a=cr1901 I don't need this feature as much now, but I know more than once in the past while adding msp430 feature I've forgotten that my changes haven't been incorporated into a release yet. This means the docs.rs docs are out of date relative to the PAC. I've added some info to the doc string to mention the commit and date that svd2rust was compiled with, and explicitly how to generate up-to-date svd2rust docs. Co-authored-by: William D. Jones <thor0505@comcast.net>
2 parents fa0c4ad + 95c7839 commit 3f0e249

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- Generated crates now contain the git commit hash and date of svd2rust
13+
compilation.
14+
1015
### Fixed
1116

1217
- Keyword sanitizing (`async`)

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+
" (untracked)"
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 generated API [here].\n\n\
37+
API features to be included in the [next] svd2rust \
38+
release can be generated by cloning the svd2rust [repository], \
39+
checking out the above commit, and running `cargo doc --open`.\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)