Ejemplo n.º 1
0
 private static void LogDriveEnumerationWarningWithEvaluationLoggingContext(EvaluationLoggingContext evaluationLoggingContext, IElementLocation importLocation, bool excludeFileSpecIsEmpty, string filespecUnescaped, string fileSpec)
 {
     if (importLocation != null)
     {
         evaluationLoggingContext.LogWarning(
             DriveEnumeratingWildcardMessageResourceName,
             filespecUnescaped,
             XMakeAttributes.project,
             XMakeElements.import);
     }
     else if (excludeFileSpecIsEmpty)
     {
         evaluationLoggingContext.LogWarning(
             DriveEnumeratingWildcardMessageResourceName,
             fileSpec,
             XMakeAttributes.include,
             XMakeElements.itemGroup);
     }
     else
     {
         evaluationLoggingContext.LogWarning(
             DriveEnumeratingWildcardMessageResourceName,
             fileSpec,
             XMakeAttributes.exclude,
             XMakeElements.itemGroup);
     }
 }
        /// <summary>
        /// Creates an instance of the PropertyTrackingEvaluatorDataWrapper class.
        /// </summary>
        /// <param name="dataToWrap">The underlying <see cref="IEvaluatorData{P,I,M,D}"/> to wrap for property tracking.</param>
        /// <param name="evaluationLoggingContext">The <see cref="EvaluationLoggingContext"/> used to log relevant events.</param>
        /// <param name="settingValue">Property tracking setting value</param>
        public PropertyTrackingEvaluatorDataWrapper(IEvaluatorData <P, I, M, D> dataToWrap, EvaluationLoggingContext evaluationLoggingContext, int settingValue)
        {
            ErrorUtilities.VerifyThrowInternalNull(dataToWrap, nameof(dataToWrap));
            ErrorUtilities.VerifyThrowInternalNull(evaluationLoggingContext, nameof(evaluationLoggingContext));

            _wrapped = dataToWrap;
            _evaluationLoggingContext = evaluationLoggingContext;
            _settings = (PropertyTrackingSetting)settingValue;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Processes all requests that are currently in the queue.
        /// </summary>
        private void ProcessRequests()
        {
            // Store a list of threads which are resolving SDKs
            List <Task> tasks = new List <Task>(_requests.Count);

            SdkResolverRequest item;

            while (_requests.TryDequeue(out item))
            {
                SdkResolverRequest request = item;

                // Start a thread to resolve an SDK and add it to the list of threads
                tasks.Add(Task.Run(() =>
                {
                    SdkResult response = null;
                    try
                    {
                        // Create an SdkReference from the request
                        SdkReference sdkReference = new SdkReference(request.Name, request.Version, request.MinimumVersion);

                        ILoggingService loggingService = Host.GetComponent(BuildComponentType.LoggingService) as ILoggingService;

                        // This call is usually cached so is very fast but can take longer for a new SDK that is downloaded.  Other queued threads for different SDKs will complete sooner and continue on which unblocks evaluations
                        response = ResolveSdk
                                   (
                            request.SubmissionId,
                            sdkReference,
                            new EvaluationLoggingContext(loggingService, request.BuildEventContext, request.ProjectPath),
                            request.ElementLocation,
                            new SdkEnv(request.SolutionPath, request.ProjectPath),
                            request.Interactive
                                   );
                    }
                    catch (Exception e)
                    {
                        ILoggingService loggingService = Host.GetComponent(BuildComponentType.LoggingService) as ILoggingService;

                        EvaluationLoggingContext loggingContext = new EvaluationLoggingContext(loggingService, request.BuildEventContext, request.ProjectPath);

                        loggingService.LogFatalBuildError(loggingContext.BuildEventContext, e, new BuildEventFileInfo(request.ElementLocation));
                    }
                    finally
                    {
                        // Get the node manager and send the response back to the node that requested the SDK
                        INodeManager nodeManager = Host.GetComponent(BuildComponentType.NodeManager) as INodeManager;

                        nodeManager.SendData(request.NodeId, response);
                    }
                }));
            }

            // Wait for all tasks to complete
            Task.WaitAll(tasks.ToArray());
        }
        public override void PacketReceived(int node, INodePacket packet)
        {
            if (packet is not SdkResolverRequest request)
            {
                return;
            }

            // Associate the node with the request
            request.NodeId = node;

            SdkResult response = null;

            try
            {
                // Create an SdkReference from the request
                SdkReference sdkReference = new SdkReference(request.Name, request.Version, request.MinimumVersion);

                ILoggingService loggingService = Host.GetComponent(BuildComponentType.LoggingService) as ILoggingService;

                // This call is usually cached so is very fast but can take longer for a new SDK that is downloaded.  Other queued threads for different SDKs will complete sooner and continue on which unblocks evaluations
                response = ResolveSdk(request.SubmissionId, sdkReference, new EvaluationLoggingContext(loggingService, request.BuildEventContext, request.ProjectPath), request.ElementLocation, request.SolutionPath, request.ProjectPath, request.Interactive, request.IsRunningInVisualStudio);
            }
            catch (Exception e)
            {
                ILoggingService loggingService = Host.GetComponent(BuildComponentType.LoggingService) as ILoggingService;

                EvaluationLoggingContext loggingContext = new EvaluationLoggingContext(loggingService, request.BuildEventContext, request.ProjectPath);

                loggingService.LogFatalBuildError(loggingContext.BuildEventContext, e, new BuildEventFileInfo(request.ElementLocation));
            }
            finally
            {
                // Get the node manager and send the response back to the node that requested the SDK
                INodeManager nodeManager = Host.GetComponent(BuildComponentType.NodeManager) as INodeManager;

                nodeManager.SendData(request.NodeId, response);
            }
        }