Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run two cake file one by one based on first cake file compilation success?

Tags:

c#

cakebuild

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 ?

like image 833
vijay Avatar asked Nov 04 '16 06:11

vijay


1 Answers

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
like image 60
devlead Avatar answered Oct 28 '22 21:10

devlead