Skip to content

Commit a6fcb98

Browse files
authored
build.rs: fix inconsistent build (#11)
Ignore home and system bazelrc files. Add a protective if-clause in case the non_deprecated_watchfs hack was empty. Fixes #10
1 parent 430db80 commit a6fcb98

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

build.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ fn dump_flags(cache_dir: &Path, version: &str) -> Vec<u8> {
2020
};
2121
let result = bazelisk_cmd
2222
.env("USE_BAZEL_VERSION", version)
23+
.arg("--ignore_all_rc_files")
2324
.arg("help")
2425
.arg("flags-as-proto")
2526
.output()
@@ -134,10 +135,12 @@ fn main() -> Result<()> {
134135
let (mut deprecated_watchfs, mut non_deprecated_watchfs): (Vec<_>, Vec<_>) = watchfs_flags
135136
.into_iter()
136137
.partition(|f| f.metadata_tags.contains(&"DEPRECATED".to_string()));
137-
for flag in &mut deprecated_watchfs {
138-
non_deprecated_watchfs[0]
139-
.bazel_versions
140-
.append(&mut flag.bazel_versions);
138+
if !non_deprecated_watchfs.is_empty() {
139+
for flag in &mut deprecated_watchfs {
140+
non_deprecated_watchfs[0]
141+
.bazel_versions
142+
.append(&mut flag.bazel_versions);
143+
}
141144
}
142145
flags_by_name.insert("watchfs".to_string(), non_deprecated_watchfs);
143146

0 commit comments

Comments
 (0)