Skip to content

Commit 4f157a8

Browse files
committed
Prevent build.rs rerunning unnecessarily on all source changes
1 parent d493649 commit 4f157a8

File tree

5 files changed

+11
-0
lines changed

5 files changed

+11
-0
lines changed

serde/build.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ use std::str::{self, FromStr};
66
// opening a GitHub issue if your build environment requires some way to enable
77
// these cfgs other than by executing our build script.
88
fn main() {
9+
println!("cargo:rerun-if-changed=build.rs");
10+
911
let minor = match rustc_minor_version() {
1012
Some(minor) => minor,
1113
None => return,

serde_derive/build.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ use std::str;
66
// opening a GitHub issue if your build environment requires some way to enable
77
// these cfgs other than by executing our build script.
88
fn main() {
9+
println!("cargo:rerun-if-changed=build.rs");
10+
911
let minor = match rustc_minor_version() {
1012
Some(minor) => minor,
1113
None => return,

serde_derive_internals/build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
use std::path::Path;
22

33
fn main() {
4+
println!("cargo:rerun-if-changed=build.rs");
5+
println!("cargo:rerun-if-changed=src/mod.rs");
6+
47
// Sometimes on Windows the git checkout does not correctly wire up the
58
// symlink from serde_derive_internals/src to serde_derive/src/internals.
69
// When this happens we'll just build based on relative paths within the git

serde_test/build.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ use std::str::{self, FromStr};
66
// opening a GitHub issue if your build environment requires some way to enable
77
// these cfgs other than by executing our build script.
88
fn main() {
9+
println!("cargo:rerun-if-changed=build.rs");
10+
911
let minor = match rustc_minor_version() {
1012
Some(minor) => minor,
1113
None => return,

test_suite/build.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ fn has_cargo_expand() -> bool {
1919
}
2020

2121
fn main() {
22+
println!("cargo:rerun-if-changed=build.rs");
23+
2224
if cfg!(feature = "expandtest") && has_cargo_expand() {
2325
println!("cargo:rustc-cfg=expandtest");
2426
}

0 commit comments

Comments
 (0)