Rollup merge of #119124 - onur-ozkan:help-118861, r=Mark-Simulacrum

don't build `rust-analyzer-proc-macro-srv` on def config

Should be very easy to understand when reviewing commit-by-commit.

Blocker for #118861
This commit is contained in:
Matthias Krüger 2023-12-21 16:43:07 +01:00 committed by GitHub
commit c644d00285
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 5 deletions

View File

@ -323,6 +323,7 @@
# "rustdoc",
# "rustfmt",
# "rust-analyzer",
# "rust-analyzer-proc-macro-srv",
# "analysis",
# "src",
# "rust-demangler", # if profiler = true

View File

@ -671,11 +671,14 @@ fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
// Allow building `rust-analyzer-proc-macro-srv` both as part of the `rust-analyzer` and as a stand-alone tool.
run.path("src/tools/rust-analyzer")
.path("src/tools/rust-analyzer/crates/proc-macro-srv-cli")
.default_condition(builder.config.tools.as_ref().map_or(true, |tools| {
tools
.iter()
.any(|tool| tool == "rust-analyzer" || tool == "rust-analyzer-proc-macro-srv")
}))
.default_condition(
builder.config.extended
&& builder.config.tools.as_ref().map_or(true, |tools| {
tools.iter().any(|tool| {
tool == "rust-analyzer" || tool == "rust-analyzer-proc-macro-srv"
})
}),
)
}
fn make_run(run: RunConfig<'_>) {

View File

@ -289,6 +289,18 @@ pub fn assert_single_path(&self) -> &TaskPath {
}
}
const PATH_REMAP: &[(&str, &str)] = &[("rust-analyzer-proc-macro-srv", "proc-macro-srv-cli")];
fn remap_paths(paths: &mut Vec<&Path>) {
for path in paths.iter_mut() {
for &(search, replace) in PATH_REMAP {
if path.to_str() == Some(search) {
*path = Path::new(replace)
}
}
}
}
impl StepDescription {
fn from<S: Step>(kind: Kind) -> StepDescription {
StepDescription {
@ -361,6 +373,8 @@ fn run(v: &[StepDescription], builder: &Builder<'_>, paths: &[PathBuf]) {
let mut paths: Vec<_> =
paths.into_iter().map(|p| p.strip_prefix(".").unwrap_or(p)).collect();
remap_paths(&mut paths);
// Handle all test suite paths.
// (This is separate from the loop below to avoid having to handle multiple paths in `is_suite_path` somehow.)
paths.retain(|path| {

View File

@ -96,4 +96,9 @@ pub fn find_recent_config_change_ids(current_id: usize) -> Vec<ChangeInfo> {
severity: ChangeSeverity::Info,
summary: "Removed rust.run_dsymutil and dist.gpg_password_file config options, as they were unused.",
},
ChangeInfo {
change_id: 119124,
severity: ChangeSeverity::Warning,
summary: "rust-analyzer-proc-macro-srv is no longer enabled by default. To build it, you must either enable it in the configuration or explicitly invoke it with x.py.",
},
];