5

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 ?

vijay
  • 701
  • 2
  • 12
  • 26

1 Answers1

6

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
devlead
  • 4,935
  • 15
  • 36