mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-12 21:28:51 +00:00
Inline ra_batch
This commit is contained in:
parent
559c5f37f6
commit
d7be1da8df
8 changed files with 24 additions and 50 deletions
22
Cargo.lock
generated
22
Cargo.lock
generated
|
@ -917,21 +917,6 @@ dependencies = [
|
|||
"test_utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ra_batch"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"crossbeam-channel",
|
||||
"log",
|
||||
"ra_db",
|
||||
"ra_hir",
|
||||
"ra_ide",
|
||||
"ra_project_model",
|
||||
"ra_vfs",
|
||||
"ra_vfs_glob",
|
||||
"rustc-hash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ra_cargo_watch"
|
||||
version = "0.1.0"
|
||||
|
@ -960,18 +945,23 @@ dependencies = [
|
|||
name = "ra_cli"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"crossbeam-channel",
|
||||
"env_logger",
|
||||
"itertools",
|
||||
"log",
|
||||
"pico-args",
|
||||
"ra_batch",
|
||||
"ra_db",
|
||||
"ra_hir",
|
||||
"ra_hir_def",
|
||||
"ra_hir_ty",
|
||||
"ra_ide",
|
||||
"ra_prof",
|
||||
"ra_project_model",
|
||||
"ra_syntax",
|
||||
"ra_vfs",
|
||||
"ra_vfs_glob",
|
||||
"rand",
|
||||
"rustc-hash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
[package]
|
||||
edition = "2018"
|
||||
name = "ra_batch"
|
||||
version = "0.1.0"
|
||||
authors = ["rust-analyzer developers"]
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
log = "0.4.5"
|
||||
rustc-hash = "1.0"
|
||||
crossbeam-channel = "0.4.0"
|
||||
|
||||
ra_vfs = "0.5.0"
|
||||
ra_vfs_glob = { path = "../ra_vfs_glob" }
|
||||
ra_db = { path = "../ra_db" }
|
||||
ra_ide = { path = "../ra_ide" }
|
||||
ra_hir = { path = "../ra_hir" }
|
||||
ra_project_model = { path = "../ra_project_model" }
|
|
@ -6,18 +6,23 @@ authors = ["rust-analyzer developers"]
|
|||
publish = false
|
||||
|
||||
[dependencies]
|
||||
itertools = "0.8.0"
|
||||
pico-args = "0.3.0"
|
||||
crossbeam-channel = "0.4.0"
|
||||
env_logger = { version = "0.7.1", default-features = false }
|
||||
itertools = "0.8.0"
|
||||
log = "0.4.5"
|
||||
pico-args = "0.3.0"
|
||||
rand = { version = "0.7.0", features = ["small_rng"] }
|
||||
rustc-hash = "1.0"
|
||||
|
||||
ra_syntax = { path = "../ra_syntax" }
|
||||
ra_ide = { path = "../ra_ide" }
|
||||
ra_batch = { path = "../ra_batch" }
|
||||
hir = { path = "../ra_hir", package = "ra_hir" }
|
||||
hir_ty = { path = "../ra_hir_ty", package = "ra_hir_ty" }
|
||||
hir_def = { path = "../ra_hir_def", package = "ra_hir_def" }
|
||||
hir_ty = { path = "../ra_hir_ty", package = "ra_hir_ty" }
|
||||
ra_db = { path = "../ra_db" }
|
||||
ra_ide = { path = "../ra_ide" }
|
||||
ra_project_model = { path = "../ra_project_model" }
|
||||
ra_syntax = { path = "../ra_syntax" }
|
||||
ra_vfs = "0.5.0"
|
||||
ra_vfs_glob = { path = "../ra_vfs_glob" }
|
||||
|
||||
[dependencies.ra_prof]
|
||||
path = "../ra_prof"
|
||||
|
|
|
@ -13,7 +13,7 @@ use ra_db::{
|
|||
};
|
||||
use ra_ide::{Analysis, AnalysisChange, AnalysisHost, FilePosition, LineCol};
|
||||
|
||||
use crate::Result;
|
||||
use crate::{load_cargo::load_cargo, Result};
|
||||
|
||||
pub(crate) struct Position {
|
||||
path: PathBuf,
|
||||
|
@ -46,7 +46,7 @@ pub(crate) fn run(verbose: bool, path: &Path, op: Op) -> Result<()> {
|
|||
|
||||
let start = Instant::now();
|
||||
eprint!("loading: ");
|
||||
let (mut host, roots) = ra_batch::load_cargo(path)?;
|
||||
let (mut host, roots) = load_cargo(path)?;
|
||||
let db = host.raw_database();
|
||||
eprintln!("{:?}\n", start.elapsed());
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ use ra_db::SourceDatabaseExt;
|
|||
use ra_syntax::AstNode;
|
||||
use rand::{seq::SliceRandom, thread_rng};
|
||||
|
||||
use crate::{progress_report::ProgressReport, Result, Verbosity};
|
||||
use crate::{load_cargo::load_cargo, progress_report::ProgressReport, Result, Verbosity};
|
||||
|
||||
pub fn run(
|
||||
verbosity: Verbosity,
|
||||
|
@ -24,7 +24,7 @@ pub fn run(
|
|||
randomize: bool,
|
||||
) -> Result<()> {
|
||||
let db_load_time = Instant::now();
|
||||
let (mut host, roots) = ra_batch::load_cargo(path)?;
|
||||
let (mut host, roots) = load_cargo(path)?;
|
||||
let db = host.raw_database();
|
||||
println!("Database loaded, {} roots, {:?}", roots.len(), db_load_time.elapsed());
|
||||
let analysis_time = Instant::now();
|
||||
|
|
|
@ -139,7 +139,8 @@ pub fn load(
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use ra_hir::Crate;
|
||||
|
||||
use hir::Crate;
|
||||
|
||||
#[test]
|
||||
fn test_loading_rust_analyzer() {
|
|
@ -1,5 +1,6 @@
|
|||
//! FIXME: write short doc here
|
||||
|
||||
mod load_cargo;
|
||||
mod analysis_stats;
|
||||
mod analysis_bench;
|
||||
mod progress_report;
|
||||
|
@ -157,12 +158,10 @@ ARGS:
|
|||
let path = {
|
||||
let mut trailing = matches.free()?;
|
||||
if trailing.len() != 1 {
|
||||
eprintln!("{}", help::ANALYSIS_STATS_HELP);
|
||||
Err("Invalid flags")?;
|
||||
}
|
||||
trailing.pop().unwrap()
|
||||
};
|
||||
matches.finish().or_else(handle_extra_flags)?;
|
||||
|
||||
analysis_stats::run(
|
||||
verbosity,
|
||||
|
|
|
@ -73,7 +73,6 @@ fn no_docs_comments() {
|
|||
}
|
||||
|
||||
let whitelist = [
|
||||
"ra_batch",
|
||||
"ra_cli",
|
||||
"ra_db",
|
||||
"ra_hir",
|
||||
|
|
Loading…
Reference in a new issue