Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Added

- Generated crates now contain the git commit hash and date of svd2rust
compilation.

### Fixed

- Keyword sanitizing (`async`)
Expand Down
24 changes: 20 additions & 4 deletions src/generate/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,29 @@ pub fn render(
) -> Result<TokenStream> {
let mut out = TokenStream::new();

let commit_info = {
let tmp = include_str!(concat!(env!("OUT_DIR"), "/commit-info.txt"));

if tmp.is_empty() {
" (unknown commit)"
} else {
tmp
}
};

let doc = format!(
"Peripheral access API for {0} microcontrollers \
(generated using svd2rust v{1})\n\n\
You can find an overview of the API [here].\n\n\
[here]: https://docs.rs/svd2rust/{1}/svd2rust/#peripheral-api",
(generated using svd2rust v{1}{2})\n\n\
You can find an overview of the API as of release v{1} [here].\n\n\
Docs containing API features to be included in the [next] \
release can be generated by cloning the svd2rust [repository], \
checking out the above commit, and running `cargo doc`.\n\n\
[here]: https://docs.rs/svd2rust/{1}/svd2rust/#peripheral-api\n\
[next]: https://github.com/rust-embedded/svd2rust/blob/master/CHANGELOG.md#unreleased\n\
[repository]: https://github.com/rust-embedded/svd2rust",
d.name.to_uppercase(),
env!("CARGO_PKG_VERSION")
env!("CARGO_PKG_VERSION"),
commit_info
);

if target == Target::Msp430 {
Expand Down