cargo dev ra-setup: don't inject deps multiple times if we have already done so
Fixes #6220
This commit is contained in:
parent
4f1240fd94
commit
7f3462aa89
@ -11,7 +11,7 @@ use std::path::PathBuf;
|
|||||||
// code. See https://github.com/rust-analyzer/rust-analyzer/issues/3517 and https://github.com/rust-lang/rust-clippy/issues/5514 for details
|
// code. See https://github.com/rust-analyzer/rust-analyzer/issues/3517 and https://github.com/rust-lang/rust-clippy/issues/5514 for details
|
||||||
|
|
||||||
pub fn run(rustc_path: Option<&str>) {
|
pub fn run(rustc_path: Option<&str>) {
|
||||||
// we can unwrap here because the arg is required here
|
// we can unwrap here because the arg is required by clap
|
||||||
let rustc_path = PathBuf::from(rustc_path.unwrap());
|
let rustc_path = PathBuf::from(rustc_path.unwrap());
|
||||||
assert!(rustc_path.is_dir(), "path is not a directory");
|
assert!(rustc_path.is_dir(), "path is not a directory");
|
||||||
let rustc_source_basedir = rustc_path.join("compiler");
|
let rustc_source_basedir = rustc_path.join("compiler");
|
||||||
@ -49,6 +49,15 @@ fn inject_deps_into_manifest(
|
|||||||
cargo_toml: &str,
|
cargo_toml: &str,
|
||||||
lib_rs: &str,
|
lib_rs: &str,
|
||||||
) -> std::io::Result<()> {
|
) -> std::io::Result<()> {
|
||||||
|
// do not inject deps if we have aleady done so
|
||||||
|
if cargo_toml.contains("[target.'cfg(NOT_A_PLATFORM)'.dependencies]") {
|
||||||
|
eprintln!(
|
||||||
|
"cargo dev ra-setup: warning: deps already found inside {}, doing nothing.",
|
||||||
|
manifest_path
|
||||||
|
);
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
let extern_crates = lib_rs
|
let extern_crates = lib_rs
|
||||||
.lines()
|
.lines()
|
||||||
// get the deps
|
// get the deps
|
||||||
|
Loading…
Reference in New Issue
Block a user