/// <summary> /// This method creates a BuildResult using the information contained in a completed build request and /// then routes it to the right node. On a child process, this means either consume the result localy, /// or send it to the parent node. On a parent node, this means either consume the result locally or /// send it to a child node /// </summary> internal void PostDoneNotice(BuildRequest buildRequest) { // Create a container with the results of the evaluation BuildResult buildResult = buildRequest.GetBuildResult(); // If we're supposed to use caching and this request wasn't restored from cache, cache it if (buildRequest.UseResultsCache && !buildRequest.RestoredFromCache) { CacheScope cacheScope = parentEngine.CacheManager.GetCacheScope(buildRequest.ProjectFileName, buildRequest.GlobalProperties, buildRequest.ToolsetVersion, CacheContentType.BuildResults); cacheScope.AddCacheEntryForBuildResults(buildResult); } // an external request is any request that came from the parent engine, all requests to a child are external // unless the project was alredy loaded on the node itself if (buildRequest.IsExternalRequest) { // If the build request was send from outside the current process, // send the results to the parent engine parentNode.PostBuildResultToHost(buildResult); } else { // In the case of a child process, getting to this point means the request will be satisfied locally, the node index should be 0 // on the parent engine however, the node index can be, 0 for the local node, or can be >0 which represents a child node PostDoneNotice(buildRequest.NodeIndex, buildResult); } }
public void GetBuildRequestTimingData() { BuildRequest request = new BuildRequest(); long time = DateTime.Now.Ticks; request.StartTime = time; Assert.IsTrue(request.StartTime == time); request.ProcessingStartTime = time; Assert.IsTrue(request.ProcessingStartTime == time); request.ProcessingTotalTime = time; Assert.IsTrue(request.ProcessingTotalTime == time); Assert.IsNotNull(request.GetBuildResult()); }
public void GetBuildResult() { int nodeProxyId = 1; string projectFileName = "ProjectFileName"; string[] targetNames = null; Dictionary <string, string> dictionary = null; int requestId = 1; // Test the case where we pass in null targets BuildRequest buildRequest = new BuildRequest(nodeProxyId, projectFileName, targetNames, (IDictionary)dictionary, null, requestId, false, false); Assert.IsNotNull(buildRequest.GetBuildResult(), "Expected GetBuildResult to return a non null BuildRequest"); }