summaryrefslogtreecommitdiffstats
path: root/src/bootstrap/suggest.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
commitd1b2d29528b7794b41e66fc2136e395a02f8529b (patch)
treea4a17504b260206dec3cf55b2dca82929a348ac2 /src/bootstrap/suggest.rs
parentReleasing progress-linux version 1.72.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.tar.xz
rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.zip
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/bootstrap/suggest.rs')
-rw-r--r--src/bootstrap/suggest.rs24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/bootstrap/suggest.rs b/src/bootstrap/suggest.rs
index ff20ebec2..f225104bd 100644
--- a/src/bootstrap/suggest.rs
+++ b/src/bootstrap/suggest.rs
@@ -4,18 +4,11 @@ use std::str::FromStr;
use std::path::PathBuf;
-use crate::{
- builder::{Builder, Kind},
- tool::Tool,
-};
+use clap::Parser;
-#[cfg(feature = "build-metrics")]
-pub fn suggest(builder: &Builder<'_>, run: bool) {
- panic!("`x suggest` is not supported with `build-metrics`")
-}
+use crate::{builder::Builder, tool::Tool};
/// Suggests a list of possible `x.py` commands to run based on modified files in branch.
-#[cfg(not(feature = "build-metrics"))]
pub fn suggest(builder: &Builder<'_>, run: bool) {
let suggestions =
builder.tool_cmd(Tool::SuggestTests).output().expect("failed to run `suggest-tests` tool");
@@ -67,12 +60,13 @@ pub fn suggest(builder: &Builder<'_>, run: bool) {
if run {
for sug in suggestions {
- let mut build = builder.build.clone();
-
- let builder =
- Builder::new_standalone(&mut build, Kind::parse(&sug.0).unwrap(), sug.2, sug.1);
-
- builder.execute_cli()
+ let mut build: crate::Build = builder.build.clone();
+ build.config.paths = sug.2;
+ build.config.cmd = crate::flags::Flags::parse_from(["x.py", sug.0]).cmd;
+ if let Some(stage) = sug.1 {
+ build.config.stage = stage;
+ }
+ build.build();
}
} else {
println!("help: consider using the `--run` flag to automatically run suggested tests");