chore(config): remove invocationLocation in favor of invocationStrategy

These flags were added to help rust-analyzer integrate with repos
requiring non-Cargo invocations. The consensus is that having two
independent settings are no longer needed. This change removes
`invocationLocation` in favor of `invocationStrategy` and changes
the internal representation of `InvocationStrategy::Once` to hold
the workspace root.
This commit is contained in:
Victor Song 2024-08-14 01:06:49 -05:00
parent fa00326247
commit b0f20c7deb
8 changed files with 33 additions and 173 deletions

View file

@ -19,8 +19,8 @@ use serde::Deserialize;
use toolchain::Tool;
use crate::{
utf8_stdout, CargoConfig, CargoFeatures, CargoWorkspace, InvocationLocation,
InvocationStrategy, ManifestPath, Package, Sysroot, TargetKind,
utf8_stdout, CargoConfig, CargoFeatures, CargoWorkspace, InvocationStrategy, ManifestPath,
Package, Sysroot, TargetKind,
};
/// Output of the build script and proc-macro building steps for a workspace.
@ -63,10 +63,7 @@ impl WorkspaceBuildScripts {
progress: &dyn Fn(String),
sysroot: &Sysroot,
) -> io::Result<WorkspaceBuildScripts> {
let current_dir = match &config.invocation_location {
InvocationLocation::Root(root) if config.run_build_script_command.is_some() => root,
_ => workspace.workspace_root(),
};
let current_dir = workspace.workspace_root();
let allowed_features = workspace.workspace_features();
let cmd = Self::build_command(
@ -89,15 +86,7 @@ impl WorkspaceBuildScripts {
) -> io::Result<Vec<WorkspaceBuildScripts>> {
assert_eq!(config.invocation_strategy, InvocationStrategy::Once);
let current_dir = match &config.invocation_location {
InvocationLocation::Root(root) => root,
InvocationLocation::Workspace => {
return Err(io::Error::new(
io::ErrorKind::Other,
"Cannot run build scripts from workspace with invocation strategy `once`",
))
}
};
let current_dir = workspace_root;
let cmd = Self::build_command(
config,
&Default::default(),