Beispiel #1
0
 public void ClearActions()
 {
     SyntaxNodeActions.Clear();
     CompilationStartActions.Clear();
     CompilationEndActions.Clear();
     CompilationActions.Clear();
     SemanticModelActions.Clear();
     SymbolActions.Clear();
     CodeBlockStartActions.Clear();
     CodeBlockActions.Clear();
     SyntaxTreeActions.Clear();
     OperationActions.Clear();
     OperationBlockActions.Clear();
     OperationBlockStartActions.Clear();
 }
Beispiel #2
0
        public static ExecutionResult ExecuteActions(List <Action> actions)
        {
            ExecutionResult fastBuildResult = ExecutionResult.TasksSucceeded;

            CompilationActions = null;
            LinkerActions      = null;

            if (actions.Count <= 0)
            {
                return(fastBuildResult);
            }

            if (IsAvailable() == false)
            {
                return(ExecutionResult.Unavailable);
            }

            List <Action> unassignedObjects = new List <Action>();
            List <Action> unassignedLinks   = new List <Action>();
            List <Action> miscActions       = actions.Where(a => a.ActionType != ActionType.Compile && a.ActionType != ActionType.Link).ToList();
            Dictionary <Action, BuildComponent> fastbuildActions = new Dictionary <Action, BuildComponent>();

            DeresponsifyActions(actions);

            CompilationActions = GatherActionsObjects(actions.Where(a => a.ActionType == ActionType.Compile), ref unassignedObjects, ref fastbuildActions);
            LinkerActions      = GatherActionsLink(actions.Where(a => a.ActionType == ActionType.Link), ref unassignedLinks, ref fastbuildActions);
            ResolveDependencies(CompilationActions, LinkerActions, fastbuildActions);

            Log.TraceInformation("Actions: " + actions.Count + " - Unassigned: " + unassignedObjects.Count);
            Log.TraceInformation("Misc Actions - FBuild: " + miscActions.Count);
            Log.TraceInformation("Objects - FBuild: " + CompilationActions.Count + " -- Local: " + unassignedObjects.Count);
            var lg = 0;

            if (LinkerActions != null)
            {
                lg = LinkerActions.Count;
            }
            Log.TraceInformation("Link - FBuild: " + lg + " -- Local: " + unassignedLinks.Count);

            if (unassignedLinks.Count > 0)
            {
                throw new Exception("Error, unaccounted for lib! Cannot guarantee there will be no prerequisite issues. Fix it");
            }
            if (unassignedObjects.Count > 0)
            {
                var actionThreadDictionary = new Dictionary <Action, ActionThread>();
                ExecuteLocalActions(unassignedObjects, actionThreadDictionary, unassignedObjects.Count);
            }

            if (FASTBuildConfiguration.UseSinglePassCompilation)
            {
                RunFBuild(BuildStep.CompileAndLink, GenerateFBuildFileString(BuildStep.CompileAndLink, CompilationActions.Concat(LinkerActions).ToList()));
            }
            else
            {
                if (CompilationActions.Any())
                {
                    fastBuildResult = RunFBuild(BuildStep.CompileObjects, GenerateFBuildFileString(BuildStep.CompileObjects, CompilationActions));
                }
                if (fastBuildResult == ExecutionResult.TasksSucceeded)
                {
                    if (LinkerActions != null && LinkerActions.Any())
                    {
                        if (!BuildConfiguration.bFastbuildNoLinking)
                        {
                            fastBuildResult = RunFBuild(BuildStep.Link, GenerateFBuildFileString(BuildStep.Link, LinkerActions));
                        }
                    }
                }
            }
            return(fastBuildResult);
        }