diff --git a/sources/GeneratorSdk/MetadataTasks/ScrapeHeaders.cs b/sources/GeneratorSdk/MetadataTasks/ScrapeHeaders.cs index 116c79d5..b816cef8 100644 --- a/sources/GeneratorSdk/MetadataTasks/ScrapeHeaders.cs +++ b/sources/GeneratorSdk/MetadataTasks/ScrapeHeaders.cs @@ -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); } @@ -201,7 +201,7 @@ private Partition[] GetPartitions() if (!string.IsNullOrEmpty(this.PartitionFilter)) { partitionFilter = new HashSet(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); } @@ -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)) @@ -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])) diff --git a/sources/GeneratorSdk/MetadataTasks/TaskUtils.cs b/sources/GeneratorSdk/MetadataTasks/TaskUtils.cs index bf96d94e..7bcd4134 100644 --- a/sources/GeneratorSdk/MetadataTasks/TaskUtils.cs +++ b/sources/GeneratorSdk/MetadataTasks/TaskUtils.cs @@ -134,7 +134,7 @@ public static IEnumerable GetFullPaths(IEnumerable items, str public static IEnumerable 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]))