<commit_before>// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Microsoft.Build.Shared;
using Microsoft.Build.Framework;
using Microsoft.Build.Execution;
using Microsoft.Build.Experimental.ProjectCache;

namespace Microsoft.Build.BackEnd
{
    /// <summary>
    /// A build request contains information about the configuration used to build as well
    /// as which targets need to be built.
    /// </summary>
    internal class BuildRequest : INodePacket
    {
        /// <summary>
        /// The invalid global request id
        /// </summary>
        public const int InvalidGlobalRequestId = -1;

        /// <summary>
        /// The invalid node request id
        /// </summary>
        public const int InvalidNodeRequestId = 0;

        /// <summary>
        /// The results transfer request id
        /// </summary>
        public const int ResultsTransferNodeRequestId = -1;

        /// <summary>
        /// The submission with which this request is associated.
        /// </summary>
        private int _submissionId;

        /// <summary>
        /// The configuration id.
        /// </summary>
        private int _configurationId;

        /// <summary>
        /// The global build request id, assigned by the Build Manager
        /// </summary>
        private int _globalRequestId;

        /// <summary>
        /// The global request id of the request which spawned this one.
        /// </summary>
        private int _parentGlobalRequestId;

        /// <summary>
        /// The build request id assigned by the node originating this request.
        /// </summary>
        private int _nodeRequestId;

        /// <inheritdoc cref="BuildRequest.Targets"/>
        private List<string> _targets;

        /// <inheritdoc cref="BuildRequest.ProxyTargets"/>
        private ProxyTargets _proxyTargets;

        /// <summary>
        /// The build event context of the parent
        /// </summary>
        private BuildEventContext _parentBuildEventContext;

        /// <summary>
        /// The build event context of this request
        /// </summary>
        private BuildEventContext _buildEventContext;

        /// <summary>
        /// Whether or not the <see cref="BuildResult"/> issued in response to this request should include <see cref="BuildResult.ProjectStateAfterBuild"/>.
        /// </summary>
        private BuildRequestDataFlags _buildRequestDataFlags;

        /// <summary>
        /// Filter describing properties, items, and metadata of interest for this request.
        /// </summary>
        private RequestedProjectState _requestedProjectState;

        private bool _skipStaticGraphIsolationConstraints;

        /// <summary>
        /// Constructor for serialization.
        /// </summary>
        public BuildRequest()
        {

        }

        private BuildRequest(
            int submissionId,
            int nodeRequestId,
            int configurationId,
            HostServices hostServices,
            BuildRequestDataFlags buildRequestDataFlags = BuildRequestDataFlags.None,
            RequestedProjectState requestedProjectState = null)
        {
            _submissionId = submissionId;
            _configurationId = configurationId;

            HostServices = hostServices;
            _buildEventContext = BuildEventContext.Invalid;
            _globalRequestId = InvalidGlobalRequestId;

            _nodeRequestId = nodeRequestId;
            _buildRequestDataFlags = buildRequestDataFlags;
            _requestedProjectState = requestedProjectState;
        }

        /// <summary>
        /// Initializes a build request with a parent context.
        /// </summary>
        /// <param name="submissionId">The id of the build submission.</param>
        /// <param name="nodeRequestId">The id of the node issuing the request</param>
        /// <param name="configurationId">The configuration id to use.</param>
        /// <param name="proxyTargets"><see cref="ProxyTargets"/></param>
        /// <param name="hostServices">Host services if any. May be null.</param>
        /// <param name="buildRequestDataFlags">Additional flags for the request.</param>
        /// <param name="requestedProjectState">Filter for desired build results.</param>
        public BuildRequest(
            int submissionId,
            int nodeRequestId,
            int configurationId,
            ProxyTargets proxyTargets,
            HostServices hostServices,
            BuildRequestDataFlags buildRequestDataFlags = BuildRequestDataFlags.None,
            RequestedProjectState requestedProjectState = null)
            : this(submissionId, nodeRequestId, configurationId, hostServices, buildRequestDataFlags,
                requestedProjectState)
        {
            _proxyTargets = proxyTargets;
            _targets = proxyTargets.ProxyTargetToRealTargetMap.Keys.ToList();

            // Only root requests can have proxy targets.
            _parentGlobalRequestId = InvalidGlobalRequestId;
            _parentBuildEventContext = BuildEventContext.Invalid;
        }

        /// <summary><commit_msg>Fix typo<commit_after>// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Microsoft.Build.Shared;
using Microsoft.Build.Framework;
using Microsoft.Build.Execution;
using Microsoft.Build.Experimental.ProjectCache;

namespace Microsoft.Build.BackEnd
{
    /// <summary>
    /// A build request contains information about the configuration used to build as well
    /// as which targets need to be built.
    /// </summary>
    internal class BuildRequest : INodePacket
    {
        /// <summary>
        /// The invalid global request id
        /// </summary>
        public const int InvalidGlobalRequestId = -1;

        /// <summary>
        /// The invalid node request id
        /// </summary>
        public const int InvalidNodeRequestId = 0;

        /// <summary>
        /// The results transfer request id
        /// </summary>
        public const int ResultsTransferNodeRequestId = -1;

        /// <summary>
        /// The submission with which this request is associated.
        /// </summary>
        private int _submissionId;

        /// <summary>
        /// The configuration id.
        /// </summary>
        private int _configurationId;

        /// <summary>
        /// The global build request id, assigned by the Build Manager
        /// </summary>
        private int _globalRequestId;

        /// <summary>
        /// The global request id of the request which spawned this one.
        /// </summary>
        private int _parentGlobalRequestId;

        /// <summary>
        /// The build request id assigned by the node originating this request.
        /// </summary>
        private int _nodeRequestId;

        /// <inheritdoc cref="BuildRequest.Targets"/>
        private List<string> _targets;

        /// <inheritdoc cref="BuildRequest.ProxyTargets"/>
        private ProxyTargets _proxyTargets;

        /// <summary>
        /// The build event context of the parent
        /// </summary>
        private BuildEventContext _parentBuildEventContext;

        /// <summary>
        /// The build event context of this request
        /// </summary>
        private BuildEventContext _buildEventContext;

        /// <summary>
        /// Whether or not the <see cref="BuildResult"/> issued in response to this request should include <see cref="BuildResult.ProjectStateAfterBuild"/>.
        /// </summary>
        private BuildRequestDataFlags _buildRequestDataFlags;

        /// <summary>
        /// Filter describing properties, items, and metadata of interest for this request.
        /// </summary>
        private RequestedProjectState _requestedProjectState;

        private bool _skipStaticGraphIsolationConstraints;

        /// <summary>
        /// Constructor for serialization.
        /// </summary>
        public BuildRequest()
        {

        }

        private BuildRequest(
            int submissionId,
            int nodeRequestId,
            int configurationId,
            HostServices hostServices,
            BuildRequestDataFlags buildRequestDataFlags = BuildRequestDataFlags.None,
            RequestedProjectState requestedProjectState = null)
        {
            _submissionId = submissionId;
            _configurationId = configurationId;

            HostServices = hostServices;
            _buildEventContext = BuildEventContext.Invalid;
            _globalRequestId = InvalidGlobalRequestId;

            _nodeRequestId = nodeRequestId;
            _buildRequestDataFlags = buildRequestDataFlags;
            _requestedProjectState = requestedProjectState;
        }

        /// <summary>
        /// Initializes a build request with proxy targets.
        /// </summary>
        /// <param name="submissionId">The id of the build submission.</param>
        /// <param name="nodeRequestId">The id of the node issuing the request</param>
        /// <param name="configurationId">The configuration id to use.</param>
        /// <param name="proxyTargets"><see cref="ProxyTargets"/></param>
        /// <param name="hostServices">Host services if any. May be null.</param>
        /// <param name="buildRequestDataFlags">Additional flags for the request.</param>
        /// <param name="requestedProjectState">Filter for desired build results.</param>
        public BuildRequest(
            int submissionId,
            int nodeRequestId,
            int configurationId,
            ProxyTargets proxyTargets,
            HostServices hostServices,
            BuildRequestDataFlags buildRequestDataFlags = BuildRequestDataFlags.None,
            RequestedProjectState requestedProjectState = null)
            : this(submissionId, nodeRequestId, configurationId, hostServices, buildRequestDataFlags,
                requestedProjectState)
        {
            _proxyTargets = proxyTargets;
            _targets = proxyTargets.ProxyTargetToRealTargetMap.Keys.ToList();

            // Only root requests can have proxy targets.
            _parentGlobalRequestId = InvalidGlobalRequestId;
            _parentBuildEventContext = BuildEventContext.Invalid;
        }

        /// <summary>
{'fraction_non_alphanumeric': 0.09149460125023678, 'fraction_numerical': 0.0005682894487592347, 'mean_word_length': 2.09194729136164, 'pattern_counts': {'":': 0, '<': 105, '<?xml version=': 0, '>': 105, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3856862', 'n_tokens_mistral': 2457, 'n_tokens_neox': 2400, 'n_words': 753}