about summary refs log tree commit diff
diff options
context:
space:
mode:
authoronur-ozkan <work@onurozkan.dev>2023-12-19 18:28:41 +0300
committeronur-ozkan <work@onurozkan.dev>2023-12-19 18:28:41 +0300
commit4ba1487e157c3d67ccac4e75b4a335494cbb3b3a (patch)
tree507ea85087e2d9d0e8f6a7947a8f145bbb6d8ff1
parentbccac41db7cc894aeb9487bc97bc52698143145e (diff)
implement remapper for build paths
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 <work@onurozkan.dev>
-rw-r--r--src/bootstrap/src/core/builder.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/bootstrap/src/core/builder.rs b/src/bootstrap/src/core/builder.rs
index 28761a7ee4b..df8e3e8fd23 100644
--- a/src/bootstrap/src/core/builder.rs
+++ b/src/bootstrap/src/core/builder.rs
@@ -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 {
@@ -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| {