Closed devlead closed 2 years ago
Thank you for now I will try to use your workaround, it's very helpful.
Shameless plug here for Cake.Console
if you write this
using Cake.Console;
using Cake.Common.Diagnostics;
using Cake.Core.Diagnostics;
using Cake.Core;
using System.Linq;
var host = new CakeHostBuilder().BuildHost(args);
host.Setup(ctx =>
ctx.Information($"The following tasks will execute {string.Join("->", ctx.TasksToExecute.Select(t => t.Name))}"));
host.Task("Default")
.Does(c => c.Information("DefaultTask"));
host.Task("Dependency")
.IsDependeeOf("Default")
.Does(c => c.Information("DependencyTask"));
host.Task("NonDependency")
.Does(c => c.Information("NonDependencyTask"));
host.RunTarget("Default");
You will get this
:tada: This issue has been resolved in version v3.0.0 :tada:
The release is available on:
Your GitReleaseManager bot :package::rocket:
Originally posted by @lonix1 in https://github.com/cake-build/cake/issues/1772#issuecomment-1220288335
A quick look at the code, it looks like currently, the SetupContext isn't passed to the Frosting setup, adding it to
IFrostingLifetime
/IFrostingSetup
would be a breaking change, so maybe first fixed in the next mayor release, or at least some more thought will need to go into it. https://github.com/cake-build/cake/blob/a1893a2bba26f49e089d66beeb78421cedf6126d/src/Cake.Frosting/Internal/FrostingEngine.cs#L83like it is for the teardown https://github.com/cake-build/cake/blob/a1893a2bba26f49e089d66beeb78421cedf6126d/src/Cake.Frosting/Internal/FrostingEngine.cs#L89
A dirty workaround, in this case, could be to register the setup task yourself.
This could be done by injecting a custom setup task in IoC and adding it and
ICakeEngine
to your own custom context. that could look something like