Reputation: 207
I am using Cake 0.23.0 and was happy to read that task dependencies have been extended. Unfortunately it seems even the latest version does not solve my problem. Or am I just doing something wrong?
What I would like to achieve
Current Behaviour The resulting sequence is Task Init x86 -> Task A -> Task B -> Task C -> Task Init x64
It seems Cake does only respect task dependency once. I have defined it like shown below:
Task("Compile-All-Platforms")
.IsDependentOn("Init-86")
.IsDependentOn("A")
.IsDependentOn("B")
.IsDependentOn("C")
.IsDependentOn("Init-x64")
.IsDependentOn("A")
.IsDependentOn("B")
.IsDependentOn("C");
Upvotes: 1
Views: 556
Reputation: 184
If you want to build in two large steps, the naive way to do it would be encapsulate the build logic of A, B and C in helper functions and then wrap them in x86 or x64 tasks. The idea here is to leverage the dependency tree Cake is able to create for you instead of writing down all the dependencies in Compile-All. Actually, this is the main reason why you want to use build orchestrators.
Granted, this is a straightforward way to make it work for 3 tasks and 2 platforms. A much more scalable solution would be to create and addin or a helper script that accepts a "platform" parameter and builds N projects.
Do note the code bellow merely shows how to get what you ask done, but needs to be improved with appropriate WithCriteria instructions. If you take it as is, you wont be able to build x64 only.
Task("Compile-x86"){
BuildA();
BuildB();
BuildC();
};
Task("Init-x64")
.IsDependentOn("Compile-x86"){
//Your init code goes here
};
Task("Compile-x64")
.IsDependentOn("Init-x64"){
BuildA();
BuildB();
BuildC();
};
Task("Compile-All-Platforms")
.IsDependentOn("Compile-x64");
Upvotes: 1