Exemplo n.º 1
0
        //Run FASTBuild on the list of actions. Relies on fbuild.exe being in the path.
        public override bool ExecuteActions(List <Action> Actions, bool bLogDetailedActionStats)
        {
            bool FASTBuildResult = true;

            if (Actions.Count > 0)
            {
                string FASTBuildFilePath = Path.Combine(UnrealBuildTool.EngineDirectory.FullName, "Intermediate", "Build", "fbuild.bff");

                List <Action> LocalExecutorActions = new List <Action>();

                if (CreateBffFile(Actions, FASTBuildFilePath, LocalExecutorActions))
                {
                    FASTBuildResult = ExecuteBffFile(FASTBuildFilePath);

                    if (FASTBuildResult)
                    {
                        LocalExecutor localExecutor = new LocalExecutor();
                        foreach (Action action in LocalExecutorActions)
                        {
                            Console.WriteLine("[info] {0} // {1}", action.CommandPath, action.CommandArguments);
                        }

                        FASTBuildResult = localExecutor.ExecuteActions(LocalExecutorActions, bLogDetailedActionStats);
                    }
                }
                else
                {
                    FASTBuildResult = false;
                }
            }

            return(FASTBuildResult);
        }
Exemplo n.º 2
0
        /// <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);
                            }
                        }
                    }
                }
            }
        }