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

SetupContext.TasksToExecute only lists tasks related to first target when calling RunTargets #4066

Open
2 tasks done
wazzamatazz opened this issue Nov 9, 2022 · 0 comments

Comments

@wazzamatazz
Copy link

Prerequisites

  • I have written a descriptive issue title
  • I have searched issues to ensure it has not already been reported

Cake runner

Cake .NET Tool

Cake version

3.0.0

Operating system

Windows

Operating system architecture

64-Bit

CI Server

No response

What are you seeing?

When running multiple targets via the RunTargets method in dotnet cake v3.0.0, the SetupContext.TasksToExecute property passed to the script's Setup delegate only lists the tasks that will be run for the first target specified, rather than the tasks to run for all specified targets.

What is expected?

I would expect the SetupContext.TasksToExecute property to contain all tasks that will be run across all specified targets rather than just the first target.

Steps to Reproduce

Setup(context => {
    Console.WriteLine($"Tasks to run: {string.Join(", ", context.TasksToExecute.Select(x => x.Name))}");
});

Task("A").Does(() => {
    Console.WriteLine("Running A");
});

Task("B").Does(() => {
    Console.WriteLine("Running B");
});

RunTargets(new [] { "A", "B" });

Resulting output when running dotnet cake is:

----------------------------------------
Setup
----------------------------------------
Tasks to run: A

========================================
A
========================================
Running A

========================================
B
========================================
Running B

Output log

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant