Make a difference between running order and dependencies #3348
Replies: 5 comments
-
Renaming Maybe keep |
Beta Was this translation helpful? Give feedback.
-
I've been burned a few times by having a dependent task run even though the "parent" task's For example: var runIntegrationTests = Argument<bool>("runIntegrationTests", false);
Task("Default")
.IsDependentOn("Build")
.IsDependentOn("Run Unit Tests")
.IsDependentOn("Run Integration Tests")
;
Task("Run Integration Tests")
.WithCriteria(runIntegrationTests)
.IsDependentOn("Provision VM")
.IsDependentOn("Execute Integration Tests")
.IsDependentOn("Tear Down VM")
;
// other tasks ...
RunTarget("Default"); Since I'm not saying this solves the problem, but what is the reason for evaluating the |
Beta Was this translation helpful? Give feedback.
-
@dbertram Well, in your example you're only telling Cake that You could however argue that something that relies on |
Beta Was this translation helpful? Give feedback.
-
I think my initial understanding/expectation of how The docs say the following about
Given that description, it wasn't clear to me that criteria and dependencies are basically two completely separate features. My personal thoughts would be to do one of the following:
If the above causes too many other problems, yes, something like |
Beta Was this translation helpful? Give feedback.
-
A Task("Clean")
.Does(() =>
{
// remove all outputs
});
Task("EnsureOutputDirExists")
.Does(() =>
{
// create a custom artifacts directory
}
Task("Build")
.IsDependentOn("EnsureOutputDirExists")
.Does(() =>
{
// puts some stuff in the custom artifacts directory
}
Task("Clean-Build")
.IsDependentOn("Clean")
.IsDependentOn("Build"); If I now run
I could make sure that if both |
Beta Was this translation helpful? Give feedback.
-
A dependency is something that HAS to be run before something else. If it does not have to be run, it should allow the task to run anyway.
In the example before, the task
Second
will be run regardless ifshouldDoStuff
was true or not,Third
is dependent onSecond
though, so ifSecond
did not run, an exception will be thrown.Beta Was this translation helpful? Give feedback.
All reactions