From 395977d0fc610ecd0b6abe53bd3bc2198b26fed7 Mon Sep 17 00:00:00 2001 From: Bill Fraser Date: Fri, 3 Jul 2020 12:20:44 -0700 Subject: [PATCH] write analysis to a separate directory under target/ This way it doesn't conflict with regular RLS data or the build itself. --- src/analysis.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/analysis.rs b/src/analysis.rs index d40a846..3de9ef7 100644 --- a/src/analysis.rs +++ b/src/analysis.rs @@ -2,6 +2,9 @@ use rls_analysis::{AnalysisHost, AnalysisLoader, SearchDirectory}; use std::convert::TryFrom; use std::path::{Path, PathBuf}; +/// Write the analysis data to a subdirectory under target/ with this name. +const SUBDIR: &str = "rsbrowse"; + pub struct Analysis { pub crates: Vec, } @@ -22,6 +25,8 @@ impl Analysis { let cargo_status = std::process::Command::new("cargo") .arg("check") + .arg("--target-dir") + .arg(Path::new("target").join(SUBDIR)) .env("RUSTFLAGS", "-Z save-analysis") .env("RUST_SAVE_ANALYSIS_CONFIG", &config_json) .current_dir(workspace_path) @@ -261,6 +266,7 @@ impl Loader { Self { deps_dir: path.into() .join("target") + .join(SUBDIR) .join(target) .join("deps") .join("save-analysis"),