Skip to content

Commit dd6bebf

Browse files
Add rerun-if-changed directives to all build scripts
1 parent 0471e3d commit dd6bebf

File tree

9 files changed

+53
-15
lines changed

9 files changed

+53
-15
lines changed

collector/benchmarks/ripgrep/build.rs

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use app::{RGArg, RGArgKind};
1818
mod app;
1919

2020
fn main() {
21+
println!("cargo:rerun-if-changed=build.rs");
2122
// OUT_DIR is set by Cargo and it's where any additional build artifacts
2223
// are written.
2324
let outdir = match env::var_os("OUT_DIR") {
@@ -26,7 +27,8 @@ fn main() {
2627
eprintln!(
2728
"OUT_DIR environment variable not defined. \
2829
Please file a bug: \
29-
https://github.com/BurntSushi/ripgrep/issues/new");
30+
https://github.com/BurntSushi/ripgrep/issues/new"
31+
);
3032
process::exit(1);
3133
}
3234
};
@@ -95,8 +97,10 @@ fn generate_man_page<P: AsRef<Path>>(outdir: P) -> io::Result<()> {
9597
File::create(&txt_path)?.write_all(tpl.as_bytes())?;
9698
let result = process::Command::new("a2x")
9799
.arg("--no-xmllint")
98-
.arg("--doctype").arg("manpage")
99-
.arg("--format").arg("manpage")
100+
.arg("--doctype")
101+
.arg("manpage")
102+
.arg("--format")
103+
.arg("manpage")
100104
.arg(&txt_path)
101105
.spawn()?
102106
.wait()?;
@@ -119,7 +123,7 @@ fn formatted_options() -> io::Result<String> {
119123
// ripgrep only has two positional arguments, and probably will only
120124
// ever have two positional arguments, so we just hardcode them into
121125
// the template.
122-
if let app::RGArgKind::Positional{..} = arg.kind {
126+
if let app::RGArgKind::Positional { .. } = arg.kind {
123127
continue;
124128
}
125129
formatted.push(formatted_arg(&arg)?);
@@ -129,8 +133,12 @@ fn formatted_options() -> io::Result<String> {
129133

130134
fn formatted_arg(arg: &RGArg) -> io::Result<String> {
131135
match arg.kind {
132-
RGArgKind::Positional{..} => panic!("unexpected positional argument"),
133-
RGArgKind::Switch { long, short, multiple } => {
136+
RGArgKind::Positional { .. } => panic!("unexpected positional argument"),
137+
RGArgKind::Switch {
138+
long,
139+
short,
140+
multiple,
141+
} => {
134142
let mut out = vec![];
135143

136144
let mut header = format!("--{}", long);
@@ -147,7 +155,13 @@ fn formatted_arg(arg: &RGArg) -> io::Result<String> {
147155

148156
Ok(String::from_utf8(out).unwrap())
149157
}
150-
RGArgKind::Flag { long, short, value_name, multiple, .. } => {
158+
RGArgKind::Flag {
159+
long,
160+
short,
161+
value_name,
162+
multiple,
163+
..
164+
} => {
151165
let mut out = vec![];
152166

153167
let mut header = format!("--{}", long);

collector/benchmarks/script-servo-2/components/atoms/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ fn main() {
2828
.atoms(static_atoms.lines().map(Result::unwrap))
2929
.write_to_file(&Path::new(&env::var_os("OUT_DIR").unwrap()).join("atom.rs"))
3030
.unwrap();
31+
println!("cargo:rerun-if-changed=build.rs");
3132
}

collector/benchmarks/script-servo-2/components/compositing/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use std::io::{Read, Write};
88
use std::path::Path;
99

1010
fn main() {
11+
println!("cargo:rerun-if-changed=build.rs");
1112
let lockfile_path = Path::new(&env::var("CARGO_MANIFEST_DIR").unwrap())
1213
.join("..")
1314
.join("..")

collector/benchmarks/script-servo-2/components/net/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
44

55
fn main() {
6+
println!("cargo:rerun-if-changed=build.rs");
67
let version =
78
std::env::var("DEP_OPENSSL_VERSION_NUMBER").expect("missing DEP_OPENSSL_VERSION_NUMBER");
89
let actual = u64::from_str_radix(&version, 16).unwrap();

collector/benchmarks/script-servo-2/components/script/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ fn main() {
4444
map.build(),
4545
)
4646
.unwrap();
47+
println!("cargo:rerun-if-changed=build.rs");
4748
}
4849

4950
#[derive(Eq, Hash, PartialEq)]

collector/benchmarks/script-servo-2/ports/gstplugin/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
44

55
fn main() {
6+
println!("cargo:rerun-if-changed=build.rs");
67
gst_plugin_version_helper::get_info()
78
}

collector/benchmarks/script-servo-2/ports/winit/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ fn main() {
2222
.file("platform/macos/count_threads.c")
2323
.compile("count_threads");
2424
}
25+
println!("cargo:rerun-if-changed=build.rs");
2526
}

collector/benchmarks/style-servo/components/atoms/build.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ extern crate string_cache_codegen;
66

77
use std::env;
88
use std::fs::File;
9-
use std::io::{BufReader, BufRead};
9+
use std::io::{BufRead, BufReader};
1010
use std::path::Path;
1111

1212
fn main() {
@@ -29,4 +29,5 @@ fn main() {
2929
.atoms(static_atoms.lines().map(Result::unwrap))
3030
.write_to_file(&Path::new(&env::var("OUT_DIR").unwrap()).join("atom.rs"))
3131
.unwrap();
32+
println!("cargo:rerun-if-changed=build.rs");
3233
}

collector/benchmarks/style-servo/components/script/build.rs

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use std::path::PathBuf;
1616
use std::time::Instant;
1717

1818
fn main() {
19+
println!("cargo:rerun-if-changed=build.rs");
1920
let start = Instant::now();
2021

2122
// This must use the Ninja generator -- it's the only one that
@@ -31,30 +32,46 @@ fn main() {
3132
build.generator("Ninja");
3233
// because we're using ninja, we need to explicitly set these
3334
// to VC++, otherwise it'll try to use cc
34-
build.define("CMAKE_C_COMPILER", "cl.exe")
35-
.define("CMAKE_CXX_COMPILER", "cl.exe");
35+
build
36+
.define("CMAKE_C_COMPILER", "cl.exe")
37+
.define("CMAKE_CXX_COMPILER", "cl.exe");
3638
// We have to explicitly specify the full path to link.exe,
3739
// for reasons that I don't understand. If we just give
3840
// link.exe, it tries to use script-*/out/link.exe, which of
3941
// course does not exist.
40-
let link = std::process::Command::new("where").arg("link.exe").output().unwrap();
41-
let link_path: Vec<&str> = std::str::from_utf8(&link.stdout).unwrap().split("\r\n").collect();
42+
let link = std::process::Command::new("where")
43+
.arg("link.exe")
44+
.output()
45+
.unwrap();
46+
let link_path: Vec<&str> = std::str::from_utf8(&link.stdout)
47+
.unwrap()
48+
.split("\r\n")
49+
.collect();
4250
build.define("CMAKE_LINKER", link_path[0]);
4351
}
4452

4553
build.build();
4654

47-
println!("Binding generation completed in {}s", start.elapsed().as_secs());
55+
println!(
56+
"Binding generation completed in {}s",
57+
start.elapsed().as_secs()
58+
);
4859

49-
let json = PathBuf::from(env::var("OUT_DIR").unwrap()).join("build").join("InterfaceObjectMapData.json");
60+
let json = PathBuf::from(env::var("OUT_DIR").unwrap())
61+
.join("build")
62+
.join("InterfaceObjectMapData.json");
5063
let json: Value = serde_json::from_reader(File::open(&json).unwrap()).unwrap();
5164
let mut map = phf_codegen::Map::new();
5265
for (key, value) in json.as_object().unwrap() {
5366
map.entry(Bytes(key), value.as_str().unwrap());
5467
}
5568
let phf = PathBuf::from(env::var("OUT_DIR").unwrap()).join("InterfaceObjectMapPhf.rs");
5669
let mut phf = File::create(&phf).unwrap();
57-
write!(&mut phf, "pub static MAP: phf::Map<&'static [u8], unsafe fn(*mut JSContext, HandleObject)> = ").unwrap();
70+
write!(
71+
&mut phf,
72+
"pub static MAP: phf::Map<&'static [u8], unsafe fn(*mut JSContext, HandleObject)> = "
73+
)
74+
.unwrap();
5875
map.build(&mut phf).unwrap();
5976
write!(&mut phf, ";\n").unwrap();
6077
}

0 commit comments

Comments
 (0)