Skip to content

Commit

Permalink
implement remapper for build paths
Browse files Browse the repository at this point in the history
In config.toml we use `rust-analyzer-proc-macro-srv` for building `rust-analyzer-proc-macro-srv`,
however, when we attempt to build it from the terminal, this cannot be used because we need to
use the actual path, which is `proc-macro-srv-cli`. Remapping should end this confusion with
improving the development experience.

Signed-off-by: onur-ozkan <[email protected]>
  • Loading branch information
onur-ozkan committed Dec 19, 2023
1 parent bccac41 commit 4ba1487
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/bootstrap/src/core/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,18 @@ impl PathSet {
}
}

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 {
Expand Down Expand Up @@ -361,6 +373,8 @@ impl StepDescription {
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| {
Expand Down

0 comments on commit 4ba1487

Please sign in to comment.