/// <summary> /// This method lets the engine provide node with results of an evaluation it was waiting on. /// </summary> internal void PostBuildResult(BuildResult buildResult) { ErrorUtilities.VerifyThrow(localEngine != null, "Local engine should be initialized"); // Figure out the local handle id NodeRequestMapping nodeRequestMapping = null; try { lock (requestToLocalIdMapping) { nodeRequestMapping = (NodeRequestMapping)requestToLocalIdMapping[buildResult.RequestId]; requestToLocalIdMapping.Remove(buildResult.RequestId); } if (Engine.debugMode) { Console.WriteLine(nodeId + ": Got result for Request Id " + buildResult.RequestId); Console.WriteLine(nodeId + ": Received result for HandleId " + buildResult.HandleId + ":" + buildResult.RequestId + " mapped to " + nodeRequestMapping.HandleId + ":" + nodeRequestMapping.RequestId); } buildResult.HandleId = nodeRequestMapping.HandleId; buildResult.RequestId = nodeRequestMapping.RequestId; nodeRequestMapping.AddResultToCache(buildResult); // posts the result to the inproc node localEngine.Router.PostDoneNotice(0, buildResult); } catch (Exception ex) { ReportUnhandledError(ex); } }
internal void PostBuildRequestToHost(BuildRequest currentRequest) { // Since this request is going back to the host the local node should not have a project object for it ErrorUtilities.VerifyThrow(currentRequest.ProjectToBuild == null, "Should not have a project object"); // Add the request to the mapping hashtable so that we can recognize the outputs CacheScope cacheScope = localEngine.CacheManager.GetCacheScope(currentRequest.ProjectFileName, currentRequest.GlobalProperties, currentRequest.ToolsetVersion, CacheContentType.BuildResults); NodeRequestMapping nodeRequestMapping = new NodeRequestMapping(currentRequest.HandleId, currentRequest.RequestId, cacheScope); lock (requestToLocalIdMapping) { requestToLocalIdMapping.Add(lastRequestIdUsed, nodeRequestMapping); // Keep the request id local for this node currentRequest.RequestId = lastRequestIdUsed; lastRequestIdUsed++; } // Find the original external request that caused us to run this task TaskExecutionContext taskExecutionContext = localEngine.EngineCallback.GetTaskContextFromHandleId(currentRequest.HandleId); while (!taskExecutionContext.BuildContext.BuildRequest.IsExternalRequest) { ErrorUtilities.VerifyThrow(taskExecutionContext.BuildContext.BuildRequest.IsGeneratedRequest, "Must be a generated request"); taskExecutionContext = localEngine.EngineCallback.GetTaskContextFromHandleId(taskExecutionContext.BuildContext.BuildRequest.HandleId); } //Modify the request with the data that is expected by the parent engine currentRequest.HandleId = taskExecutionContext.BuildContext.BuildRequest.HandleId; currentRequest.NodeIndex = taskExecutionContext.BuildContext.BuildRequest.NodeIndex; try { outProcLoggingService.ProcessPostedLoggingEvents(); parentCallback.PostBuildRequestsToHost(new BuildRequest[] { currentRequest }); } catch (Exception e) { ReportUnhandledError(e); } }