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

View file

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

View file

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

View file

@ -23,4 +23,4 @@ cargo_metadata = "0.11.1"
difference = "2.0.0"
# used as proc macro test target
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
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"])
.output()
.unwrap()

View file

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

View file

@ -140,7 +140,7 @@ impl CargoWorkspace {
cargo_features: &CargoConfig,
) -> Result<CargoWorkspace> {
let mut meta = MetadataCommand::new();
meta.cargo_path(ra_toolchain::cargo());
meta.cargo_path(toolchain::cargo());
meta.manifest_path(cargo_toml.to_path_buf());
if cargo_features.all_features {
meta.features(CargoOpt::AllFeatures);
@ -288,7 +288,7 @@ pub fn load_extern_resources(
cargo_toml: &Path,
cargo_features: &CargoConfig,
) -> 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);
if cargo_features.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 mut cmd = Command::new(ra_toolchain::rustc());
let mut cmd = Command::new(toolchain::rustc());
cmd.args(&["--print", "cfg", "-O"]);
if let Some(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);
}
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"]);
let stdout = utf8_stdout(rustc)?;
let sysroot_path = AbsPath::assert(Path::new(stdout.trim()));
let mut src = get_rust_src(sysroot_path);
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"]);
utf8_stdout(rustup)?;
src = get_rust_src(sysroot_path);

View file

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

View file

@ -692,7 +692,7 @@ pub(crate) fn handle_formatting(
let mut rustfmt = match &snap.config.rustfmt {
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);
if let Some(&crate_id) = crate_ids.first() {
// Assume all crates are in the same edition

View file

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

View file

@ -1,6 +1,4 @@
//! This crate contains a single public function
//! [`get_path_for_executable`](fn.get_path_for_executable.html).
//! See docs there for more information.
//! Discovery of `cargo` & `rustc` executables.
use std::{env, iter, path::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 {
return getPathForExecutable("cargo");
}
/** Mirrors `ra_toolchain::get_path_for_executable()` implementation */
/** Mirrors `toolchain::get_path_for_executable()` implementation */
export const getPathForExecutable = memoize(
// We apply caching to decrease file-system interactions
(executableName: "cargo" | "rustc" | "rustup"): string => {