Skip to content
12 changes: 6 additions & 6 deletions src/Build/BackEnd/Components/RequestBuilder/BatchingEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
using System.Collections.Generic;

using Microsoft.Build.Collections;
using ElementLocation = Microsoft.Build.Construction.ElementLocation;
using Microsoft.Build.Evaluation;
using Microsoft.Build.Execution;
using Microsoft.Build.Shared;
using Microsoft.Build.Construction;

namespace Microsoft.Build.BackEnd
{
Expand Down Expand Up @@ -80,7 +80,7 @@ internal static List<ItemBucket> PrepareBatchingBuckets
(
List<string> batchableObjectParameters,
Lookup lookup,
ElementLocation elementLocation
IInternalLocation elementLocation
)
{
return PrepareBatchingBuckets(batchableObjectParameters, lookup, null, elementLocation);
Expand All @@ -101,7 +101,7 @@ internal static List<ItemBucket> PrepareBatchingBuckets
List<string> batchableObjectParameters,
Lookup lookup,
string implicitBatchableItemType,
ElementLocation elementLocation
IInternalLocation elementLocation
)
{
if (batchableObjectParameters == null)
Expand Down Expand Up @@ -204,7 +204,7 @@ private static Dictionary<string, ICollection<ProjectItemInstance>> GetItemLists
// Value is [struct MetadataReference]
HashSet<string> consumedItemReferenceNames,
Lookup lookup,
ElementLocation elementLocation
IInternalLocation elementLocation
)
{
// The keys in this hashtable are the names of the items that we will batch on.
Expand Down Expand Up @@ -299,7 +299,7 @@ private static List<ItemBucket> BucketConsumedItems
Lookup lookup,
Dictionary<string, ICollection<ProjectItemInstance>> itemListsToBeBatched,
Dictionary<string, MetadataReference> consumedMetadataReferences,
ElementLocation elementLocation
IInternalLocation elementLocation
)
{
ErrorUtilities.VerifyThrow(itemListsToBeBatched.Count > 0, "Need item types consumed by the batchable object.");
Expand Down Expand Up @@ -382,7 +382,7 @@ private static Dictionary<string, string> GetItemMetadataValues
(
ProjectItemInstance item,
Dictionary<string, MetadataReference> consumedMetadataReferences,
ElementLocation elementLocation
IInternalLocation elementLocation
)
{
var itemMetadataValues = new Dictionary<string, string>(consumedMetadataReferences.Count, MSBuildNameIgnoreCaseComparer.Default);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System.Collections.Immutable;
using System.Linq;
using Microsoft.Build.Collections;
using ElementLocation = Microsoft.Build.Construction.ElementLocation;
using Microsoft.Build.Execution;
using Microsoft.Build.Framework;
using Microsoft.Build.Shared;
Expand All @@ -15,6 +14,7 @@
using ProjectItemInstanceFactory = Microsoft.Build.Execution.ProjectItemInstance.TaskItem.ProjectItemInstanceFactory;
using EngineFileUtilities = Microsoft.Build.Internal.EngineFileUtilities;
using TargetLoggingContext = Microsoft.Build.BackEnd.Logging.TargetLoggingContext;
using Microsoft.Build.Construction;

namespace Microsoft.Build.BackEnd
{
Expand Down Expand Up @@ -47,6 +47,7 @@ public ItemGroupIntrinsicTask(ProjectItemGroupTaskInstance taskInstance, TargetL
/// <param name="lookup">The lookup used for evaluation and as a destination for these items.</param>
internal override void ExecuteTask(Lookup lookup)
{
var location = _taskInstance.Location;
foreach (ProjectItemGroupTaskItemInstance child in _taskInstance.Items)
{
List<ItemBucket> buckets = null;
Expand All @@ -55,7 +56,7 @@ internal override void ExecuteTask(Lookup lookup)
{
List<string> parameterValues = new List<string>();
GetBatchableValuesFromBuildItemGroupChild(parameterValues, child);
buckets = BatchingEngine.PrepareBatchingBuckets(parameterValues, lookup, child.ItemType, _taskInstance.Location);
buckets = BatchingEngine.PrepareBatchingBuckets(parameterValues, lookup, child.ItemType, location);

// "Execute" each bucket
foreach (ItemBucket bucket in buckets)
Expand Down Expand Up @@ -174,14 +175,14 @@ private void ExecuteAdd(ProjectItemGroupTaskItemInstance child, ItemBucket bucke
bucket.Expander,
ExpanderOptions.ExpandAll,
Project.Directory,
metadataInstance.Location,
metadataInstance,
LoggingContext.LoggingService,
LoggingContext.BuildEventContext,
FileSystems.Default);

if (condition)
{
string evaluatedValue = bucket.Expander.ExpandIntoStringLeaveEscaped(metadataInstance.Value, ExpanderOptions.ExpandAll, metadataInstance.Location);
string evaluatedValue = bucket.Expander.ExpandIntoStringLeaveEscaped(metadataInstance.Value, ExpanderOptions.ExpandAll, metadataInstance);

// This both stores the metadata so we can add it to all the items we just created later, and
// exposes this metadata to further metadata evaluations in subsequent loop iterations.
Expand Down Expand Up @@ -319,7 +320,7 @@ private void ExecuteModify(ProjectItemGroupTaskItemInstance child, ItemBucket bu

if (condition)
{
string evaluatedValue = bucket.Expander.ExpandIntoStringLeaveEscaped(metadataInstance.Value, ExpanderOptions.ExpandAll, metadataInstance.Location);
string evaluatedValue = bucket.Expander.ExpandIntoStringLeaveEscaped(metadataInstance.Value, ExpanderOptions.ExpandAll, metadataInstance);
metadataToSet[metadataInstance.Name] = Lookup.MetadataModification.CreateFromNewValue(evaluatedValue);
}
}
Expand Down Expand Up @@ -512,7 +513,7 @@ private List<ProjectItemInstance> FindItemsMatchingSpecification
(
ICollection<ProjectItemInstance> items,
string specification,
ElementLocation specificationLocation,
IInternalLocation specificationLocation,
Expander<ProjectPropertyInstance, ProjectItemInstance> expander
)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ internal override void ExecuteTask(Lookup lookup)
// Find all the metadata references in order to create buckets
List<string> parameterValues = new List<string>();
GetBatchableValuesFromProperty(parameterValues, property);
buckets = BatchingEngine.PrepareBatchingBuckets(parameterValues, lookup, property.Location);
buckets = BatchingEngine.PrepareBatchingBuckets(parameterValues, lookup, property);
var propertyLocation = property.ConditionLocation;

// "Execute" each bucket
foreach (ItemBucket bucket in buckets)
Expand All @@ -62,7 +63,7 @@ internal override void ExecuteTask(Lookup lookup)
bucket.Expander,
ExpanderOptions.ExpandAll,
Project.Directory,
property.ConditionLocation,
propertyLocation,
LoggingContext.LoggingService,
LoggingContext.BuildEventContext,
FileSystems.Default);
Expand All @@ -74,12 +75,12 @@ internal override void ExecuteTask(Lookup lookup)
ProjectErrorUtilities.VerifyThrowInvalidProject
(
!ReservedPropertyNames.IsReservedProperty(property.Name),
property.Location,
property,
"CannotModifyReservedProperty",
property.Name
);

string evaluatedValue = bucket.Expander.ExpandIntoStringLeaveEscaped(property.Value, ExpanderOptions.ExpandAll, property.Location);
string evaluatedValue = bucket.Expander.ExpandIntoStringLeaveEscaped(property.Value, ExpanderOptions.ExpandAll, property);

if (LogTaskInputs && !LoggingContext.LoggingService.OnlyLogCriticalEvents)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Build/BackEnd/Components/RequestBuilder/TargetEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ internal async Task ExecuteTarget(ITaskBuilder taskBuilder, BuildRequestEntry re

// Generate the batching buckets. Note that each bucket will get a lookup based on the baseLookup. This lookup will be in its
// own scope, which we will collapse back down into the baseLookup at the bottom of the function.
List<ItemBucket> buckets = BatchingEngine.PrepareBatchingBuckets(GetBatchableParametersForTarget(), _baseLookup, _target.Location);
List<ItemBucket> buckets = BatchingEngine.PrepareBatchingBuckets(GetBatchableParametersForTarget(), _baseLookup, _target);

WorkUnitResult aggregateResult = new WorkUnitResult();
TargetLoggingContext targetLoggingContext = null;
Expand Down Expand Up @@ -617,7 +617,7 @@ internal async Task ExecuteTarget(ITaskBuilder taskBuilder, BuildRequestEntry re
// Also, we are using the baseLookup, which has possibly had changes made to it since the project started. Because of this, the
// set of outputs calculated here may differ from those which would have been calculated at the beginning of the target. It is
// assumed the user intended this.
List<ItemBucket> batchingBuckets = BatchingEngine.PrepareBatchingBuckets(GetBatchableParametersForTarget(), _baseLookup, _target.Location);
List<ItemBucket> batchingBuckets = BatchingEngine.PrepareBatchingBuckets(GetBatchableParametersForTarget(), _baseLookup, _target);

if (keepDupes)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
using System.Linq;

using Microsoft.Build.Collections;
using Microsoft.Build.Construction;
using Microsoft.Build.Evaluation;
using Microsoft.Build.Execution;
using Microsoft.Build.Framework;
using Microsoft.Build.Shared;

using ElementLocation = Microsoft.Build.Construction.ElementLocation;
using ProjectItemInstanceFactory = Microsoft.Build.Execution.ProjectItemInstance.TaskItem.ProjectItemInstanceFactory;

namespace Microsoft.Build.BackEnd
Expand Down Expand Up @@ -391,8 +391,10 @@ out List<string> targetOutputItemSpecs
{
// break down the input/output specifications along the standard separator, after expanding all embedded properties
// and item metadata
var targetInputs = bucket.Expander.ExpandIntoStringListLeaveEscaped(TargetInputSpecification, ExpanderOptions.ExpandPropertiesAndMetadata, _targetToAnalyze.InputsLocation);
var targetOutputs = bucket.Expander.ExpandIntoStringListLeaveEscaped(TargetOutputSpecification, ExpanderOptions.ExpandPropertiesAndMetadata, _targetToAnalyze.OutputsLocation);
var inputLocation = _targetToAnalyze.InputsLocation;
var outputLocation = _targetToAnalyze.OutputsLocation;
var targetInputs = bucket.Expander.ExpandIntoStringListLeaveEscaped(TargetInputSpecification, ExpanderOptions.ExpandPropertiesAndMetadata, inputLocation);
var targetOutputs = bucket.Expander.ExpandIntoStringListLeaveEscaped(TargetOutputSpecification, ExpanderOptions.ExpandPropertiesAndMetadata, outputLocation);

itemVectorTransformsInTargetInputs = new ItemVectorPartitionCollection(MSBuildNameIgnoreCaseComparer.Default);

Expand All @@ -406,7 +408,7 @@ out List<string> targetOutputItemSpecs
out itemVectorsInTargetInputs,
itemVectorTransformsInTargetInputs,
out discreteItemsInTargetInputs,
_targetToAnalyze.InputsLocation);
inputLocation);

// figure out which of the outputs are:
// 1) item vectors (with or without transforms)
Expand All @@ -417,7 +419,7 @@ out List<string> targetOutputItemSpecs
out itemVectorsInTargetOutputs,
null /* don't want transforms separated */,
out discreteItemsInTargetOutputs,
_targetToAnalyze.OutputsLocation);
outputLocation);

// list out all the output item-specs
targetOutputItemSpecs = GetItemSpecsFromItemVectors(itemVectorsInTargetOutputs);
Expand Down Expand Up @@ -785,7 +787,7 @@ private void SeparateItemVectorsFromDiscreteItems
out ItemVectorPartitionCollection itemVectors,
ItemVectorPartitionCollection itemVectorTransforms,
out Dictionary<string, string> discreteItems,
ElementLocation elementLocation
IInternalLocation elementLocation
)
{
itemVectors = new ItemVectorPartitionCollection(MSBuildNameIgnoreCaseComparer.Default);
Expand Down
Loading