Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/Build.UnitTests/Evaluation/Evaluator_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,41 @@ public void VerifyLoadingImportScenarios(string importParameter, bool shouldSucc
}
}

[Theory]
[InlineData("(test")]
[InlineData("@@@test")]
[InlineData(@")(!!test")]
public void VerifyItemsUpdateIsHandledForAnyProjectPath(string projectPathCandidate)
{
using (TestEnvironment env = TestEnvironment.Create())
{
TransientTestFolder projDirectory = env.CreateFolder(Path.Combine(env.CreateNewTempPath().TempPath, projectPathCandidate), createFolder: true);
TransientTestFile projectFile = env.CreateFile(projDirectory, "project.proj", @"
<Project>
Comment thread
YuliiaKovalova marked this conversation as resolved.

<ItemGroup>
<ItemCheck Include=""Test"" />
</ItemGroup>

<ItemGroup>
<ItemCheck Update=""Test""
NewTestLabels=""Dummy"" />
</ItemGroup>

<Target Name=""MyTarget"">
<Message Text=""ItemCheck updated metadata value: @(ItemCheck->Metadata('NewTestLabels'))"" />
</Target>
</Project>
");
Project project = new(projectFile.Path);
MockLogger logger = new();
var result = project.Build(logger);

result.ShouldBeTrue();
project.AllEvaluatedItems.Where(ei => ei.ItemType == "ItemCheck" && ei.Metadata.Any(m => m.EvaluatedValue == "Dummy")).ShouldNotBeEmpty();
}
}

// Some of these are also tested elsewhere, but this consolidates related tests in one spot.
public static IEnumerable<object[]> ImportLoadingScenarioTestData
{
Expand Down
2 changes: 1 addition & 1 deletion src/Build/Evaluation/LazyItemEvaluator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ private static OrderedItemDataCollection.Builder ComputeItems(LazyItemList lazyI
break;
}

string fullPath = FileUtilities.GetFullPath(frag.TextFragment, frag.ProjectDirectory);
string fullPath = FileUtilities.NormalizePathForComparisonNoThrow(frag.TextFragment, frag.ProjectDirectory);
Comment thread
YuliiaKovalova marked this conversation as resolved.
if (itemsWithNoWildcards.ContainsKey(fullPath))
{
// Another update will already happen on this path. Make that happen before evaluating this one.
Expand Down