fix(task): --recursive - order tasks by package dependencies (#30129)
Some checks are pending
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions

Closes https://github.com/denoland/deno/issues/29377
This commit is contained in:
David Sherret 2025-07-17 09:31:58 -04:00 committed by GitHub
parent f7dfcad2be
commit b7680dde5e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 528 additions and 111 deletions

View file

@ -99,14 +99,16 @@ pub async fn execute_script(
let mut packages_task_info: Vec<PackageTaskInfo> = vec![];
let workspace = cli_options.workspace();
for folder in workspace.config_folders() {
for (folder_url, folder) in
workspace.config_folders_sorted_by_dependencies()
{
if !task_flags.recursive
&& !matches_package(folder.1, force_use_pkg_json, &package_regex)
&& !matches_package(folder, force_use_pkg_json, &package_regex)
{
continue;
}
let member_dir = workspace.resolve_member_dir(folder.0);
let member_dir = workspace.resolve_member_dir(folder_url);
let mut tasks_config = member_dir.to_tasks_config()?;
if force_use_pkg_json {
tasks_config = tasks_config.with_only_pkg_json();
@ -727,27 +729,26 @@ fn print_available_tasks_workspace(
let workspace = cli_options.workspace();
let mut matched = false;
for folder in workspace.config_folders() {
if !recursive
&& !matches_package(folder.1, force_use_pkg_json, package_regex)
for (folder_url, folder) in workspace.config_folders_sorted_by_dependencies()
{
if !recursive && !matches_package(folder, force_use_pkg_json, package_regex)
{
continue;
}
matched = true;
let member_dir = workspace.resolve_member_dir(folder.0);
let member_dir = workspace.resolve_member_dir(folder_url);
let mut tasks_config = member_dir.to_tasks_config()?;
let mut pkg_name = folder
.1
.deno_json
.as_ref()
.and_then(|deno| deno.json.name.clone())
.or(folder.1.pkg_json.as_ref().and_then(|pkg| pkg.name.clone()));
.or(folder.pkg_json.as_ref().and_then(|pkg| pkg.name.clone()));
if force_use_pkg_json {
tasks_config = tasks_config.with_only_pkg_json();
pkg_name = folder.1.pkg_json.as_ref().and_then(|pkg| pkg.name.clone());
pkg_name = folder.pkg_json.as_ref().and_then(|pkg| pkg.name.clone());
}
print_available_tasks(