• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# rustc_tools_util
2
3A small tool to help you generate version information
4for packages installed from a git repo
5
6## Usage
7
8Add a `build.rs` file to your repo and list it in `Cargo.toml`
9````toml
10build = "build.rs"
11````
12
13List rustc_tools_util as regular AND build dependency.
14````toml
15[dependencies]
16rustc_tools_util = "0.3.0"
17
18[build-dependencies]
19rustc_tools_util = "0.3.0"
20````
21
22In `build.rs`, generate the data in your `main()`
23
24```rust
25fn main() {
26    rustc_tools_util::setup_version_info!();
27}
28```
29
30Use the version information in your main.rs
31
32```rust
33fn show_version() {
34    let version_info = rustc_tools_util::get_version_info!();
35    println!("{}", version_info);
36}
37```
38
39This gives the following output in clippy:
40`clippy 0.1.66 (a28f3c8 2022-11-20)`
41
42## Repository
43
44This project is part of the rust-lang/rust-clippy repository. The source code
45can be found under `./rustc_tools_util/`.
46
47The changelog for `rustc_tools_util` is available under:
48[`rustc_tools_util/CHANGELOG.md`](https://github.com/rust-lang/rust-clippy/blob/master/rustc_tools_util/CHANGELOG.md)
49
50## License
51
52<!-- REUSE-IgnoreStart -->
53
54Copyright 2014-2022 The Rust Project Developers
55
56Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
57http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
58<LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
59option. All files in the project carrying such notice may not be
60copied, modified, or distributed except according to those terms.
61
62<!-- REUSE-IgnoreEnd -->
63