From eac24d52e672c0a9c118e8969bf1b839c3e7f1f3 Mon Sep 17 00:00:00 2001 From: Pavan Kumar Sunkara Date: Thu, 13 Aug 2020 12:05:30 +0200 Subject: [PATCH] Rename ra_project_model -> project_model --- Cargo.lock | 40 +++++++++---------- .../Cargo.toml | 17 ++++---- .../src/cargo_workspace.rs | 0 .../src/cfg_flag.rs | 0 .../src/lib.rs | 0 .../src/project_json.rs | 0 .../src/sysroot.rs | 0 crates/rust-analyzer/Cargo.toml | 2 +- crates/rust-analyzer/src/bin/main.rs | 2 +- crates/rust-analyzer/src/cargo_target_spec.rs | 2 +- crates/rust-analyzer/src/cli/load_cargo.rs | 2 +- crates/rust-analyzer/src/config.rs | 2 +- crates/rust-analyzer/src/global_state.rs | 2 +- crates/rust-analyzer/src/handlers.rs | 2 +- crates/rust-analyzer/src/main_loop.rs | 2 +- crates/rust-analyzer/src/reload.rs | 6 +-- .../tests/heavy_tests/support.rs | 2 +- xtask/tests/tidy.rs | 2 +- 18 files changed, 40 insertions(+), 43 deletions(-) rename crates/{ra_project_model => project_model}/Cargo.toml (91%) rename crates/{ra_project_model => project_model}/src/cargo_workspace.rs (100%) rename crates/{ra_project_model => project_model}/src/cfg_flag.rs (100%) rename crates/{ra_project_model => project_model}/src/lib.rs (100%) rename crates/{ra_project_model => project_model}/src/project_json.rs (100%) rename crates/{ra_project_model => project_model}/src/sysroot.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 18c979b39e..f72d9e022d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -938,6 +938,25 @@ dependencies = [ "perf-event", ] +[[package]] +name = "project_model" +version = "0.0.0" +dependencies = [ + "anyhow", + "arena", + "cargo_metadata", + "cfg", + "log", + "paths", + "ra_db", + "ra_proc_macro", + "rustc-hash", + "serde", + "serde_json", + "stdx", + "toolchain", +] + [[package]] name = "quote" version = "1.0.7" @@ -1134,25 +1153,6 @@ dependencies = [ "tt", ] -[[package]] -name = "ra_project_model" -version = "0.1.0" -dependencies = [ - "anyhow", - "arena", - "cargo_metadata", - "cfg", - "log", - "paths", - "ra_db", - "ra_proc_macro", - "rustc-hash", - "serde", - "serde_json", - "stdx", - "toolchain", -] - [[package]] name = "ra_ssr" version = "0.1.0" @@ -1257,13 +1257,13 @@ dependencies = [ "pico-args", "proc_macro_srv", "profile", + "project_model", "ra_db", "ra_hir", "ra_hir_def", "ra_hir_ty", "ra_ide", "ra_ide_db", - "ra_project_model", "ra_ssr", "rayon", "rustc-hash", diff --git a/crates/ra_project_model/Cargo.toml b/crates/project_model/Cargo.toml similarity index 91% rename from crates/ra_project_model/Cargo.toml rename to crates/project_model/Cargo.toml index 52f2d57b3b..8d8d093879 100644 --- a/crates/ra_project_model/Cargo.toml +++ b/crates/project_model/Cargo.toml @@ -1,9 +1,9 @@ [package] -edition = "2018" -name = "ra_project_model" -version = "0.1.0" -authors = ["rust-analyzer developers"] +name = "project_model" +version = "0.0.0" license = "MIT OR Apache-2.0" +authors = ["rust-analyzer developers"] +edition = "2018" [lib] doctest = false @@ -11,8 +11,10 @@ doctest = false [dependencies] log = "0.4.8" rustc-hash = "1.1.0" - cargo_metadata = "0.11.1" +serde = { version = "1.0.106", features = ["derive"] } +serde_json = "1.0.48" +anyhow = "1.0.26" arena = { path = "../arena" } cfg = { path = "../cfg" } @@ -21,8 +23,3 @@ toolchain = { path = "../toolchain" } ra_proc_macro = { path = "../ra_proc_macro" } paths = { path = "../paths" } stdx = { path = "../stdx" } - -serde = { version = "1.0.106", features = ["derive"] } -serde_json = "1.0.48" - -anyhow = "1.0.26" diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/project_model/src/cargo_workspace.rs similarity index 100% rename from crates/ra_project_model/src/cargo_workspace.rs rename to crates/project_model/src/cargo_workspace.rs diff --git a/crates/ra_project_model/src/cfg_flag.rs b/crates/project_model/src/cfg_flag.rs similarity index 100% rename from crates/ra_project_model/src/cfg_flag.rs rename to crates/project_model/src/cfg_flag.rs diff --git a/crates/ra_project_model/src/lib.rs b/crates/project_model/src/lib.rs similarity index 100% rename from crates/ra_project_model/src/lib.rs rename to crates/project_model/src/lib.rs diff --git a/crates/ra_project_model/src/project_json.rs b/crates/project_model/src/project_json.rs similarity index 100% rename from crates/ra_project_model/src/project_json.rs rename to crates/project_model/src/project_json.rs diff --git a/crates/ra_project_model/src/sysroot.rs b/crates/project_model/src/sysroot.rs similarity index 100% rename from crates/ra_project_model/src/sysroot.rs rename to crates/project_model/src/sysroot.rs diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml index 440b1cd134..c6102bf272 100644 --- a/crates/rust-analyzer/Cargo.toml +++ b/crates/rust-analyzer/Cargo.toml @@ -37,7 +37,7 @@ lsp-server = "0.3.3" flycheck = { path = "../flycheck" } ra_ide = { path = "../ra_ide" } profile = { path = "../profile" } -ra_project_model = { path = "../ra_project_model" } +project_model = { path = "../project_model" } syntax = { path = "../syntax" } text_edit = { path = "../text_edit" } vfs = { path = "../vfs" } diff --git a/crates/rust-analyzer/src/bin/main.rs b/crates/rust-analyzer/src/bin/main.rs index f177f8709a..bade31ca24 100644 --- a/crates/rust-analyzer/src/bin/main.rs +++ b/crates/rust-analyzer/src/bin/main.rs @@ -6,7 +6,7 @@ mod args; use std::{convert::TryFrom, process}; use lsp_server::Connection; -use ra_project_model::ProjectManifest; +use project_model::ProjectManifest; use rust_analyzer::{ cli, config::{Config, LinkedProject}, diff --git a/crates/rust-analyzer/src/cargo_target_spec.rs b/crates/rust-analyzer/src/cargo_target_spec.rs index 9c7a9cce61..5ba30dbad6 100644 --- a/crates/rust-analyzer/src/cargo_target_spec.rs +++ b/crates/rust-analyzer/src/cargo_target_spec.rs @@ -1,8 +1,8 @@ //! See `CargoTargetSpec` use cfg::CfgExpr; +use project_model::{self, TargetKind}; use ra_ide::{FileId, RunnableKind, TestId}; -use ra_project_model::{self, TargetKind}; use vfs::AbsPathBuf; use crate::{global_state::GlobalStateSnapshot, Result}; diff --git a/crates/rust-analyzer/src/cli/load_cargo.rs b/crates/rust-analyzer/src/cli/load_cargo.rs index a43bf2244d..f6cb144c67 100644 --- a/crates/rust-analyzer/src/cli/load_cargo.rs +++ b/crates/rust-analyzer/src/cli/load_cargo.rs @@ -4,9 +4,9 @@ use std::{path::Path, sync::Arc}; use anyhow::Result; use crossbeam_channel::{unbounded, Receiver}; +use project_model::{CargoConfig, ProcMacroClient, ProjectManifest, ProjectWorkspace}; use ra_db::CrateGraph; use ra_ide::{AnalysisChange, AnalysisHost}; -use ra_project_model::{CargoConfig, ProcMacroClient, ProjectManifest, ProjectWorkspace}; use vfs::{loader::Handle, AbsPath, AbsPathBuf}; use crate::reload::{ProjectFolders, SourceRootConfig}; diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 70b4512d0b..bfc84147c3 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs @@ -11,8 +11,8 @@ use std::{ffi::OsString, path::PathBuf}; use flycheck::FlycheckConfig; use lsp_types::ClientCapabilities; +use project_model::{CargoConfig, ProjectJson, ProjectJsonData, ProjectManifest}; use ra_ide::{AssistConfig, CompletionConfig, HoverConfig, InlayHintsConfig}; -use ra_project_model::{CargoConfig, ProjectJson, ProjectJsonData, ProjectManifest}; use serde::Deserialize; use vfs::AbsPathBuf; diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs index 8c115c8a67..2e8b708d0f 100644 --- a/crates/rust-analyzer/src/global_state.rs +++ b/crates/rust-analyzer/src/global_state.rs @@ -9,9 +9,9 @@ use crossbeam_channel::{unbounded, Receiver, Sender}; use flycheck::FlycheckHandle; use lsp_types::{SemanticTokens, Url}; use parking_lot::{Mutex, RwLock}; +use project_model::{CargoWorkspace, ProcMacroClient, ProjectWorkspace, Target}; use ra_db::{CrateId, VfsPath}; use ra_ide::{Analysis, AnalysisChange, AnalysisHost, FileId}; -use ra_project_model::{CargoWorkspace, ProcMacroClient, ProjectWorkspace, Target}; use rustc_hash::FxHashMap; use crate::{ diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs index 86e7833f2f..4b5ca7eecf 100644 --- a/crates/rust-analyzer/src/handlers.rs +++ b/crates/rust-analyzer/src/handlers.rs @@ -18,11 +18,11 @@ use lsp_types::{ SemanticTokensRangeResult, SemanticTokensResult, SymbolInformation, SymbolTag, TextDocumentIdentifier, Url, WorkspaceEdit, }; +use project_model::TargetKind; use ra_ide::{ FileId, FilePosition, FileRange, HoverAction, HoverGotoTypeData, NavigationTarget, Query, RangeInfo, Runnable, RunnableKind, SearchScope, TextEdit, }; -use ra_project_model::TargetKind; use serde::{Deserialize, Serialize}; use serde_json::to_value; use stdx::{format_to, split_once}; diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index 32962b0885..9a779cb14e 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs @@ -21,7 +21,7 @@ use crate::{ lsp_utils::{apply_document_changes, is_canceled, notification_is, Progress}, Result, }; -use ra_project_model::ProjectWorkspace; +use project_model::ProjectWorkspace; use vfs::ChangeKind; pub fn main_loop(config: Config, connection: Connection) -> Result<()> { diff --git a/crates/rust-analyzer/src/reload.rs b/crates/rust-analyzer/src/reload.rs index 611c9a89f5..640417dc65 100644 --- a/crates/rust-analyzer/src/reload.rs +++ b/crates/rust-analyzer/src/reload.rs @@ -2,9 +2,9 @@ use std::{mem, sync::Arc}; use flycheck::FlycheckHandle; +use project_model::{ProcMacroClient, ProjectWorkspace}; use ra_db::{CrateGraph, SourceRoot, VfsPath}; use ra_ide::AnalysisChange; -use ra_project_model::{ProcMacroClient, ProjectWorkspace}; use vfs::{file_set::FileSetConfig, AbsPath, AbsPathBuf, ChangeKind}; use crate::{ @@ -98,14 +98,14 @@ impl GlobalState { .iter() .map(|project| match project { LinkedProject::ProjectManifest(manifest) => { - ra_project_model::ProjectWorkspace::load( + project_model::ProjectWorkspace::load( manifest.clone(), &cargo_config, with_sysroot, ) } LinkedProject::InlineJsonProject(it) => { - Ok(ra_project_model::ProjectWorkspace::Json { project: it.clone() }) + Ok(project_model::ProjectWorkspace::Json { project: it.clone() }) } }) .collect::>(); diff --git a/crates/rust-analyzer/tests/heavy_tests/support.rs b/crates/rust-analyzer/tests/heavy_tests/support.rs index 15866fbb16..5bafeba797 100644 --- a/crates/rust-analyzer/tests/heavy_tests/support.rs +++ b/crates/rust-analyzer/tests/heavy_tests/support.rs @@ -12,7 +12,7 @@ use lsp_types::{ notification::Exit, request::Shutdown, TextDocumentIdentifier, Url, WorkDoneProgress, }; use lsp_types::{ProgressParams, ProgressParamsValue}; -use ra_project_model::ProjectManifest; +use project_model::ProjectManifest; use rust_analyzer::{ config::{ClientCapsConfig, Config, FilesConfig, FilesWatcher, LinkedProject}, main_loop, diff --git a/xtask/tests/tidy.rs b/xtask/tests/tidy.rs index 0188aaa2ec..2e68e71db2 100644 --- a/xtask/tests/tidy.rs +++ b/xtask/tests/tidy.rs @@ -198,7 +198,7 @@ impl TidyDocs { "mbe", "parser", "profile", - "ra_project_model", + "project_model", "syntax", "tt", "ra_hir_ty",