nuke-build / nuke

🏗 The AKEless Build System for C#/.NET
https://nuke.build
MIT License
3.07k stars 367 forks source link

`nuke <target> --skip` is skipping the provided target #1415

Closed sfwester closed 2 months ago

sfwester commented 2 months ago

Usage Information

8.1.0 / 8.0.300 / net8.0 / Windows 11

Description

When I upgraded to 8.1.0 I observed that the --skip option, with no arguments, has started skipping the provided target.

Reproduction Steps

From an empty directory

dotnet tool install -g Nuke.GlobalTool
nuke :setup # accept all defaults
nuke Compile --skip

Expected Behavior

The Compile target is not skipped.

Note these results are observed if the Nuke.Common dependency is knocked down to 8.0.0 in the _build.csproj

$ nuke Compile --skip
PowerShell Desktop version 5.1.22621.3958
Microsoft (R) .NET SDK version 8.0.300

███╗   ██╗██╗   ██╗██╗  ██╗███████╗
████╗  ██║██║   ██║██║ ██╔╝██╔════╝
██╔██╗ ██║██║   ██║█████╔╝ █████╗  
██║╚██╗██║██║   ██║██╔═██╗ ██╔══╝  
██║ ╚████║╚██████╔╝██║  ██╗███████╗
╚═╝  ╚═══╝ ╚═════╝ ╚═╝  ╚═╝╚══════╝

NUKE Execution Engine version 8.0.0 (Windows,.NETCoreApp,Version=v8.0)

╬════════════
║ Compile
╬═══

═══════════════════════════════════════
Target             Status      Duration
───────────────────────────────────────
Restore            Skipped                // Skipped: via parameter
Compile            Succeeded     < 1sec
───────────────────────────────────────
Total                            < 1sec
═══════════════════════════════════════

Build succeeded on 2024-09-09 11:26:33 PM. \(^ᴗ^)/

Actual Behavior

The Compile target is skipped.

$ nuke Compile --skip
PowerShell Desktop version 5.1.22621.3958
Microsoft (R) .NET SDK version 8.0.300

███╗   ██╗██╗   ██╗██╗  ██╗███████╗
████╗  ██║██║   ██║██║ ██╔╝██╔════╝
██╔██╗ ██║██║   ██║█████╔╝ █████╗  
██║╚██╗██║██║   ██║██╔═██╗ ██╔══╝  
██║ ╚████║╚██████╔╝██║  ██╗███████╗
╚═╝  ╚═══╝ ╚═════╝ ╚═╝  ╚═╝╚══════╝

NUKE Execution Engine version 8.1.0 (Windows,.NETCoreApp,Version=v8.0)

═══════════════════════════════════════
Target             Status      Duration
───────────────────────────────────────
Restore            Skipped                // Skipped: via parameter
Compile            Skipped                // Skipped: via parameter
───────────────────────────────────────
Total                            < 1sec
═══════════════════════════════════════

Regression?

Yes, it works as expected in 8.0.0.

Known Workarounds

Skip all the the dependencies explicitly. e.g.,

$ nuke Compile --skip Restore
PowerShell Desktop version 5.1.22621.3958
Microsoft (R) .NET SDK version 8.0.300

███╗   ██╗██╗   ██╗██╗  ██╗███████╗
████╗  ██║██║   ██║██║ ██╔╝██╔════╝
██╔██╗ ██║██║   ██║█████╔╝ █████╗  
██║╚██╗██║██║   ██║██╔═██╗ ██╔══╝  
██║ ╚████║╚██████╔╝██║  ██╗███████╗
╚═╝  ╚═══╝ ╚═════╝ ╚═╝  ╚═╝╚══════╝

NUKE Execution Engine version 8.1.0 (Windows,.NETCoreApp,Version=v8.0)

╬════════════
║ Compile
╬═══

═══════════════════════════════════════
Target             Status      Duration
───────────────────────────────────────
Restore            Skipped                // Skipped: via parameter
Compile            Succeeded     < 1sec
───────────────────────────────────────
Total                            < 1sec
═══════════════════════════════════════

Build succeeded on 2024-09-09 11:34:00 PM. \(^ᴗ^)/

Could you help with a pull-request?

No

sfwester commented 2 months ago

I see this related entry in the changelog

Fixed invoked targets to not be excluded from skipping

Which looks like it was brought in by the fix for #1414.

But I don't think the behaviour I observed is intended? Otherwise, it is not clear if the empty --skip option can provide any value.

szekelymatyas commented 1 month ago

I initially thought the issue was related to the Nuke.Global .NET tool, but after investigating further, I discovered that the problem was with the version of Nuke.Common in my build.csproj file.

To resolve this, I had to downgrade the Nuke.Common NuGet package to version 8.0.0. Once I made that change, everything worked as expected.

I’m just leaving this comment here for any newbies like me who might run into the same problem!