Skip to content
Merged
Changes from 1 commit
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
22 changes: 18 additions & 4 deletions src/Build/Definition/Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2624,14 +2624,28 @@ private GlobResult BuildGlobResultFromIncludeItem(ProjectItemElement itemElement
{
var includeItemspec = new EvaluationItemSpec(itemElement.Include, _data.Expander, itemElement.IncludeLocation, itemElement.ContainingProject.DirectoryPath);

ItemSpecFragment[] includeGlobFragments = includeItemspec.Fragments.Where(f => f is GlobFragment && f.TextFragment.AsSpan().IndexOfAny(s_invalidGlobChars) < 0).ToArray();
if (includeGlobFragments.Length == 0)
List<ItemSpecFragment> includeGobFragmentsList = null;
foreach (ItemSpecFragment fragment in includeItemspec.Fragments)
{
if (fragment is GlobFragment && fragment.TextFragment.AsSpan().IndexOfAny(s_invalidGlobChars) < 0)
{
includeGobFragmentsList ??= new List<ItemSpecFragment>(includeItemspec.Fragments.Count);
includeGobFragmentsList.Add(fragment);
}
}

if (includeGobFragmentsList == null || includeGobFragmentsList.Count == 0)
{
return null;
}

ImmutableArray<string> includeGlobStrings = includeGlobFragments.Select(f => f.TextFragment).ToImmutableArray();
var includeGlob = CompositeGlob.Create(includeGlobFragments.Select(f => f.ToMSBuildGlob()));
string[] includeGlobStrings = new string[includeGobFragmentsList.Count];
for (int i = 0; i < includeGlobStrings.Length; ++i)
{
includeGlobStrings[i] = includeGobFragmentsList[i].TextFragment;
Comment thread
Erarndt marked this conversation as resolved.
Outdated
Comment thread
Erarndt marked this conversation as resolved.
Outdated
Comment thread
Erarndt marked this conversation as resolved.
Outdated
}

var includeGlob = CompositeGlob.Create(includeGobFragmentsList.Select(f => f.ToMSBuildGlob()));
Comment thread
Erarndt marked this conversation as resolved.
Outdated
Comment thread
Erarndt marked this conversation as resolved.
Outdated
Comment thread
Erarndt marked this conversation as resolved.
Outdated
Comment thread
Erarndt marked this conversation as resolved.
Outdated

IEnumerable<string> excludeFragmentStrings = [];
IMSBuildGlob excludeGlob = null;
Expand Down