public int Run(IFlubuSession flubuSession) { _flubuSession = flubuSession; try { ConfigureDefaultProps(flubuSession); BeforeBuildExecution(flubuSession); RunBuild(flubuSession); flubuSession.Complete(); AfterBuildExecution(flubuSession); return(0); } catch (TargetNotFoundException e) { flubuSession.ResetDepth(); OnBuildFailed(flubuSession, e); AfterBuildExecution(flubuSession); if (flubuSession.Args.RethrowOnException) { throw; } flubuSession.LogError(e.Message); return(3); } catch (WebApiException e) { flubuSession.ResetDepth(); OnBuildFailed(flubuSession, e); AfterBuildExecution(flubuSession); if (flubuSession.Args.RethrowOnException) { throw; } return(1); } catch (FlubuException e) { flubuSession.ResetDepth(); OnBuildFailed(flubuSession, e); if (!flubuSession.Args.RethrowOnException) { #if !NETSTANDARD1_6 flubuSession.LogError($"ERROR: {e.Message}", Color.Red); #else flubuSession.LogError($"error: {e.Message}"); #endif } AfterBuildExecution(flubuSession); if (flubuSession.Args.RethrowOnException) { throw; } return(1); } catch (Exception e) { flubuSession.ResetDepth(); OnBuildFailed(flubuSession, e); if (!flubuSession.Args.RethrowOnException) { #if !NETSTANDARD1_6 flubuSession.LogError($"ERROR: {e}", Color.Red); #else flubuSession.LogError($"error: {e}"); #endif } AfterBuildExecution(flubuSession); if (flubuSession.Args.RethrowOnException) { throw; } return(2); } }
public int Run(IFlubuSession flubuSession) { _flubuSession = flubuSession; _scriptProperties = flubuSession.ScriptServiceProvider.GetScriptProperties(); _targetCreator = flubuSession.ScriptServiceProvider.GetTargetCreator(); _flubuConfiguration = flubuSession.ScriptServiceProvider.GetFlubuConfiguration(); try { ConfigureDefaultProps(flubuSession); BeforeBuildExecution(flubuSession); RunBuild(flubuSession); flubuSession.Complete(); AfterBuildExecution(flubuSession); return(0); } catch (TargetNotFoundException e) { flubuSession.ResetDepth(); OnBuildFailed(flubuSession, e); AfterBuildExecution(flubuSession); if (flubuSession.Args.RethrowOnException) { throw; } flubuSession.LogError($"{Environment.NewLine}{e.Message}"); return(3); } catch (WebApiException e) { flubuSession.ResetDepth(); OnBuildFailed(flubuSession, e); AfterBuildExecution(flubuSession); if (flubuSession.Args.RethrowOnException) { throw; } return(1); } catch (FlubuException e) { flubuSession.ResetDepth(); OnBuildFailed(flubuSession, e); if (!flubuSession.Args.RethrowOnException) { flubuSession.LogError($"ERROR: {e.Message}", Color.Red); } AfterBuildExecution(flubuSession); if (flubuSession.Args.RethrowOnException) { throw; } return(1); } catch (Exception e) { flubuSession.ResetDepth(); OnBuildFailed(flubuSession, e); if (!flubuSession.Args.RethrowOnException) { flubuSession.LogError($"ERROR: {e}", Color.Red); } AfterBuildExecution(flubuSession); if (flubuSession.Args.RethrowOnException) { throw; } return(2); } }