コード例 #1
0
 internal GraphNode(TargetInProgessState targetState)
 {
     this.targetState    = targetState;
     this.children       = new List <GraphNode>();
     this.traversalIndex = InvalidIndex;
     this.isRoot         = false;
 }
コード例 #2
0
ファイル: Introspector.cs プロジェクト: xen2/msbuild
        /// <summary>
        /// This function is called to break the link between two targets that creates a cycle. The link could be
        /// due to depends/onerror relationship between parent and child. In that case both parent and child are
        /// on the same node and within the same project. Or the link could be formed by an IBuildEngine callback
        /// (made such by tasks such as MSBuild or CallTarget) in which case there maybe multiple requests forming
        /// same link between parent and child. Also in that case parent and child maybe on different nodes and/or in
        /// different projects. In either case the break is forced by finding the correct builds states and causing
        /// them to fail.
        /// </summary>
        internal void BreakCycle(TargetInProgessState child, TargetInProgessState parent)
        {
            ErrorUtilities.VerifyThrow(child.TargetId.nodeId == parentEngine.NodeId,
                                       "Expect the child target to be on the node");

            Project parentProject = projectManager.GetProject(child.TargetId.projectId);

            ErrorUtilities.VerifyThrow(parentProject != null,
                                       "Expect the parent project to be on the node");

            Target childTarget = parentProject.Targets[child.TargetId.name];

            List <ProjectBuildState> parentStates = FindConnectingContexts(child, parent, childTarget, childTarget.ExecutionState.GetWaitingBuildContexts(),
                                                                           childTarget.ExecutionState.InitiatingBuildContext);

            ErrorUtilities.VerifyThrow(parentStates.Count > 0, "Must find at least one matching context");

            for (int i = 0; i < parentStates.Count; i++)
            {
                parentStates[i].CurrentBuildContextState = ProjectBuildState.BuildContextState.CycleDetected;
                TaskExecutionContext taskExecutionContext =
                    new TaskExecutionContext(parentProject, childTarget, null, parentStates[i], EngineCallback.invalidEngineHandle,
                                             EngineCallback.inProcNode, null);

                parentEngine.PostTaskOutputUpdates(taskExecutionContext);
            }
        }
コード例 #3
0
ファイル: Introspector.cs プロジェクト: xen2/msbuild
        /// <summary>
        /// Find all the build contexts that connects child to parent. The only time multiple contexts are possible
        /// is if the connection is formed by an IBuildEngine callback which requests the same target in the
        /// same project to be build in parallel multiple times.
        /// </summary>
        internal List <ProjectBuildState> FindConnectingContexts
        (
            TargetInProgessState child,
            TargetInProgessState parent,
            Target childTarget,
            List <ProjectBuildState> waitingStates,
            ProjectBuildState initiatingBuildContext
        )
        {
            List <ProjectBuildState> connectingContexts = new List <ProjectBuildState>();

            // Since the there is a cycle formed at the child there must be at least two requests
            // since the edge between the parent and the child is a backward edge
            ErrorUtilities.VerifyThrow(waitingStates != null, "There must be a at least two requests at the child");


            for (int i = 0; i < waitingStates.Count; i++)
            {
                if (child.CheckBuildContextForParentMatch(parentEngine.EngineCallback, parent.TargetId, childTarget, waitingStates[i]))
                {
                    connectingContexts.Add(waitingStates[i]);
                }
            }


            if (child.CheckBuildContextForParentMatch(parentEngine.EngineCallback, parent.TargetId, childTarget, initiatingBuildContext))
            {
                connectingContexts.Add(initiatingBuildContext);
            }

            return(connectingContexts);
        }
コード例 #4
0
 internal override void CreateFromStream(BinaryReader reader)
 {
     base.CreateFromStream(reader);
     child = new TargetInProgessState();
     child.CreateFromStream(reader);
     parent = new TargetInProgessState();
     parent.CreateFromStream(reader);
 }
コード例 #5
0
        public void PostIntrospectorCommand(int nodeIndex, TargetInProgessState child, TargetInProgessState parent)
        {
            // Send the updated settings once the node has initialized
            LocalCallDescriptorForPostIntrospectorCommand callDescriptor =
                new LocalCallDescriptorForPostIntrospectorCommand(child, parent);

            nodeData[nodeIndex].NodeCommandQueue.Enqueue(callDescriptor);
        }
コード例 #6
0
ファイル: TargetCycleDetector.cs プロジェクト: nikson/msbuild
 /// <summary>
 /// Add a information about an array of inprogress targets to the graph
 /// </summary>
 internal void AddTargetsToGraph(TargetInProgessState[] inprogressTargets)
 {
     if (inprogressTargets != null)
     {
         for (int i = 0; i < inprogressTargets.Length; i++)
         {
             if (inprogressTargets[i] != null)
             {
                 AddTargetToGraph(inprogressTargets[i]);
             }
         }
     }
 }
コード例 #7
0
        /// <summary>
        /// Add a information about a given inprogress target to the graph
        /// </summary>
        private void AddTargetToGraph(TargetInProgessState inProgressTarget)
        {
            // Check if the target is already in the graph in which
            // case reuse the current object
            GraphNode targetNode = (GraphNode)dependencyGraph[inProgressTarget.TargetId];

            if (targetNode == null)
            {
                targetNode = new GraphNode(inProgressTarget);
                dependencyGraph.Add(inProgressTarget.TargetId, targetNode);
            }
            else
            {
                ErrorUtilities.VerifyThrow(targetNode.targetState == null, "Target should only be added once");
                targetNode.targetState = inProgressTarget;
            }

            // For each parent target - add parent links creating parent targets if necessary
            foreach (TargetInProgessState.TargetIdWrapper parentTarget in inProgressTarget.ParentTargets)
            {
                GraphNode parentNode = (GraphNode)dependencyGraph[parentTarget];
                if (parentNode == null)
                {
                    parentNode = new GraphNode(null);
                    dependencyGraph.Add(parentTarget, parentNode);
                }
                parentNode.children.Add(targetNode);
            }

            // For all outgoing requests add them to the list of outstanding requests for the system
            if (inProgressTarget.OutstandingBuildRequests != null)
            {
                // Since the nodeIndex is not serialized it is necessary to restore it after the request
                // travels across the wire
                for (int i = 0; i < inProgressTarget.OutstandingBuildRequests.Length; i++)
                {
                    inProgressTarget.OutstandingBuildRequests[i].NodeIndex = inProgressTarget.TargetId.nodeId;
                }
                outstandingExternalRequests.Add(inProgressTarget.TargetId, inProgressTarget.OutstandingBuildRequests);
            }

            // If the target has no parents mark it as root (such targets are created due to host requests)
            if (inProgressTarget.RequestedByHost)
            {
                targetNode.isRoot = true;
            }
        }
コード例 #8
0
ファイル: TargetCycleDetector.cs プロジェクト: nikson/msbuild
        /// <summary>
        /// Add a information about a given inprogress target to the graph
        /// </summary>
        private void AddTargetToGraph(TargetInProgessState inProgressTarget)
        {
            // Check if the target is already in the graph in which
            // case reuse the current object
            GraphNode targetNode = (GraphNode)dependencyGraph[inProgressTarget.TargetId];
            if (targetNode == null)
            {
                targetNode = new GraphNode(inProgressTarget);
                dependencyGraph.Add(inProgressTarget.TargetId, targetNode);
            }
            else
            {
                ErrorUtilities.VerifyThrow(targetNode.targetState == null, "Target should only be added once");
                targetNode.targetState = inProgressTarget;
            }

            // For each parent target - add parent links creating parent targets if necessary
            foreach (TargetInProgessState.TargetIdWrapper parentTarget in inProgressTarget.ParentTargets)
            {
                GraphNode parentNode = (GraphNode)dependencyGraph[parentTarget];
                if (parentNode == null)
                {
                    parentNode = new GraphNode(null);
                    dependencyGraph.Add(parentTarget, parentNode);
                }
                parentNode.children.Add(targetNode);
            }

            // For all outgoing requests add them to the list of outstanding requests for the system
            if (inProgressTarget.OutstandingBuildRequests != null)
            {
                // Since the nodeIndex is not serialized it is necessary to restore it after the request
                // travels across the wire
                for (int i = 0; i < inProgressTarget.OutstandingBuildRequests.Length; i++)
                {
                    inProgressTarget.OutstandingBuildRequests[i].NodeIndex = inProgressTarget.TargetId.nodeId;
                }
                outstandingExternalRequests.Add(inProgressTarget.TargetId, inProgressTarget.OutstandingBuildRequests);
            }

            // If the target has no parents mark it as root (such targets are created due to host requests)
            if (inProgressTarget.RequestedByHost)
            {
                targetNode.isRoot = true;
            }
        }
コード例 #9
0
ファイル: NodeStatus.cs プロジェクト: szaliszali/msbuild
        internal static NodeStatus CreateFromStream(BinaryReader reader)
        {
            NodeStatus status = new NodeStatus(null);

            status.traversalType               = reader.ReadBoolean();
            status.statusTimeStamp             = reader.ReadInt64();
            status.requestId                   = reader.ReadInt32();
            status.isActive                    = reader.ReadBoolean();
            status.isLaunchInProgress          = reader.ReadBoolean();
            status.queueDepth                  = reader.ReadInt32();
            status.lastTaskActivityTimeStamp   = reader.ReadInt64();
            status.lastEngineActivityTimeStamp = reader.ReadInt64();

            if (reader.ReadByte() == 0)
            {
                status.stateOfInProgressTargets = null;
            }
            else
            {
                int numberOfInProgressTargets = reader.ReadInt32();
                status.stateOfInProgressTargets = new TargetInProgessState[numberOfInProgressTargets];
                for (int i = 0; i < numberOfInProgressTargets; i++)
                {
                    if (reader.ReadByte() == 0)
                    {
                        status.stateOfInProgressTargets[i] = null;
                    }
                    else
                    {
                        TargetInProgessState state = new TargetInProgessState();
                        state.CreateFromStream(reader);
                        status.stateOfInProgressTargets[i] = state;
                    }
                }
            }

            if (reader.ReadByte() == 0)
            {
                status.unhandledException = null;
            }
            else
            {
                status.unhandledException = (Exception)formatter.Deserialize(reader.BaseStream);
            }
            return(status);
        }
コード例 #10
0
ファイル: NodeManager.cs プロジェクト: xetrocoen/msbuild
        internal void PostCycleNotification
        (
            int nodeId,
            TargetInProgessState child,
            TargetInProgessState parent)
        {
            if (nodeId == 0)
            {
                parentEngine.Introspector.BreakCycle(child, parent);
            }

            for (int i = 0; i < nodeList.Count; i++)
            {
                if (nodeList[i].NodeId == nodeId)
                {
                    nodeList[i].NodeProvider.PostIntrospectorCommand(nodeList[i].NodeIndex, child, parent);
                    break;
                }
            }
        }
コード例 #11
0
        public void TargetInProgressStateCustomSerialization()
        {
            Engine engine = new Engine(@"c:\");
            Project project = ObjectModelHelpers.CreateInMemoryProject(@"
                   <Project DefaultTargets=`t` ToolsVersion=`msbuilddefaulttoolsversion` xmlns=`msbuildnamespace`>
                        <PropertyGroup>
                        <OutputPath>bin\Debug\</OutputPath>
                        <AssemblyName>MyAssembly</AssemblyName>
                        <OutputType>Exe</OutputType>
                        <Configuration>Debug</Configuration>
                      </PropertyGroup>
                      <ItemGroup>
                        <Compile Include=`Class1.cs` />
                        <EmbeddedResource Include=`Resource1.txt` />
                        <EmbeddedResource Include=`Resource2.resx` />
                      </ItemGroup>
                      <Target Name='t' DependsOnTargets='Build'/>
                    <Import Project=`$(MSBuildBinPath)\Microsoft.CSharp.Targets` />
                    </Project>
                "); 
            EngineCallback engineCallback = new EngineCallback(engine);
            Target build = project.Targets["Build"];
            List<ProjectBuildState> waitingBuildStates = null;

            int handleId = 1;
            string projectFileName = "ProjectFileName";
            string[] targetNames = new string[] { "t" };
            Dictionary<string, string> dictionary = null;
            int requestId = 1;
            BuildRequest request = new BuildRequest(handleId, projectFileName, targetNames, (IDictionary)dictionary, null, requestId, false, false);
            ArrayList targetNamesToBuild = new ArrayList();
            targetNamesToBuild.Add("t");
            ProjectBuildState initiatingRequest = new ProjectBuildState(request, targetNamesToBuild, new BuildEventContext(1, 2, 2, 2));
            initiatingRequest.AddBlockingTarget("Build");
            BuildRequest [] outstandingBuildRequests = null;
            string projectName = "SuperTestProject";
            
            

            TargetInProgessState targetInProgress1 = new TargetInProgessState(
                                                              engineCallback,
                                                              build,
                                                              waitingBuildStates,
                                                              initiatingRequest,
                                                              outstandingBuildRequests,
                                                              projectName
                                                          );
            
            targetInProgress1.ParentTargetsForBuildRequests = null;
            Assertion.AssertNull(targetInProgress1.ParentTargetsForBuildRequests);
            Assertion.Assert(!targetInProgress1.RequestedByHost);

            build = project.Targets["t"];
             request = new BuildRequest(handleId, projectFileName, targetNames, (IDictionary)dictionary, null, requestId, false, false);
            request.IsExternalRequest = true;
            targetNamesToBuild.Add("t");
            initiatingRequest = new ProjectBuildState(request, targetNamesToBuild, new BuildEventContext(1, 2, 2, 2));
            outstandingBuildRequests = new BuildRequest[]{
                new BuildRequest(1, projectFileName, targetNames, (IDictionary)dictionary, null, requestId, false, false),
                new BuildRequest(2, projectFileName, targetNames, (IDictionary)dictionary, null, requestId, false, false),
                new BuildRequest(3, projectFileName, targetNames, (IDictionary)dictionary, null, requestId, false, false),
                new BuildRequest(4, projectFileName, targetNames, (IDictionary)dictionary, null, requestId, false, false)
            };

            TargetInProgessState.TargetIdWrapper originalWrapper = new TargetInProgessState.TargetIdWrapper();
            originalWrapper.id = 1;
            originalWrapper.name = "Wrapper";
            originalWrapper.nodeId = 4;
            originalWrapper.projectId = 6;
            waitingBuildStates = new List<ProjectBuildState>();
            waitingBuildStates.Add(initiatingRequest);

            TargetInProgessState targetInProgress3 = new TargetInProgessState(
                                                              engineCallback,
                                                              build,
                                                              waitingBuildStates,
                                                              initiatingRequest,
                                                              outstandingBuildRequests,
                                                              projectName
                                                          );
            targetInProgress3.ParentTargetsForBuildRequests = new TargetInProgessState.TargetIdWrapper[] { originalWrapper };

            // Stream, writer and reader where the events will be serialized and deserialized from
            MemoryStream stream = new MemoryStream();
            BinaryWriter writer = new BinaryWriter(stream);
            BinaryReader reader = new BinaryReader(stream);
            try
            {
                stream.Position = 0;
                // Serialize
                targetInProgress3.WriteToStream(writer);
                // Get position of stream after write so it can be compared to the position after read
                long streamWriteEndPosition = stream.Position;

                // Deserialize and Verify
                stream.Position = 0;
                TargetInProgessState newInProgressState = new TargetInProgessState();
                newInProgressState.CreateFromStream(reader);
                long streamReadEndPosition = stream.Position;
                Assert.IsTrue(string.Compare(newInProgressState.ProjectName, projectName, StringComparison.OrdinalIgnoreCase) == 0);
                Assert.IsTrue(string.Compare(newInProgressState.TargetId.name, "t", StringComparison.OrdinalIgnoreCase) == 0);
                Assert.IsNotNull(newInProgressState.ParentTargets);
                Assert.IsTrue(newInProgressState.OutstandingBuildRequests.Length == 4);
                Assert.IsNotNull(newInProgressState.ParentBuildRequests);
                Assert.IsNotNull(newInProgressState.ParentTargetsForBuildRequests.Length == 1);

                stream.Position = 0;
                // Serialize
                targetInProgress1.WriteToStream(writer);
                // Get position of stream after write so it can be compared to the position after read
                 streamWriteEndPosition = stream.Position;

                // Deserialize and Verify
                stream.Position = 0;
                newInProgressState = new TargetInProgessState();
                newInProgressState.CreateFromStream(reader);
                streamReadEndPosition = stream.Position;
                Assert.IsTrue(string.Compare(newInProgressState.ProjectName, projectName,StringComparison.OrdinalIgnoreCase)==0);
                Assert.IsTrue(string.Compare(newInProgressState.TargetId.name,"Build",StringComparison.OrdinalIgnoreCase)==0);
                Assert.IsNotNull(newInProgressState.ParentTargets);
                Assert.IsNull(newInProgressState.OutstandingBuildRequests);
                Assert.IsNotNull(newInProgressState.ParentBuildRequests);

                TargetInProgessState targetInProgress2 = new TargetInProgessState();
                stream.Position = 0;
                // Serialize
                targetInProgress2.WriteToStream(writer);
                // Get position of stream after write so it can be compared to the position after read
                streamWriteEndPosition = stream.Position;

                // Deserialize and Verify
                stream.Position = 0;
                newInProgressState = new TargetInProgessState();
                newInProgressState.CreateFromStream(reader);
                streamReadEndPosition = stream.Position;
                Assert.IsNull(newInProgressState.ProjectName);
                Assert.IsNull(newInProgressState.TargetId);
                Assert.IsNull(newInProgressState.ParentTargets);
                Assert.IsNull(newInProgressState.OutstandingBuildRequests);
                Assert.IsNull(newInProgressState.ParentBuildRequests);
            }
            finally
            {
                // Close will close the writer/reader and the underlying stream
                writer.Close();
                reader.Close();
                reader = null;
                stream = null;
                writer = null;
            }
        }
コード例 #12
0
ファイル: LocalCallDescriptor.cs プロジェクト: nikson/msbuild
 internal override void CreateFromStream(BinaryReader reader)
 {
     base.CreateFromStream(reader);
     child = new TargetInProgessState();
     child.CreateFromStream(reader);
     parent = new TargetInProgessState();
     parent.CreateFromStream(reader);
 }
コード例 #13
0
ファイル: LocalCallDescriptor.cs プロジェクト: nikson/msbuild
 internal LocalCallDescriptorForPostIntrospectorCommand(TargetInProgessState child, TargetInProgessState parent)
     : base(LocalCallType.PostIntrospectorCommand)
 {
     this.child  = child;
     this.parent = parent;
 }
コード例 #14
0
ファイル: NodeManager.cs プロジェクト: nikson/msbuild
        internal void PostCycleNotification
        (
            int nodeId, 
            TargetInProgessState child, 
            TargetInProgessState parent)
        {
            if (nodeId == 0)
            {
                parentEngine.Introspector.BreakCycle(child, parent);
            }

            for (int i = 0; i < nodeList.Count; i++)
            {
                if (nodeList[i].NodeId == nodeId)
                {
                    nodeList[i].NodeProvider.PostIntrospectorCommand(nodeList[i].NodeIndex, child, parent);
                    break;
                }
            }
        }
コード例 #15
0
 internal LocalCallDescriptorForPostIntrospectorCommand(TargetInProgessState child, TargetInProgessState parent)
     : base(LocalCallType.PostIntrospectorCommand)
 {
     this.child  = child;
     this.parent = parent;
 }
コード例 #16
0
ファイル: Engine.cs プロジェクト: nikson/msbuild
        /// <summary>
        /// This function collects status about the inprogress targets and engine operations. 
        /// This function should always run from the engine domain because it touch engine data
        /// structures.
        /// </summary>
        internal NodeStatus RequestStatus(int requestId)
        {
            // Find out the list of the inprogress waiting targets
            List<BuildRequest []> outstandingRequests = new List<BuildRequest []>();
            int [] handleIds = NodeManager.TaskExecutionModule.GetWaitingTaskData(outstandingRequests);
            Target [] waitingTargets = EngineCallback.GetListOfTargets(handleIds);

            // Find out the list of targets waiting due to dependency or onerror call but not actively in progress
            List<Project> inProgressProject = cacheOfBuildingProjects.GetInProgressProjects();
            List<Target> inProgressTargets = new List<Target>();
            foreach (Project project in inProgressProject)
            {
                foreach (Target target in project.Targets)
                {
                    if (target.ExecutionState != null && target.ExecutionState.BuildingRequiredTargets)
                    {
                        inProgressTargets.Add(target);
                    }
                }
            }
            TargetInProgessState[] stateOfInProgressTargets = 
                    new TargetInProgessState[waitingTargets.Length + inProgressTargets.Count];
            for (int i = 0; i < waitingTargets.Length; i++)
            {
                stateOfInProgressTargets[i] = null;
                // Skip if the in progress task has already completed (the task is running in the TEM domain)
                if (waitingTargets[i] != null)
                {
                    TargetExecutionWrapper executionState = waitingTargets[i].ExecutionState;
                    // Skip the target if it has already completed
                    if (executionState != null)
                    {
                        stateOfInProgressTargets[i] =
                            new TargetInProgessState(EngineCallback, waitingTargets[i], executionState.GetWaitingBuildContexts(),
                                                     executionState.InitiatingBuildContext,
                                                     outstandingRequests[i], waitingTargets[i].ParentProject.FullFileName);
                    }
                }
            }
            for (int i = 0; i < inProgressTargets.Count; i++)
            {
                TargetExecutionWrapper executionState = inProgressTargets[i].ExecutionState;
                ErrorUtilities.VerifyThrow(executionState != null,
                                           "Engine thread is blocked so target state should not change");

                stateOfInProgressTargets[waitingTargets.Length + i] =
                    new TargetInProgessState(EngineCallback, inProgressTargets[i], executionState.GetWaitingBuildContexts(),
                                             executionState.InitiatingBuildContext,
                                             null, inProgressTargets[i].ParentProject.FullFileName);
            }

            NodeStatus nodeStatus = new NodeStatus(requestId, true, buildRequests.Count + taskOutputUpdates.Count,
                                                   NodeManager.TaskExecutionModule.LastTaskActivity(),
                                                   lastLoopActivity, false);

            nodeStatus.StateOfInProgressTargets = stateOfInProgressTargets;

            return nodeStatus;
        }
コード例 #17
0
ファイル: Introspector.cs プロジェクト: nikson/msbuild
        /// <summary>
        /// This function is called to break the link between two targets that creates a cycle. The link could be 
        /// due to depends/onerror relationship between parent and child. In that case both parent and child are
        /// on the same node and within the same project. Or the link could be formed by an IBuildEngine callback 
        /// (made such by tasks such as MSBuild or CallTarget) in which case there maybe multiple requests forming 
        /// same link between parent and child. Also in that case parent and child maybe on different nodes and/or in 
        /// different projects. In either case the break is forced by finding the correct builds states and causing
        /// them to fail.
        /// </summary>
        internal void BreakCycle(TargetInProgessState child, TargetInProgessState parent)
        {
            ErrorUtilities.VerifyThrow( child.TargetId.nodeId == parentEngine.NodeId,
                                        "Expect the child target to be on the node");

            Project parentProject = projectManager.GetProject(child.TargetId.projectId);

            ErrorUtilities.VerifyThrow(parentProject  != null,
                                        "Expect the parent project to be on the node");

            Target childTarget = parentProject.Targets[child.TargetId.name];

            List<ProjectBuildState> parentStates = FindConnectingContexts(child, parent, childTarget, childTarget.ExecutionState.GetWaitingBuildContexts(),
                                      childTarget.ExecutionState.InitiatingBuildContext);

            ErrorUtilities.VerifyThrow(parentStates.Count > 0, "Must find at least one matching context");

            for (int i = 0; i < parentStates.Count; i++)
            {
                parentStates[i].CurrentBuildContextState = ProjectBuildState.BuildContextState.CycleDetected;
                TaskExecutionContext taskExecutionContext =
                    new TaskExecutionContext(parentProject, childTarget, null, parentStates[i], EngineCallback.invalidEngineHandle, 
                                             EngineCallback.inProcNode, null);

                parentEngine.PostTaskOutputUpdates(taskExecutionContext);
            }
        }
コード例 #18
0
ファイル: Introspector.cs プロジェクト: nikson/msbuild
        /// <summary>
        /// Find all the build contexts that connects child to parent. The only time multiple contexts are possible
        /// is if the connection is formed by an IBuildEngine callback which requests the same target in the
        /// same project to be build in parallel multiple times.
        /// </summary>
        internal List<ProjectBuildState> FindConnectingContexts
        (
            TargetInProgessState child, 
            TargetInProgessState parent,
            Target childTarget,
            List<ProjectBuildState> waitingStates,
            ProjectBuildState initiatingBuildContext
        )
        {
            List<ProjectBuildState> connectingContexts = new List<ProjectBuildState>();

            // Since the there is a cycle formed at the child there must be at least two requests
            // since the edge between the parent and the child is a backward edge
            ErrorUtilities.VerifyThrow(waitingStates != null, "There must be a at least two requests at the child");


            for (int i = 0; i < waitingStates.Count; i++)
            {
                if (child.CheckBuildContextForParentMatch(parentEngine.EngineCallback, parent.TargetId, childTarget, waitingStates[i]))
                {
                    connectingContexts.Add(waitingStates[i]);
                }
            }


            if (child.CheckBuildContextForParentMatch(parentEngine.EngineCallback, parent.TargetId, childTarget, initiatingBuildContext))
            {
                connectingContexts.Add(initiatingBuildContext);
            }

            return connectingContexts;
        }
コード例 #19
0
ファイル: NodeManager_Tests.cs プロジェクト: nikson/msbuild
 public void PostIntrospectorCommand(int nodeIndex, TargetInProgessState child, TargetInProgessState parent)
 {
 }
コード例 #20
0
ファイル: NodeStatus.cs プロジェクト: nikson/msbuild
        internal static NodeStatus CreateFromStream(BinaryReader reader)
        {
            NodeStatus status = new NodeStatus(null);
            status.traversalType = reader.ReadBoolean();
            status.statusTimeStamp = reader.ReadInt64();
            status.requestId = reader.ReadInt32();
            status.isActive = reader.ReadBoolean();
            status.isLaunchInProgress = reader.ReadBoolean();
            status.queueDepth = reader.ReadInt32();
            status.lastTaskActivityTimeStamp = reader.ReadInt64();
            status.lastEngineActivityTimeStamp = reader.ReadInt64();

            if (reader.ReadByte() == 0)
            {
                status.stateOfInProgressTargets = null;
            }
            else
            {
                int numberOfInProgressTargets = reader.ReadInt32();
                status.stateOfInProgressTargets = new TargetInProgessState[numberOfInProgressTargets];
                for (int i = 0; i < numberOfInProgressTargets; i++)
                {
                    if (reader.ReadByte() == 0)
                    {
                        status.stateOfInProgressTargets[i] = null;
                    }
                    else
                    {
                        TargetInProgessState state = new TargetInProgessState();
                        state.CreateFromStream(reader);
                        status.stateOfInProgressTargets[i] = state;
                    }
                }
            }

            if (reader.ReadByte() == 0)
            {
                status.unhandledException = null;
            }
            else
            {
                status.unhandledException = (Exception)formatter.Deserialize(reader.BaseStream);
            }
            return status;
        }
コード例 #21
0
ファイル: TargetCycleDetector.cs プロジェクト: nikson/msbuild
 internal GraphNode(TargetInProgessState targetState)
 {
     this.targetState = targetState;
     this.children = new List<GraphNode>();
     this.traversalIndex = InvalidIndex;
     this.isRoot = false;
 }
コード例 #22
0
ファイル: LocalNodeProvider.cs プロジェクト: nikson/msbuild
 public void PostIntrospectorCommand(int nodeIndex, TargetInProgessState child, TargetInProgessState parent)
 {
     // Send the updated settings once the node has initialized
     LocalCallDescriptorForPostIntrospectorCommand callDescriptor =
           new LocalCallDescriptorForPostIntrospectorCommand(child, parent);
     nodeData[nodeIndex].NodeCommandQueue.Enqueue(callDescriptor);
 }