1
Fork 0

rustc_tools_util: changelog and 0.3.0 release

This commit is contained in:
xFrednet 2022-12-15 12:42:08 +01:00
parent aa66212e29
commit 004b885c0a
No known key found for this signature in database
GPG key ID: F5C59D0E669E5302
5 changed files with 19 additions and 12 deletions

View file

@ -23,7 +23,7 @@ path = "src/driver.rs"
[dependencies] [dependencies]
clippy_lints = { path = "clippy_lints" } clippy_lints = { path = "clippy_lints" }
semver = "1.0" semver = "1.0"
rustc_tools_util = {version = "0.2.1", path = "./rustc_tools_util"} rustc_tools_util = "0.3.0"
tempfile = { version = "3.2", optional = true } tempfile = { version = "3.2", optional = true }
termize = "0.1" termize = "0.1"
@ -56,7 +56,7 @@ tokio = { version = "1", features = ["io-util"] }
rustc-semver = "1.1" rustc-semver = "1.1"
[build-dependencies] [build-dependencies]
rustc_tools_util = {version = "0.2.1", path = "./rustc_tools_util"} rustc_tools_util = "0.3.0"
[features] [features]
deny-warnings = ["clippy_lints/deny-warnings"] deny-warnings = ["clippy_lints/deny-warnings"]

View file

@ -0,0 +1,6 @@
# Changelog
## Version 0.3.0
* Added `setup_version_info!();` macro for automated scripts.
* `get_version_info!()` no longer requires the user to import `rustc_tools_util::VersionInfo` and `std::env`

View file

@ -1,6 +1,6 @@
[package] [package]
name = "rustc_tools_util" name = "rustc_tools_util"
version = "0.2.1" version = "0.3.0"
description = "small helper to generate version information for git packages" description = "small helper to generate version information for git packages"
repository = "https://github.com/rust-lang/rust-clippy" repository = "https://github.com/rust-lang/rust-clippy"
readme = "README.md" readme = "README.md"

View file

@ -13,10 +13,10 @@ build = "build.rs"
List rustc_tools_util as regular AND build dependency. List rustc_tools_util as regular AND build dependency.
````toml ````toml
[dependencies] [dependencies]
rustc_tools_util = "0.2.1" rustc_tools_util = "0.3.0"
[build-dependencies] [build-dependencies]
rustc_tools_util = "0.2.1" rustc_tools_util = "0.3.0"
```` ````
In `build.rs`, generate the data in your `main()` In `build.rs`, generate the data in your `main()`
@ -44,6 +44,9 @@ This gives the following output in clippy:
This project is part of the rust-lang/rust-clippy repository. The source code This project is part of the rust-lang/rust-clippy repository. The source code
can be found under `./rustc_tools_util/`. can be found under `./rustc_tools_util/`.
The changelog for `rustc_tools_util` is available under:
[`rustc_tools_util/CHANGELOG.md`](https://github.com/rust-lang/rust-clippy/blob/master/rustc_tools_util/CHANGELOG.md)
## License ## License
Copyright 2014-2022 The Rust Project Developers Copyright 2014-2022 The Rust Project Developers

View file

@ -1,7 +1,5 @@
#![cfg_attr(feature = "deny-warnings", deny(warnings))] #![cfg_attr(feature = "deny-warnings", deny(warnings))]
use std::env;
/// This macro creates the version string during compilation from the /// This macro creates the version string during compilation from the
/// current environment /// current environment
#[macro_export] #[macro_export]
@ -121,7 +119,7 @@ pub fn get_commit_date() -> Option<String> {
#[must_use] #[must_use]
pub fn get_channel() -> String { pub fn get_channel() -> String {
match env::var("CFG_RELEASE_CHANNEL") { match std::env::var("CFG_RELEASE_CHANNEL") {
Ok(channel) => channel, Ok(channel) => channel,
Err(_) => { Err(_) => {
// if that failed, try to ask rustc -V, do some parsing and find out // if that failed, try to ask rustc -V, do some parsing and find out
@ -156,8 +154,8 @@ mod test {
fn test_struct_local() { fn test_struct_local() {
let vi = get_version_info!(); let vi = get_version_info!();
assert_eq!(vi.major, 0); assert_eq!(vi.major, 0);
assert_eq!(vi.minor, 2); assert_eq!(vi.minor, 3);
assert_eq!(vi.patch, 1); assert_eq!(vi.patch, 0);
assert_eq!(vi.crate_name, "rustc_tools_util"); assert_eq!(vi.crate_name, "rustc_tools_util");
// hard to make positive tests for these since they will always change // hard to make positive tests for these since they will always change
assert!(vi.commit_hash.is_none()); assert!(vi.commit_hash.is_none());
@ -167,7 +165,7 @@ mod test {
#[test] #[test]
fn test_display_local() { fn test_display_local() {
let vi = get_version_info!(); let vi = get_version_info!();
assert_eq!(vi.to_string(), "rustc_tools_util 0.2.1"); assert_eq!(vi.to_string(), "rustc_tools_util 0.3.0");
} }
#[test] #[test]
@ -176,7 +174,7 @@ mod test {
let s = format!("{vi:?}"); let s = format!("{vi:?}");
assert_eq!( assert_eq!(
s, s,
"VersionInfo { crate_name: \"rustc_tools_util\", major: 0, minor: 2, patch: 1 }" "VersionInfo { crate_name: \"rustc_tools_util\", major: 0, minor: 3, patch: 0 }"
); );
} }
} }