Prevent build.rs rerunning unnecessarily on all source changes

This commit is contained in:
David Tolnay 2022-12-12 14:37:41 -08:00
parent d493649f52
commit 4f157a8b81
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
5 changed files with 11 additions and 0 deletions

View File

@ -6,6 +6,8 @@ use std::str::{self, FromStr};
// opening a GitHub issue if your build environment requires some way to enable
// these cfgs other than by executing our build script.
fn main() {
println!("cargo:rerun-if-changed=build.rs");
let minor = match rustc_minor_version() {
Some(minor) => minor,
None => return,

View File

@ -6,6 +6,8 @@ use std::str;
// opening a GitHub issue if your build environment requires some way to enable
// these cfgs other than by executing our build script.
fn main() {
println!("cargo:rerun-if-changed=build.rs");
let minor = match rustc_minor_version() {
Some(minor) => minor,
None => return,

View File

@ -1,6 +1,9 @@
use std::path::Path;
fn main() {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=src/mod.rs");
// Sometimes on Windows the git checkout does not correctly wire up the
// symlink from serde_derive_internals/src to serde_derive/src/internals.
// When this happens we'll just build based on relative paths within the git

View File

@ -6,6 +6,8 @@ use std::str::{self, FromStr};
// opening a GitHub issue if your build environment requires some way to enable
// these cfgs other than by executing our build script.
fn main() {
println!("cargo:rerun-if-changed=build.rs");
let minor = match rustc_minor_version() {
Some(minor) => minor,
None => return,

View File

@ -19,6 +19,8 @@ fn has_cargo_expand() -> bool {
}
fn main() {
println!("cargo:rerun-if-changed=build.rs");
if cfg!(feature = "expandtest") && has_cargo_expand() {
println!("cargo:rustc-cfg=expandtest");
}