I have a task in my scripts that builds some tar artifact. I do not want to run the task if the build is running in a windows environment. So I came up with this construct:
Perhaps the “skip-if-empty” check (which is also reported as “up-to-date”) comes before the ‘onlyIf’ check, and the Tar isn’t configured to contain anything. For such a static check, you can also use ‘enabled = !isWindows’, which might solve the problem (i.e. the task should be reported as “skipped”).
If the task isn’t enabled, it won’t run. (Of course it has to be ‘enabled = !isWindows’, not ‘enabled = isWindows’.) If it does, something is wrong with the build script. Note that ‘enabled’ and ‘onlyIf’ don’t have any effect on dependent tasks (i.e. they will still run).
Note that enabled and onlyIf don’t have any effect on dependent tasks
this was something I didn’t know.
And, because my task “tarConfigChuck” defined a dependency on another user defined task, that latter was triggered. So, I have to conditionally enable that task also. Doing that makes things ok: