Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Commit

Permalink
Auto merge of #1725 - ehuss:update-cargo, r=Xanewok
Browse files Browse the repository at this point in the history
Update cargo

Updating for a variety of API changes.
  • Loading branch information
bors committed Apr 12, 2021
2 parents 317cff1 + a2f6ea4 commit 32c0fe0
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 23 deletions.
38 changes: 28 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ rls-vfs = "0.8"
rls-ipc = { version = "0.1.0", path = "rls-ipc", optional = true }

anyhow = "1.0.26"
cargo = { git = "https://github.com/rust-lang/cargo", rev = "970bc67c3775781b9708c8a36893576b9459c64a" }
cargo = { git = "https://github.com/rust-lang/cargo", rev = "58a961314437258065e23cb6316dfc121d96fb71" }
cargo-util = { git = "https://github.com/rust-lang/cargo", rev = "58a961314437258065e23cb6316dfc121d96fb71" }
cargo_metadata = "0.8"
clippy_lints = { git = "https://github.com/rust-lang/rust-clippy", rev = "7ea7cd165ad6705603852771bf82cc2fd6560db5", optional = true }
env_logger = "0.7"
Expand Down
15 changes: 9 additions & 6 deletions rls/src/build/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ use std::sync::{Arc, Mutex};
use std::thread;

use cargo::core::compiler::{BuildConfig, CompileMode, Context, Executor, Unit};
use cargo::core::resolver::ResolveError;
use cargo::core::resolver::{CliFeatures, ResolveError};
use cargo::core::Package;
use cargo::core::{PackageId, Shell, Target, TargetKind, Verbosity, Workspace};
use cargo::ops::{compile_with_exec, CompileFilter, CompileOptions, Packages};
use cargo::util::{
config as cargo_config, errors::ManifestError, homedir, important_paths, CargoResult,
ConfigValue, ProcessBuilder,
ConfigValue,
};
use cargo_util::ProcessBuilder;
use log::{debug, trace, warn};
use rls_data::Analysis;
use rls_vfs::Vfs;
Expand Down Expand Up @@ -229,9 +230,11 @@ fn run_cargo_ws(
opts.target.iter().map(|x| x.into()).collect::<Vec<String>>().as_slice(),
CompileMode::Check { test: cfg_test },
)?,
features: opts.features,
all_features: opts.all_features,
no_default_features: opts.no_default_features,
cli_features: CliFeatures::from_command_line(
&opts.features,
opts.all_features,
!opts.no_default_features,
)?,
..CompileOptions::new(&config, CompileMode::Check { test: cfg_test })?
};

Expand Down Expand Up @@ -266,7 +269,7 @@ fn run_cargo_ws(
// directory but its parent) and, when user runs "cargo build" themselves cargo will see
// target/ existing already and won't exclude it from backups. We can work around that by
// attempting to create a backup-excluded target/ ourelves using cargo paths:: machinery.
cargo::util::paths::create_dir_all_excluded_from_backups_atomic(
cargo_util::paths::create_dir_all_excluded_from_backups_atomic(
config.target_dir().unwrap().unwrap().as_path_unlocked().parent().unwrap(),
)?;
let exec = Arc::new(exec) as Arc<dyn Executor>;
Expand Down
2 changes: 1 addition & 1 deletion rls/src/build/cargo_plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use std::sync::Mutex;
use cargo::core::compiler::{CompileKind, CompileMode, Context, Unit};
use cargo::core::profiles::Profile;
use cargo::core::{PackageId, Target, TargetKind};
use cargo::util::ProcessBuilder;
use cargo_util::ProcessBuilder;
use log::{error, trace};

use crate::build::plan::{BuildGraph, BuildKey, JobQueue, WorkStatus};
Expand Down
4 changes: 2 additions & 2 deletions rls/src/build/external.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::build::plan::{BuildGraph, BuildKey, JobQueue, WorkStatus};
use crate::build::rustc::src_path;
use crate::build::BuildResult;

use cargo::util::{process, ProcessBuilder};
use cargo_util::ProcessBuilder;
use log::trace;
use rls_data::{Analysis, CompilationOptions};
use serde_derive::Deserialize;
Expand Down Expand Up @@ -217,7 +217,7 @@ impl BuildKey for Invocation {

impl Invocation {
fn from_raw(build_dir: &Path, raw: RawInvocation) -> Invocation {
let mut command = process(&raw.program);
let mut command = ProcessBuilder::new(&raw.program);
command.args(&raw.args);
for (k, v) in &raw.env {
command.env(&k, v);
Expand Down
2 changes: 1 addition & 1 deletion rls/src/build/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use std::path::{Path, PathBuf};
use std::sync::mpsc::Sender;
use std::sync::Arc;

use cargo::util::ProcessBuilder;
use cargo_util::ProcessBuilder;
use log::trace;
use serde::{Deserialize, Serialize};

Expand Down
13 changes: 11 additions & 2 deletions rls/src/project_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use cargo::{
core::{
registry::PackageRegistry,
resolver::{EncodableResolve, Resolve, ResolveOpts},
resolver::{CliFeatures, EncodableResolve, HasDevUnits, Resolve},
PackageId, Workspace,
},
ops,
Expand Down Expand Up @@ -217,5 +217,14 @@ fn resolve_with_prev<'cfg>(
ws: &Workspace<'cfg>,
prev: Option<&Resolve>,
) -> CargoResult<Resolve> {
ops::resolve_with_previous(registry, ws, &ResolveOpts::everything(), prev, None, &[], true)
ops::resolve_with_previous(
registry,
ws,
&CliFeatures::new_all(true),
HasDevUnits::Yes,
prev,
None,
&[],
true,
)
}

0 comments on commit 32c0fe0

Please sign in to comment.