Skip to content

Commit 3de5c86

Browse files
authored
Unrolled build for #144317
Rollup merge of #144317 - lolbinarycat:tidy-obey-build.npm, r=Kobzol pass build.npm from bootstrap to tidy and use it for npm install followup to #142924 r? ```@Kobzol```
2 parents 5d22242 + 2d1fccd commit 3de5c86

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

src/bootstrap/src/core/build_steps/test.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,6 +1113,12 @@ impl Step for Tidy {
11131113
8 * std::thread::available_parallelism().map_or(1, std::num::NonZeroUsize::get) as u32
11141114
});
11151115
cmd.arg(jobs.to_string());
1116+
// pass the path to the npm command used for installing js deps.
1117+
if let Some(npm) = &builder.config.npm {
1118+
cmd.arg(npm);
1119+
} else {
1120+
cmd.arg("npm");
1121+
}
11161122
if builder.is_verbose() {
11171123
cmd.arg("--verbose");
11181124
}

src/tools/tidy/src/ext_tool_checks.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ pub fn check(
5050
ci_info: &CiInfo,
5151
librustdoc_path: &Path,
5252
tools_path: &Path,
53+
npm: &Path,
5354
bless: bool,
5455
extra_checks: Option<&str>,
5556
pos_args: &[String],
@@ -61,6 +62,7 @@ pub fn check(
6162
ci_info,
6263
librustdoc_path,
6364
tools_path,
65+
npm,
6466
bless,
6567
extra_checks,
6668
pos_args,
@@ -75,6 +77,7 @@ fn check_impl(
7577
ci_info: &CiInfo,
7678
librustdoc_path: &Path,
7779
tools_path: &Path,
80+
npm: &Path,
7881
bless: bool,
7982
extra_checks: Option<&str>,
8083
pos_args: &[String],
@@ -293,7 +296,7 @@ fn check_impl(
293296
}
294297

295298
if js_lint || js_typecheck {
296-
rustdoc_js::npm_install(root_path, outdir)?;
299+
rustdoc_js::npm_install(root_path, outdir, npm)?;
297300
}
298301

299302
if js_lint {

src/tools/tidy/src/ext_tool_checks/rustdoc_js.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ fn spawn_cmd(cmd: &mut Command) -> Result<Child, io::Error> {
2323
}
2424

2525
/// install all js dependencies from package.json.
26-
pub(super) fn npm_install(root_path: &Path, outdir: &Path) -> Result<(), super::Error> {
27-
// FIXME(lolbinarycat): make this obey build.npm bootstrap option
28-
npm::install(root_path, outdir, Path::new("npm"))?;
26+
pub(super) fn npm_install(root_path: &Path, outdir: &Path, npm: &Path) -> Result<(), super::Error> {
27+
npm::install(root_path, outdir, npm)?;
2928
Ok(())
3029
}
3130

src/tools/tidy/src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ fn main() {
2929
let concurrency: NonZeroUsize =
3030
FromStr::from_str(&env::args().nth(4).expect("need concurrency"))
3131
.expect("concurrency must be a number");
32+
let npm: PathBuf = env::args_os().nth(5).expect("need name/path of npm command").into();
3233

3334
let root_manifest = root_path.join("Cargo.toml");
3435
let src_path = root_path.join("src");
@@ -182,6 +183,7 @@ fn main() {
182183
&ci_info,
183184
&librustdoc_path,
184185
&tools_path,
186+
&npm,
185187
bless,
186188
extra_checks,
187189
pos_args

0 commit comments

Comments
 (0)