-
-
Notifications
You must be signed in to change notification settings - Fork 257
/
Copy pathbuild.rs
27 lines (26 loc) · 1000 Bytes
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//LICENSE Portions Copyright 2019-2021 ZomboDB, LLC.
//LICENSE
//LICENSE Portions Copyright 2021-2023 Technology Concepts & Design, Inc.
//LICENSE
//LICENSE Portions Copyright 2023-2023 PgCentral Foundation, Inc. <[email protected]>
//LICENSE
//LICENSE All rights reserved.
//LICENSE
//LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file.
fn main() {
println!("cargo:rerun-if-changed=build.rs");
if let Some(minor_version) = rust_minor_version() {
println!("cargo:rustc-env=MINOR_RUST_VERSION={minor_version}");
}
}
fn rust_minor_version() -> Option<u32> {
let rustc = std::env::var_os("RUSTC").unwrap_or_else(|| "rustc".into());
let output = std::process::Command::new(rustc).arg("--version").output().ok()?;
let version = std::str::from_utf8(&output.stdout).ok()?;
let mut iter = version.split('.');
if iter.next() != Some("rustc 1") {
None
} else {
iter.next()?.parse().ok()
}
}