summaryrefslogtreecommitdiff
path: root/cli/tools/bench/mod.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-07-23 19:00:48 -0400
committerGitHub <noreply@github.com>2024-07-23 19:00:48 -0400
commit9114a2df69da9318c4e10887553b7daf77b0fa16 (patch)
tree2309817e74485f9fe8f7b79238afa026070b79df /cli/tools/bench/mod.rs
parent6055629ee7f48a4e887392ccac13788aa4008249 (diff)
fix(upgrade): do not error if config in cwd invalid (#24689)
``` > deno upgrade error: Unsupported lockfile version 'invalid'. Try upgrading Deno or recreating the lockfile. V:\scratch > V:\deno\target\debug\deno upgrade Looking up latest version Local deno version 1.45.3 is the most recent release ``` Closes #24517 Closes #20729
Diffstat (limited to 'cli/tools/bench/mod.rs')
-rw-r--r--cli/tools/bench/mod.rs19
1 files changed, 9 insertions, 10 deletions
diff --git a/cli/tools/bench/mod.rs b/cli/tools/bench/mod.rs
index 5bbf5ce8d..9cf222c45 100644
--- a/cli/tools/bench/mod.rs
+++ b/cli/tools/bench/mod.rs
@@ -1,12 +1,10 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use crate::args::BenchFlags;
-use crate::args::CliOptions;
use crate::args::Flags;
use crate::colors;
use crate::display::write_json_to_stdout;
use crate::factory::CliFactory;
-use crate::factory::CliFactoryBuilder;
use crate::graph_util::has_graph_root_local_dependent_changed;
use crate::ops;
use crate::tools::test::format_test_error;
@@ -403,14 +401,13 @@ fn has_supported_bench_path_name(path: &Path) -> bool {
}
pub async fn run_benchmarks(
- flags: Flags,
+ flags: Arc<Flags>,
bench_flags: BenchFlags,
) -> Result<(), AnyError> {
- let cli_options = CliOptions::from_flags(flags)?;
+ let factory = CliFactory::from_flags(flags);
+ let cli_options = factory.cli_options()?;
let workspace_bench_options =
cli_options.resolve_workspace_bench_options(&bench_flags);
- let factory = CliFactory::from_cli_options(Arc::new(cli_options));
- let cli_options = factory.cli_options();
// Various bench files should not share the same permissions in terms of
// `PermissionsContainer` - otherwise granting/revoking permissions in one
// file would have impact on other files, which is undesirable.
@@ -464,7 +461,7 @@ pub async fn run_benchmarks(
// TODO(bartlomieju): heavy duplication of code with `cli/tools/test.rs`
pub async fn run_benchmarks_with_watch(
- flags: Flags,
+ flags: Arc<Flags>,
bench_flags: BenchFlags,
) -> Result<(), AnyError> {
file_watcher::watch_func(
@@ -480,9 +477,11 @@ pub async fn run_benchmarks_with_watch(
move |flags, watcher_communicator, changed_paths| {
let bench_flags = bench_flags.clone();
Ok(async move {
- let factory = CliFactoryBuilder::new()
- .build_from_flags_for_watcher(flags, watcher_communicator.clone())?;
- let cli_options = factory.cli_options();
+ let factory = CliFactory::from_flags_for_watcher(
+ flags,
+ watcher_communicator.clone(),
+ );
+ let cli_options = factory.cli_options()?;
let workspace_bench_options =
cli_options.resolve_workspace_bench_options(&bench_flags);