/// <summary> /// Executes a list of actions. /// </summary> public static void ExecuteActions(BuildConfiguration BuildConfiguration, List <Action> ActionsToExecute, List <TargetDescriptor> TargetDescriptors = null) { Log.TraceInformation("Execute actions num:" + ActionsToExecute.Count + " target descriptors num:" + TargetDescriptors.Count); if (ActionsToExecute.Count == 0) { Log.TraceInformation("Target is up to date"); } else { // Figure out which executor to use ActionExecutor Executor; if (BuildConfiguration.bAllowHybridExecutor && HybridExecutor.IsAvailable()) { Executor = new HybridExecutor(); } else if (BuildConfiguration.bAllowXGE && XGE.IsAvailable()) { Executor = new XGE(); } else if (BuildConfiguration.bAllowDistcc) { Executor = new Distcc(); } else if (BuildConfiguration.bAllowSNDBS && SNDBS.IsAvailable()) { Executor = new SNDBS(); } else if (BuildConfiguration.bAllowParallelExecutor && ParallelExecutor.IsAvailable()) { Executor = new ParallelExecutor(); } else { Executor = new LocalExecutor(); } //if (BuildConfiguration.bAllowFastBuild && FastBuild_v1.IsAvailable()) //{ // Executor = new FastBuild_v1(Executor, TargetDescriptors); //} if (BuildConfiguration.bAllowFastBuild && FastBuild_v2.IsAvailable()) { Executor = new FastBuild_v2(Executor, TargetDescriptors); } // Execute the build Stopwatch Timer = Stopwatch.StartNew(); if (!Executor.ExecuteActions(ActionsToExecute, BuildConfiguration.bLogDetailedActionStats)) { throw new CompilationResultException(CompilationResult.OtherCompilationError); } Log.TraceInformation("Total time in {0} executor: {1:0.00} seconds", Executor.Name, Timer.Elapsed.TotalSeconds); // Reset the file info for all the produced items foreach (Action BuildAction in ActionsToExecute) { foreach (FileItem ProducedItem in BuildAction.ProducedItems) { ProducedItem.ResetCachedInfo(); } } // Verify the link outputs were created (seems to happen with Win64 compiles) foreach (Action BuildAction in ActionsToExecute) { if (BuildAction.ActionType == ActionType.Link) { foreach (FileItem Item in BuildAction.ProducedItems) { if (!Item.Exists) { throw new BuildException("Failed to produce item: {0}", Item.AbsolutePath); } } } } } }
/// <summary> /// Tests whether this executor can be used /// </summary> /// <returns>True if the executor may be used</returns> public static bool IsAvailable() { return(XGE.IsAvailable() && ParallelExecutor.IsAvailable()); }