Closed dennisdoomen closed 2 months ago
I am using 8.1.0, but this issue doesn't seem to be fixed?
A target (which is skipped) which depends on exactly one target runs this one target.
I also seeing this:
With the reproduction steps from this ticket and NUKE 8.1.1 I get following:
Target Restore => _ => _
.Executes(() =>
{
Information($"Should not execute... {nameof(Restore)}");
});
Target Compile => _ => _
.OnlyWhenStatic(() => IsServerBuild)
.DependsOn(Restore)
.Executes(() =>
{
Information($"Should not execute... {nameof(Compile)}");
});
With 8.1.2 this is fixed ~for OnlyWhenStatic
. OnlyWhenDynamic
still runs the dependencies?~ As the documentation states, this is the desired behavior :)
Thanks @matkoch 🎉
Usage Information
Nuke 8.0.0 / .NET 8.0.108 / Windows 11
Description
When I mark a target with
OnlyWhenDynamic
orOnlyWhenStatic
and the condition is not met, the target is skipped. But its dependencies are still executed, even if the target is the only one that uses it.Reproduction Steps
Target Restore => => .Executes(() => { });
Target Compile => => .OnlyWhenStatic(() => IsServerBuild) .DependsOn(Restore) .Executes(() => { });
Expected Behavior
When you run this locally, both the
Compile
andRestore
steps should be skipped.Actual Behavior
Regression?
Yes, but I don't remember exactly in which version. Even in 6.3.0 it doesn't work as expected.
Also,
.WhenSkipped(DependencyBehavior.Skip)
doesn't make a difference.Known Workarounds
Apply
OnlyWhenDynamic
on all targetsCould you help with a pull-request?
Yes