Rename ra_toolchain -> toolchain

This commit is contained in:
Aleksey Kladov 2020-08-12 16:52:28 +02:00
parent 550d7fbe3c
commit 8d34262956
14 changed files with 30 additions and 32 deletions

22
Cargo.lock generated
View file

@ -358,8 +358,8 @@ dependencies = [
"crossbeam-channel", "crossbeam-channel",
"jod-thread", "jod-thread",
"log", "log",
"ra_toolchain",
"serde_json", "serde_json",
"toolchain",
] ]
[[package]] [[package]]
@ -1143,9 +1143,9 @@ dependencies = [
"memmap", "memmap",
"ra_mbe", "ra_mbe",
"ra_proc_macro", "ra_proc_macro",
"ra_toolchain",
"serde_derive", "serde_derive",
"test_utils", "test_utils",
"toolchain",
"tt", "tt",
] ]
@ -1161,11 +1161,11 @@ dependencies = [
"ra_cfg", "ra_cfg",
"ra_db", "ra_db",
"ra_proc_macro", "ra_proc_macro",
"ra_toolchain",
"rustc-hash", "rustc-hash",
"serde", "serde",
"serde_json", "serde_json",
"stdx", "stdx",
"toolchain",
] ]
[[package]] [[package]]
@ -1210,13 +1210,6 @@ dependencies = [
"text-size", "text-size",
] ]
[[package]]
name = "ra_toolchain"
version = "0.1.0"
dependencies = [
"home",
]
[[package]] [[package]]
name = "rayon" name = "rayon"
version = "1.3.1" version = "1.3.1"
@ -1320,7 +1313,6 @@ dependencies = [
"ra_ssr", "ra_ssr",
"ra_syntax", "ra_syntax",
"ra_text_edit", "ra_text_edit",
"ra_toolchain",
"rayon", "rayon",
"rustc-hash", "rustc-hash",
"serde", "serde",
@ -1328,6 +1320,7 @@ dependencies = [
"stdx", "stdx",
"test_utils", "test_utils",
"threadpool", "threadpool",
"toolchain",
"tt", "tt",
"vfs", "vfs",
"vfs-notify", "vfs-notify",
@ -1612,6 +1605,13 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53953d2d3a5ad81d9f844a32f14ebb121f50b650cd59d0ee2a07cf13c617efed" checksum = "53953d2d3a5ad81d9f844a32f14ebb121f50b650cd59d0ee2a07cf13c617efed"
[[package]]
name = "toolchain"
version = "0.0.0"
dependencies = [
"home",
]
[[package]] [[package]]
name = "tracing" name = "tracing"
version = "0.1.18" version = "0.1.18"

View file

@ -14,4 +14,4 @@ log = "0.4.8"
cargo_metadata = "0.11.1" cargo_metadata = "0.11.1"
serde_json = "1.0.48" serde_json = "1.0.48"
jod-thread = "0.1.1" jod-thread = "0.1.1"
ra_toolchain = { path = "../ra_toolchain" } toolchain = { path = "../toolchain" }

View file

@ -193,7 +193,7 @@ impl FlycheckActor {
extra_args, extra_args,
features, features,
} => { } => {
let mut cmd = Command::new(ra_toolchain::cargo()); let mut cmd = Command::new(toolchain::cargo());
cmd.arg(command); cmd.arg(command);
cmd.args(&["--workspace", "--message-format=json", "--manifest-path"]) cmd.args(&["--workspace", "--message-format=json", "--manifest-path"])
.arg(self.workspace_root.join("Cargo.toml")); .arg(self.workspace_root.join("Cargo.toml"));

View file

@ -23,4 +23,4 @@ cargo_metadata = "0.11.1"
difference = "2.0.0" difference = "2.0.0"
# used as proc macro test target # used as proc macro test target
serde_derive = "1.0.106" serde_derive = "1.0.106"
ra_toolchain = { path = "../ra_toolchain" } toolchain = { path = "../toolchain" }

View file

@ -12,7 +12,7 @@ mod fixtures {
// Use current project metadata to get the proc-macro dylib path // Use current project metadata to get the proc-macro dylib path
pub fn dylib_path(crate_name: &str, version: &str) -> std::path::PathBuf { pub fn dylib_path(crate_name: &str, version: &str) -> std::path::PathBuf {
let command = Command::new(ra_toolchain::cargo()) let command = Command::new(toolchain::cargo())
.args(&["check", "--message-format", "json"]) .args(&["check", "--message-format", "json"])
.output() .output()
.unwrap() .unwrap()

View file

@ -17,7 +17,7 @@ cargo_metadata = "0.11.1"
arena = { path = "../arena" } arena = { path = "../arena" }
ra_cfg = { path = "../ra_cfg" } ra_cfg = { path = "../ra_cfg" }
ra_db = { path = "../ra_db" } ra_db = { path = "../ra_db" }
ra_toolchain = { path = "../ra_toolchain" } toolchain = { path = "../toolchain" }
ra_proc_macro = { path = "../ra_proc_macro" } ra_proc_macro = { path = "../ra_proc_macro" }
paths = { path = "../paths" } paths = { path = "../paths" }
stdx = { path = "../stdx" } stdx = { path = "../stdx" }

View file

@ -140,7 +140,7 @@ impl CargoWorkspace {
cargo_features: &CargoConfig, cargo_features: &CargoConfig,
) -> Result<CargoWorkspace> { ) -> Result<CargoWorkspace> {
let mut meta = MetadataCommand::new(); let mut meta = MetadataCommand::new();
meta.cargo_path(ra_toolchain::cargo()); meta.cargo_path(toolchain::cargo());
meta.manifest_path(cargo_toml.to_path_buf()); meta.manifest_path(cargo_toml.to_path_buf());
if cargo_features.all_features { if cargo_features.all_features {
meta.features(CargoOpt::AllFeatures); meta.features(CargoOpt::AllFeatures);
@ -288,7 +288,7 @@ pub fn load_extern_resources(
cargo_toml: &Path, cargo_toml: &Path,
cargo_features: &CargoConfig, cargo_features: &CargoConfig,
) -> Result<ExternResources> { ) -> Result<ExternResources> {
let mut cmd = Command::new(ra_toolchain::cargo()); let mut cmd = Command::new(toolchain::cargo());
cmd.args(&["check", "--message-format=json", "--manifest-path"]).arg(cargo_toml); cmd.args(&["check", "--message-format=json", "--manifest-path"]).arg(cargo_toml);
if cargo_features.all_features { if cargo_features.all_features {
cmd.arg("--all-features"); cmd.arg("--all-features");

View file

@ -513,7 +513,7 @@ fn get_rustc_cfg_options(target: Option<&str>) -> Vec<CfgFlag> {
} }
let rustc_cfgs = { let rustc_cfgs = {
let mut cmd = Command::new(ra_toolchain::rustc()); let mut cmd = Command::new(toolchain::rustc());
cmd.args(&["--print", "cfg", "-O"]); cmd.args(&["--print", "cfg", "-O"]);
if let Some(target) = target { if let Some(target) = target {
cmd.args(&["--target", target]); cmd.args(&["--target", target]);

View file

@ -101,13 +101,13 @@ fn get_or_install_rust_src(cargo_toml: &AbsPath) -> Result<AbsPathBuf> {
return Ok(path); return Ok(path);
} }
let current_dir = cargo_toml.parent().unwrap(); let current_dir = cargo_toml.parent().unwrap();
let mut rustc = Command::new(ra_toolchain::rustc()); let mut rustc = Command::new(toolchain::rustc());
rustc.current_dir(current_dir).args(&["--print", "sysroot"]); rustc.current_dir(current_dir).args(&["--print", "sysroot"]);
let stdout = utf8_stdout(rustc)?; let stdout = utf8_stdout(rustc)?;
let sysroot_path = AbsPath::assert(Path::new(stdout.trim())); let sysroot_path = AbsPath::assert(Path::new(stdout.trim()));
let mut src = get_rust_src(sysroot_path); let mut src = get_rust_src(sysroot_path);
if src.is_none() { if src.is_none() {
let mut rustup = Command::new(ra_toolchain::rustup()); let mut rustup = Command::new(toolchain::rustup());
rustup.current_dir(current_dir).args(&["component", "add", "rust-src"]); rustup.current_dir(current_dir).args(&["component", "add", "rust-src"]);
utf8_stdout(rustup)?; utf8_stdout(rustup)?;
src = get_rust_src(sysroot_path); src = get_rust_src(sysroot_path);

View file

@ -43,7 +43,7 @@ ra_text_edit = { path = "../ra_text_edit" }
vfs = { path = "../vfs" } vfs = { path = "../vfs" }
vfs-notify = { path = "../vfs-notify" } vfs-notify = { path = "../vfs-notify" }
ra_cfg = { path = "../ra_cfg" } ra_cfg = { path = "../ra_cfg" }
ra_toolchain = { path = "../ra_toolchain" } toolchain = { path = "../toolchain" }
# This should only be used in CLI # This should only be used in CLI
ra_db = { path = "../ra_db" } ra_db = { path = "../ra_db" }

View file

@ -692,7 +692,7 @@ pub(crate) fn handle_formatting(
let mut rustfmt = match &snap.config.rustfmt { let mut rustfmt = match &snap.config.rustfmt {
RustfmtConfig::Rustfmt { extra_args } => { RustfmtConfig::Rustfmt { extra_args } => {
let mut cmd = process::Command::new(ra_toolchain::rustfmt()); let mut cmd = process::Command::new(toolchain::rustfmt());
cmd.args(extra_args); cmd.args(extra_args);
if let Some(&crate_id) = crate_ids.first() { if let Some(&crate_id) = crate_ids.first() {
// Assume all crates are in the same edition // Assume all crates are in the same edition

View file

@ -1,9 +1,9 @@
[package] [package]
edition = "2018" name = "toolchain"
name = "ra_toolchain" version = "0.0.0"
version = "0.1.0"
authors = ["rust-analyzer developers"]
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
authors = ["rust-analyzer developers"]
edition = "2018"
[lib] [lib]
doctest = false doctest = false

View file

@ -1,6 +1,4 @@
//! This crate contains a single public function //! Discovery of `cargo` & `rustc` executables.
//! [`get_path_for_executable`](fn.get_path_for_executable.html).
//! See docs there for more information.
use std::{env, iter, path::PathBuf}; use std::{env, iter, path::PathBuf};
pub fn cargo() -> PathBuf { pub fn cargo() -> PathBuf {

View file

@ -121,12 +121,12 @@ export class Cargo {
} }
} }
/** Mirrors `ra_toolchain::cargo()` implementation */ /** Mirrors `toolchain::cargo()` implementation */
export function cargoPath(): string { export function cargoPath(): string {
return getPathForExecutable("cargo"); return getPathForExecutable("cargo");
} }
/** Mirrors `ra_toolchain::get_path_for_executable()` implementation */ /** Mirrors `toolchain::get_path_for_executable()` implementation */
export const getPathForExecutable = memoize( export const getPathForExecutable = memoize(
// We apply caching to decrease file-system interactions // We apply caching to decrease file-system interactions
(executableName: "cargo" | "rustc" | "rustup"): string => { (executableName: "cargo" | "rustc" | "rustup"): string => {