Skip to content

Commit

Permalink
write analysis to a separate directory under target/
Browse files Browse the repository at this point in the history
This way it doesn't conflict with regular RLS data or the build itself.
  • Loading branch information
wfraser committed Jul 3, 2020
1 parent b42c3fe commit 395977d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Crate>,
}
Expand All @@ -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)
Expand Down Expand Up @@ -261,6 +266,7 @@ impl Loader {
Self {
deps_dir: path.into()
.join("target")
.join(SUBDIR)
.join(target)
.join("deps")
.join("save-analysis"),
Expand Down

0 comments on commit 395977d

Please sign in to comment.