Skip to content

Commit 8258589

Browse files
tesujitgross35
authored andcommitted
Migrate libc-test to 2018 edition
edition: cannot update to 2021 edition because of libc msrv. cargo of rust 1.19 cannot understand edition key in cargo.toml. (cherry picked from commit 4057a9a) avoid rebuilding libc-test no semver vendor = 'unknown' (cherry picked from commit de2c8a7) use rel path for semver (cherry picked from commit d6d56f1) (apply <#3718> to `main`) [ resolve conflicts, squash for easier cherry-picks - Trevor ]
1 parent 983eb58 commit 8258589

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

libc-test/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[package]
22
name = "libc-test"
33
version = "0.2.151"
4+
edition = "2018"
45
authors = ["The Rust Project Developers"]
56
license = "MIT OR Apache-2.0"
67
build = "build.rs"

libc-test/build.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ fn do_semver() {
8282
let target_env = env::var("CARGO_CFG_TARGET_ENV").unwrap();
8383

8484
// `libc-test/semver` dir.
85-
let mut semver_root = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
86-
semver_root.push("semver");
85+
let mut semver_root = PathBuf::from("semver");
8786

8887
// NOTE: Windows has the same `family` as `os`, no point in including it
8988
// twice.
@@ -93,7 +92,10 @@ fn do_semver() {
9392
if family != os && os != "android" {
9493
process_semver_file(&mut output, &mut semver_root, &family);
9594
}
96-
process_semver_file(&mut output, &mut semver_root, &vendor);
95+
// We don't do semver for unknown targets.
96+
if vendor != "unknown" {
97+
process_semver_file(&mut output, &mut semver_root, &vendor);
98+
}
9799
process_semver_file(&mut output, &mut semver_root, &os);
98100
let os_arch = format!("{}-{}", os, arch);
99101
process_semver_file(&mut output, &mut semver_root, &os_arch);
@@ -141,6 +143,9 @@ fn process_semver_file<W: Write, P: AsRef<Path>>(output: &mut W, path: &mut Path
141143
}
142144

143145
fn main() {
146+
// Avoid unnecessary re-building.
147+
println!("cargo:rerun-if-changed=build.rs");
148+
144149
do_cc();
145150
do_ctest();
146151
do_semver();

0 commit comments

Comments
 (0)