I want to run my source compilation source.cake file and then compile Build.cake file But i should not start Build.cake if source.cake file has failures.So how to pass the compilation status of soruce.cake file value to build.cake ?
Is this possible in cake ?
Yes there's several ways to do this if your running under the Windows Command line or Bash you can just to the use the &&
operator like this:
cake source.cake && cake build.cake
If your running PowerShell you can do the following
cake .\source.cake;if($LASTEXITCODE -eq 0) { cake .\build.cake }
Cake also has an alias to execute Cake scripts so you could also call source.cake from your build.cake the first thing you do like this in your build.cake
:
//First line of build.cake
CakeExecuteScript("./source.cake");
//If above fails it'll throw an exception and stop executing build.cake
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