]> git.proxmox.com Git - rustc.git/blame - vendor/rustc_tools_util/README.md
New upstream version 1.68.2+dfsg1
[rustc.git] / vendor / rustc_tools_util / README.md
CommitLineData
2b03887a
FG
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]
f25598a0 16rustc_tools_util = "0.3.0"
2b03887a
FG
17
18[build-dependencies]
f25598a0 19rustc_tools_util = "0.3.0"
2b03887a
FG
20````
21
22In `build.rs`, generate the data in your `main()`
f25598a0
FG
23
24```rust
2b03887a 25fn main() {
f25598a0 26 rustc_tools_util::setup_version_info!();
2b03887a 27}
f25598a0 28```
2b03887a
FG
29
30Use the version information in your main.rs
2b03887a 31
f25598a0 32```rust
2b03887a
FG
33fn show_version() {
34 let version_info = rustc_tools_util::get_version_info!();
35 println!("{}", version_info);
36}
f25598a0
FG
37```
38
2b03887a 39This gives the following output in clippy:
f25598a0
FG
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/`.
2b03887a 46
f25598a0
FG
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)
2b03887a
FG
49
50## License
51
52Copyright 2014-2022 The Rust Project Developers
53
54Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
55http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
56<LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
57option. All files in the project carrying such notice may not be
58copied, modified, or distributed except according to those terms.