Exemplo n.º 1
0
        /// <summary>
        /// Checks if the target results are as expected. This method can only be called for targets may be built as a result of building
        /// the requested / default / initial targets
        /// </summary>
        public void ValidateNonPrimaryTargetEndResult(string targetName, TargetResultCode expectedResultCode, string[] items)
        {
            BuildResult  result       = _resultsCache.GetResultForRequest(_buildRequest);
            TargetResult targetResult = (TargetResult)result[targetName];

            InternalValidateTargetEndResult(targetResult, expectedResultCode, items);
        }
        public BuildResult GetResultForRequest(BuildRequest request)
        {
            var overrideResult = _override.GetResultForRequest(request);

            if (overrideResult != null)
            {
#if DEBUG
                ErrorUtilities.VerifyThrow(CurrentCache.GetResultForRequest(request) == null, "caches should not overlap");
#endif
                return(overrideResult);
            }

            return(CurrentCache.GetResultForRequest(request));
        }
Exemplo n.º 3
0
        public Task <BuildResult> BuildTargets(ProjectLoggingContext loggingContext, BuildRequestEntry entry, IRequestBuilderCallback callback, string[] targets, Lookup baseLookup, CancellationToken cancellationToken)
        {
            _requestBuilderCallback = callback;

            if (cancellationToken.WaitHandle.WaitOne(1500))
            {
                BuildResult result = new BuildResult(entry.Request);
                foreach (string target in targets)
                {
                    result.AddResultsForTarget(target, BuildResultUtilities.GetEmptyFailingTargetResult());
                }
                return(Task <BuildResult> .FromResult(result));
            }

            if (_newRequests != null)
            {
                string[] projectFiles = new string[_newRequests.Length];
                PropertyDictionary <ProjectPropertyInstance>[] properties = new PropertyDictionary <ProjectPropertyInstance> [_newRequests.Length];
                string[] toolsVersions = new string[_newRequests.Length];

                for (int i = 0; i < projectFiles.Length; ++i)
                {
                    projectFiles[i]  = _newRequests[i].Config.ProjectFullPath;
                    properties[i]    = new PropertyDictionary <ProjectPropertyInstance>(_newRequests[i].Config.GlobalProperties);
                    toolsVersions[i] = _newRequests[i].Config.ToolsVersion;
                }

                _requestBuilderCallback.BuildProjects(projectFiles, properties, toolsVersions, _newRequests[0].Targets, _newRequests[0].ResultsNeeded);

                if (cancellationToken.WaitHandle.WaitOne(1500))
                {
                    BuildResult result = new BuildResult(entry.Request);
                    foreach (string target in targets)
                    {
                        result.AddResultsForTarget(target, BuildResultUtilities.GetEmptyFailingTargetResult());
                    }
                    return(Task <BuildResult> .FromResult(result));
                }
            }

            return(Task <BuildResult> .FromResult(_cache.GetResultForRequest(entry.Request)));
        }
Exemplo n.º 4
0
 /// <summary>
 /// Call the actual implementation
 /// </summary>
 /// <param name="request">The request for which results should be retrieved.</param>
 /// <returns>The build results for the specified request.</returns>
 public BuildResult GetResultForRequest(BuildRequest request)
 {
     _getCount++;
     return(_resultCache.GetResultForRequest(request));
 }