Closed
Description
Usage Information
Nuke version 8.0.0, .NET SDK version 8.0.101, .NET 8, Windows
Description
Trying to make a pipeline library for Nuke Build, with default pipeline and target dependency, when I fall inside a specific edge case with Build Components. Seems like TryDependsOn<> not assure to skip the target if the dependency is skipped when using interfaces.
Thinks it's linked to #1296 and available on Discord for more information.
Reproduction Steps
For easy reproduction :
https://gitlab.com/neitherlands/ouroboros/-/tree/test/dependency-nuke?ref_type=heads
Otherwise :
- Make two interface, one depending on the other
- Implement explicitly the interface in the Build
Should look like that
using Nuke.Common;
using Nuke.Common.Execution;
using Serilog;
public interface ISkipped : INukeBuild
{
public Target Skipped => _ => _
.Executes(() => { Log.Information("Skipped"); });
}
public interface ITest : INukeBuild
{
public Target Test => _ => _
.TryDependsOn<ISkipped>()
.Executes(() => { Log.Information("Test"); });
}
[UnsetVisualStudioEnvironmentVariables]
public class Build : NukeBuild, ISkipped, ITest
{
public static int Main() => Execute<Build>(x => x.All);
public Target All => _ => _
.Triggers<ITest>();
Target ISkipped.Skipped => _ => _
.OnlyWhenStatic(() => !IsLocalBuild)
.WhenSkipped(DependencyBehavior.Skip)
.Inherit<ISkipped>();
}
- Then run in local
Expected Behavior
All targets would be skipped.
Actual Behavior
Regression?
No response
Known Workarounds
Using a interface dependency with a function that checks SkippedTargets collection and see a particular step is skipped, than using it with OnlyWhenStatic on others targets.
Could you help with a pull-request?
Yes