Reputation: 93
Is it possible to share state between Targets
in Nuke?
Lets say I wanted this scenerario.
class Build : NukeBuild {
public static int Main () => Execute<Build>(x => x.Clean);
Target Clean => _ => _
.Executes(() =>
{
string stateToRestore = "I am needed in Restore Target";
});
Target Restore => _ => _
.DependsOn(Clean)
.Executes(() =>
{
Console.WriteLine(stateToRestore);
});
}
I know it is possible to either create a property, field or some object holding the state in the scope of Build
class. I am looking for an builtin solution in Nuke
or a "cleaner" solution whatever that means.
Upvotes: 3
Views: 82