In VS there is usually a distinction between Build (incremental) and Rebuild, where the latter would first clean but then do the same as Build. Can I provide similar behavior with FAKE?
Let's assume the following targets:
Target "Clean" DoNothing
Target "Work" DoNothing
Target "All" DoNothing
RunTargetOrDefault "All"
Normally I want to run all of them, Clean before Work, so I end up with:
"Clean" ==> "Work" ==> "All"
However, Work is not really depending on Clean - it is only that if both are to be run, Clean must run first. With the dependency chain above, I cannot run Work without Clean being run first. Is there way or common pattern to support this?
What I've considered so far:
A)
"Clean" ==> "All"
"Work" ==> "All"
This correctly represents the dependencies from All, but the order that Clean should be before Work - if both are run - is missing.
B)
Target "WorkOnly" DoNothing
"WorkOnly" ==> "Work"
"Clean" ==> "Work" ==> "All"
This is a bit closer, but it still does not guarantee that when building All that Clean will run before WorkOnly
C)
Target "Start" DoNothing
"Start"
=?> ("Clean", not (hasBuildParam "noclean"))
==> "Work"
==> "All"
This way, Clean would always run, except when I specify "noclean" as parameter. This seems to fully support my scenario and is actually quite flexible, but can get a bit complicated if there are multiple optional phases.
Is this the intended way and how others do it as well, or am I missing something obvious?
This means you can - for example - run fake run build.fsx --list or fake build --list to list your targets. To run a target MyTarget you could use fake run build.fsx -t MyTarget or fake build target MyTarget (or the other way around fake run build.fsx target MyTarget) All parameters after -- or target <target> are given to the target as paramters.
Xcode builds all explicit dependencies before the dependent target. To introduce explicit dependency, add a new item to the “Target Dependencies” list in the target’s build phases. Figure 2. Target Dependencies Build Phase. 1 - Add or remove items.
Final targets can be used for TearDown functionality. These targets will be executed even if the build fails but have to be activated via Target.ActivateFinal (). Build failure targets can be used to execute tasks after a build failure. These targets will be executed only after a build failure but have to be activated via activateBuildFailure ().
There are two general approaches to building unlocked packages with complex dependencies: building org-dependent unlocked packages (which are tightly coupled to an installing organization) or building loosely coupled unlocked packages and designing to manage dependencies.
No, there is no operator for this at the moment. You might want to create a pull request with a new operator.
We also have a prototype implementation for a future target dependency runtime. You can also try to add a new operator there.
I'm a bit late to the party.... But I've recently run into this kind of requirement myself.
I finally settled on the following:
In your case that would leave you with
Target "Clean" DoNothing
Target "Work" DoNothing
Target "Build" (fun _ ->
Run "Work"
)
Target "Rebuild" (fun _ ->
"Clean"
==> "Work"
Run "Work"
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With