/Microsoft.Build/Microsoft.Build/Microsoft/Build/BackEnd/BuildRequest.cs
C# | 213 lines | 192 code | 21 blank | 0 comment | 8 complexity | 4d705f06ea46598ecef08bc63e974807 MD5 | raw file
Possible License(s): Apache-2.0, LGPL-3.0
- namespace Microsoft.Build.BackEnd
- {
- using Microsoft.Build.Execution;
- using Microsoft.Build.Framework;
- using Microsoft.Build.Shared;
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Runtime;
-
- internal class BuildRequest : INodePacket, INodePacketTranslatable
- {
- private Microsoft.Build.Framework.BuildEventContext buildEventContext;
- private int configurationId;
- private int globalRequestId;
- private Microsoft.Build.Execution.HostServices hostServices;
- public const int InvalidGlobalRequestId = -1;
- private int nodeRequestId;
- private Microsoft.Build.Framework.BuildEventContext parentBuildEventContext;
- private int parentGlobalRequestId;
- private int submissionId;
- private List<string> targets;
-
- [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
- public BuildRequest()
- {
- }
-
- private BuildRequest(INodePacketTranslator translator)
- {
- this.Translate(translator);
- }
-
- public BuildRequest(int submissionId, int nodeRequestId, int configurationId, ICollection<string> escapedTargets, Microsoft.Build.Execution.HostServices hostServices, Microsoft.Build.Framework.BuildEventContext parentBuildEventContext, BuildRequest parentRequest)
- {
- ErrorUtilities.VerifyThrowArgumentNull(escapedTargets, "targets");
- ErrorUtilities.VerifyThrowArgumentNull(parentBuildEventContext, "parentBuildEventContext");
- this.submissionId = submissionId;
- this.configurationId = configurationId;
- this.targets = new List<string>(escapedTargets.Count);
- foreach (string str in escapedTargets)
- {
- this.targets.Add(EscapingUtilities.UnescapeAll(str));
- }
- this.hostServices = hostServices;
- this.buildEventContext = Microsoft.Build.Framework.BuildEventContext.Invalid;
- this.parentBuildEventContext = parentBuildEventContext;
- this.globalRequestId = -1;
- if (parentRequest != null)
- {
- this.parentGlobalRequestId = parentRequest.GlobalRequestId;
- }
- else
- {
- this.parentGlobalRequestId = -1;
- }
- this.nodeRequestId = nodeRequestId;
- }
-
- internal bool DoesResultApplyToRequest(BuildResult result)
- {
- return ((this.globalRequestId == result.GlobalRequestId) && (this.nodeRequestId == result.NodeRequestId));
- }
-
- internal static INodePacket FactoryForDeserialization(INodePacketTranslator translator)
- {
- return new BuildRequest(translator);
- }
-
- public void ResolveConfiguration(int newConfigId)
- {
- ErrorUtilities.VerifyThrow(!this.IsConfigurationResolved, "Configuration already resolved");
- this.configurationId = newConfigId;
- ErrorUtilities.VerifyThrow(this.IsConfigurationResolved, "Configuration not resolved");
- }
-
- public void Translate(INodePacketTranslator translator)
- {
- translator.Translate(ref this.submissionId);
- translator.Translate(ref this.configurationId);
- translator.Translate(ref this.globalRequestId);
- translator.Translate(ref this.parentGlobalRequestId);
- translator.Translate(ref this.nodeRequestId);
- translator.Translate(ref this.targets);
- translator.Translate(ref this.parentBuildEventContext);
- translator.Translate(ref this.buildEventContext);
- }
-
- public Microsoft.Build.Framework.BuildEventContext BuildEventContext
- {
- [DebuggerStepThrough, TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
- get
- {
- return this.buildEventContext;
- }
- set
- {
- ErrorUtilities.VerifyThrow(this.buildEventContext == Microsoft.Build.Framework.BuildEventContext.Invalid, "The build event context is already set.");
- this.buildEventContext = value;
- }
- }
-
- public int ConfigurationId
- {
- [DebuggerStepThrough, TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
- get
- {
- return this.configurationId;
- }
- }
-
- public int GlobalRequestId
- {
- [DebuggerStepThrough, TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
- get
- {
- return this.globalRequestId;
- }
- set
- {
- ErrorUtilities.VerifyThrow(this.globalRequestId == -1, "Global Request ID cannot be set twice.");
- this.globalRequestId = value;
- }
- }
-
- internal Microsoft.Build.Execution.HostServices HostServices
- {
- [DebuggerStepThrough, TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
- get
- {
- return this.hostServices;
- }
- }
-
- public bool IsConfigurationResolved
- {
- [DebuggerStepThrough]
- get
- {
- return (this.configurationId > 0);
- }
- }
-
- internal bool IsRootRequest
- {
- [DebuggerStepThrough]
- get
- {
- return (this.parentGlobalRequestId == -1);
- }
- }
-
- public int NodeRequestId
- {
- [DebuggerStepThrough, TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
- get
- {
- return this.nodeRequestId;
- }
- [DebuggerStepThrough, TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
- set
- {
- this.nodeRequestId = value;
- }
- }
-
- public Microsoft.Build.Framework.BuildEventContext ParentBuildEventContext
- {
- [DebuggerStepThrough, TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
- get
- {
- return this.parentBuildEventContext;
- }
- }
-
- public int ParentGlobalRequestId
- {
- [DebuggerStepThrough, TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
- get
- {
- return this.parentGlobalRequestId;
- }
- }
-
- public int SubmissionId
- {
- [DebuggerStepThrough, TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
- get
- {
- return this.submissionId;
- }
- }
-
- public List<string> Targets
- {
- [DebuggerStepThrough, TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
- get
- {
- return this.targets;
- }
- }
-
- public NodePacketType Type
- {
- [DebuggerStepThrough]
- get
- {
- return NodePacketType.BuildRequest;
- }
- }
- }
- }
-