Skip to content

Commit

Permalink
Simplify build script
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron1011 committed Aug 28, 2019
1 parent c11d4b4 commit 2974b16
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions pin-project-internal/build.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
// https://stackoverflow.com/a/49250753/1290530
// Based on https://stackoverflow.com/a/49250753/1290530

use rustc_version::{version_meta, Channel};

fn main() {
// Set cfg flags depending on release channel
match version_meta().unwrap().channel {
Channel::Stable => {
println!("cargo:rustc-cfg=RUSTC_IS_STABLE");
}
Channel::Beta => {
println!("cargo:rustc-cfg=RUSTC_IS_BETA");
}
Channel::Nightly => {
// Enable our feature on nightly, or when using a
// locally build rustc
Channel::Nightly | Channel::Dev => {
println!("cargo:rustc-cfg=feature=\"RUSTC_IS_NIGHTLY\"");
}
Channel::Dev => {
println!("cargo:rustc-cfg=RUSTC_IS_DEV");
}
_ => {}
}
}

0 comments on commit 2974b16

Please sign in to comment.