Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove legacy filter flags #7970

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 3 additions & 119 deletions crates/turborepo-lib/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use clap_complete::{generate, Shell};
pub use error::Error;
use serde::{Deserialize, Serialize};
use tracing::{debug, error, warn};

Check warning on line 12 in crates/turborepo-lib/src/cli/mod.rs

View workflow job for this annotation

GitHub Actions / JS Native Package Tests (ubuntu, self-hosted, linux, x64, metal)

unused import: `warn`

Check warning on line 12 in crates/turborepo-lib/src/cli/mod.rs

View workflow job for this annotation

GitHub Actions / JS Native Package Tests (macos, macos-latest)

unused import: `warn`

Check warning on line 12 in crates/turborepo-lib/src/cli/mod.rs

View workflow job for this annotation

GitHub Actions / Build Turborepo (ubuntu, self-hosted, linux, x64, metal)

unused import: `warn`

Check warning on line 12 in crates/turborepo-lib/src/cli/mod.rs

View workflow job for this annotation

GitHub Actions / Build Turborepo (macos, macos-latest)

unused import: `warn`

Check warning on line 12 in crates/turborepo-lib/src/cli/mod.rs

View workflow job for this annotation

GitHub Actions / Build Turborepo (windows, windows-latest)

unused import: `warn`

Check warning on line 12 in crates/turborepo-lib/src/cli/mod.rs

View workflow job for this annotation

GitHub Actions / Turborepo rust check

unused import: `warn`

Check warning on line 12 in crates/turborepo-lib/src/cli/mod.rs

View workflow job for this annotation

GitHub Actions / Turborepo Rust testing on ubuntu

unused import: `warn`

Check warning on line 12 in crates/turborepo-lib/src/cli/mod.rs

View workflow job for this annotation

GitHub Actions / Turborepo Rust testing on macos

unused import: `warn`

Check warning on line 12 in crates/turborepo-lib/src/cli/mod.rs

View workflow job for this annotation

GitHub Actions / Turborepo Rust testing on windows

unused import: `warn`

Check warning on line 12 in crates/turborepo-lib/src/cli/mod.rs

View workflow job for this annotation

GitHub Actions / Turborepo rust clippy

unused import: `warn`

Check warning on line 12 in crates/turborepo-lib/src/cli/mod.rs

View workflow job for this annotation

GitHub Actions / Turborepo Integration (ubuntu-latest)

unused import: `warn`

Check warning on line 12 in crates/turborepo-lib/src/cli/mod.rs

View workflow job for this annotation

GitHub Actions / Turborepo Integration (macos-latest)

unused import: `warn`

Check warning on line 12 in crates/turborepo-lib/src/cli/mod.rs

View workflow job for this annotation

GitHub Actions / Turborepo Integration (windows-latest)

unused import: `warn`
use turbopath::AbsoluteSystemPathBuf;
use turborepo_api_client::AnonAPIClient;
use turborepo_repository::inference::{RepoMode, RepoState};
Expand Down Expand Up @@ -685,38 +685,13 @@
#[clap(short = 'F', long, group = "scope-filter-group")]
pub filter: Vec<String>,

/// DEPRECATED: Specify package(s) to act as entry
/// points for task execution. Supports globs.
#[clap(long, group = "scope-filter-group")]
pub scope: Vec<String>,

// ignore filters out files from scope and filter, so we require it here
// -----------------------
/// Files to ignore when calculating changed files from '--filter'.
/// Supports globs.
#[clap(long, requires = "scope-filter-group")]
pub ignore: Vec<String>,

// since only works with scope, so we require it here
// -----------------------
/// DEPRECATED: Limit/Set scope to changed packages
/// since a mergebase. This uses the git diff ${target_branch}...
/// mechanism to identify which packages have changed.
#[clap(long, requires = "scope")]
pub since: Option<String>,

// include_dependencies only works with scope, so we require it here
// -----------------------
/// DEPRECATED: Include the dependencies of tasks in execution.
#[clap(long, requires = "scope")]
pub include_dependencies: bool,

// no_deps only works with scope, so we require it here
// -----------------------
/// DEPRECATED: Exclude dependent task consumers from execution.
#[clap(long, requires = "scope")]
pub no_deps: bool,

/// Avoid saving task results to the cache. Useful for development/watch
/// tasks.
#[clap(long)]
Expand Down Expand Up @@ -829,9 +804,7 @@

// default to true
track_usage!(telemetry, self.continue_execution, |val| val);
track_usage!(telemetry, self.include_dependencies, |val| val);
track_usage!(telemetry, self.single_package, |val| val);
track_usage!(telemetry, self.no_deps, |val| val);
track_usage!(telemetry, self.no_cache, |val| val);
track_usage!(telemetry, self.daemon, |val| val);
track_usage!(telemetry, self.no_daemon, |val| val);
Expand All @@ -844,7 +817,6 @@
track_usage!(telemetry, &self.cache_dir, Option::is_some);
track_usage!(telemetry, &self.profile, Option::is_some);
track_usage!(telemetry, &self.force, Option::is_some);
track_usage!(telemetry, &self.since, Option::is_some);
track_usage!(telemetry, &self.pkg_inference_root, Option::is_some);
track_usage!(telemetry, &self.anon_profile, Option::is_some);
track_usage!(telemetry, &self.summarize, Option::is_some);
Expand Down Expand Up @@ -894,10 +866,6 @@
telemetry.track_arg_value("filter:length", self.filter.len(), EventType::NonSensitive);
}

if !self.scope.is_empty() {
telemetry.track_arg_value("scope:length", self.scope.len(), EventType::NonSensitive);
}

if !self.ignore.is_empty() {
telemetry.track_arg_value("ignore:length", self.ignore.len(), EventType::NonSensitive);
}
Expand Down Expand Up @@ -1052,7 +1020,6 @@
root_telemetry.track_cpus(num_cpus::get());
// track args
cli_args.track(&root_telemetry);
warn_all_deprecated_flags(&cli_args);

let cli_result = match cli_args.command.as_ref().unwrap() {
Command::Bin { .. } => {
Expand Down Expand Up @@ -1263,39 +1230,6 @@
cli_result
}

fn warn_all_deprecated_flags(args: &Args) {
if args.trace.is_some() {
warn_flag_removal("--trace");
}

if args.heap.is_some() {
warn_flag_removal("--heap");
}

if args.cpu_profile.is_some() {
warn_flag_removal("--cpuprofile");
}

if let Some(Command::Run(run_args)) = args.command.as_ref() {
if run_args.since.is_some() {
warn_flag_removal("--since");
}
if !run_args.scope.is_empty() {
warn_flag_removal("--scope");
}
if run_args.include_dependencies {
warn_flag_removal("--include-dependencies");
}
if run_args.no_deps {
warn_flag_removal("--no-deps");
}
}
}

fn warn_flag_removal(flag: &str) {
warn!("{flag} is deprecated and will be removed in 2.0");
}

#[cfg(test)]
mod test {
use std::assert_matches::assert_matches;
Expand Down Expand Up @@ -1685,19 +1619,6 @@
} ;
"multiple ignores"
)]
#[test_case::test_case(
&["turbo", "run", "build", "--scope", "test", "--include-dependencies"],
Args {
command: Some(Command::Run(Box::new(RunArgs {
tasks: vec!["build".to_string()],
include_dependencies: true,
scope: vec!["test".to_string()],
..get_default_run_args()
}))),
..Args::default()
} ;
"include dependencies"
)]
#[test_case::test_case(
&["turbo", "run", "build", "--no-cache"],
Args {
Expand Down Expand Up @@ -1731,19 +1652,6 @@
..Args::default()
}
)]
#[test_case::test_case(
&["turbo", "run", "build", "--scope", "test", "--no-deps"],
Args {
command: Some(Command::Run(Box::new(RunArgs {
tasks: vec!["build".to_string()],
scope: vec!["test".to_string()],
no_deps: true,
..get_default_run_args()
}))),
..Args::default()
} ;
"no deps"
)]
#[test_case::test_case(
&["turbo", "run", "build", "--output-logs", "full"],
Args {
Expand Down Expand Up @@ -1914,30 +1822,6 @@
} ;
"remote_only=false works"
)]
#[test_case::test_case(
&["turbo", "run", "build", "--scope", "foo", "--scope", "bar"],
Args {
command: Some(Command::Run(Box::new(RunArgs {
tasks: vec!["build".to_string()],
scope: vec!["foo".to_string(), "bar".to_string()],
..get_default_run_args()
}))),
..Args::default()
}
)]
#[test_case::test_case(
&["turbo", "run", "build", "--scope", "test", "--since", "foo"],
Args {
command: Some(Command::Run(Box::new(RunArgs {
tasks: vec!["build".to_string()],
scope: vec!["test".to_string()],
since: Some("foo".to_string()),
..get_default_run_args()
}))),
..Args::default()
} ;
"scope and since"
)]
#[test_case::test_case(
&["turbo", "build"],
Args {
Expand Down Expand Up @@ -1983,17 +1867,17 @@
)]
#[test_case::test_case(
&["turbo", "run", "build", "--since", "foo"],
"the following required arguments were not provided" ;
"unexpected argument '--since' found" ;
"since without filter or scope"
)]
#[test_case::test_case(
&["turbo", "run", "build", "--include-dependencies"],
"the following required arguments were not provided" ;
"unexpected argument '--include-dependencies' found" ;
"include-dependencies without filter or scope"
)]
#[test_case::test_case(
&["turbo", "run", "build", "--no-deps"],
"the following required arguments were not provided" ;
"unexpected argument '--no-deps' found" ;
"no-deps without filter or scope"
)]
fn test_parse_run_failures(args: &[&str], expected: &str) {
Expand Down
Loading
Loading