Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScrapeHeaders: Trim filenames when splitting for ; #1992

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
12 changes: 6 additions & 6 deletions sources/GeneratorSdk/MetadataTasks/ScrapeHeaders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public override bool Execute()

if (!string.IsNullOrEmpty(this.ExcludeFromCrossarch))
{
foreach (var part in this.ExcludeFromCrossarch.Split(';', System.StringSplitOptions.RemoveEmptyEntries))
foreach (var part in this.ExcludeFromCrossarch.Split(';', System.StringSplitOptions.RemoveEmptyEntries | System.StringSplitOptions.TrimEntries))
{
this.partitionsToExcludeFromCrossarch.Add(part);
}
Expand Down Expand Up @@ -201,7 +201,7 @@ private Partition[] GetPartitions()
if (!string.IsNullOrEmpty(this.PartitionFilter))
{
partitionFilter = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
foreach (var partName in this.PartitionFilter.Split(new char[] { ',', ';' }, System.StringSplitOptions.RemoveEmptyEntries))
foreach (var partName in this.PartitionFilter.Split(new char[] { ',', ';' }, System.StringSplitOptions.RemoveEmptyEntries | System.StringSplitOptions.TrimEntries))
{
partitionFilter.Add(partName);
}
Expand Down Expand Up @@ -278,7 +278,7 @@ private bool ProcessPartition(Partition partition, string arch)

if (this.AdditionalIncludes != null)
{
string[] dirs = this.AdditionalIncludes.Split(';', System.StringSplitOptions.RemoveEmptyEntries);
string[] dirs = this.AdditionalIncludes.Split(';', System.StringSplitOptions.RemoveEmptyEntries | System.StringSplitOptions.TrimEntries);
foreach (var dir in dirs)
{
if (!includeDirHash.Contains(dir))
Expand Down Expand Up @@ -465,17 +465,17 @@ private bool ProcessPartition(Partition partition, string arch)

private string[] GetExclusions(ITaskItem item)
{
return item.GetMetadata("Exclude").Split(';', System.StringSplitOptions.RemoveEmptyEntries);
return item.GetMetadata("Exclude").Split(';', System.StringSplitOptions.RemoveEmptyEntries | System.StringSplitOptions.TrimEntries);
}

private string[] GetRemaps(ITaskItem item)
{
return item.GetMetadata("Remap").Split(';', System.StringSplitOptions.RemoveEmptyEntries);
return item.GetMetadata("Remap").Split(';', System.StringSplitOptions.RemoveEmptyEntries | System.StringSplitOptions.TrimEntries);
}

private string[] GetFilesFromMetadata(ITaskItem item, string name)
{
string[] items = item.GetMetadata(name).Split(';', System.StringSplitOptions.RemoveEmptyEntries);
string[] items = item.GetMetadata(name).Split(';', System.StringSplitOptions.RemoveEmptyEntries | System.StringSplitOptions.TrimEntries);
for (int i = 0; i < items.Length; i++)
{
if (!Path.IsPathRooted(items[i]))
Expand Down
2 changes: 1 addition & 1 deletion sources/GeneratorSdk/MetadataTasks/TaskUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public static IEnumerable<string> GetFullPaths(IEnumerable<ITaskItem> items, str

public static IEnumerable<string> GetFilesFromMetadata(this ITaskItem item, string name, string root)
{
string[] items = item.GetMetadata(name).Split(';', System.StringSplitOptions.RemoveEmptyEntries);
string[] items = item.GetMetadata(name).Split(';', System.StringSplitOptions.RemoveEmptyEntries | System.StringSplitOptions.TrimEntries);
for (int i = 0; i < items.Length; i++)
{
if (!Path.IsPathRooted(items[i]))
Expand Down