]> git.proxmox.com Git - rustc.git/blob - vendor/rustc_tools_util/README.md
New upstream version 1.68.2+dfsg1
[rustc.git] / vendor / rustc_tools_util / README.md
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]
16 rustc_tools_util = "0.3.0"
17
18 [build-dependencies]
19 rustc_tools_util = "0.3.0"
20 ````
21
22 In `build.rs`, generate the data in your `main()`
23
24 ```rust
25 fn main() {
26 rustc_tools_util::setup_version_info!();
27 }
28 ```
29
30 Use the version information in your main.rs
31
32 ```rust
33 fn show_version() {
34 let version_info = rustc_tools_util::get_version_info!();
35 println!("{}", version_info);
36 }
37 ```
38
39 This gives the following output in clippy:
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/`.
46
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)
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.