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