/// <summary> /// Get any regex entries that match no packages. Such entries are stale. /// </summary> internal static List <Regex> GetStaleRegex(GenerateData generateData, RepoData repoData) { return(generateData .Packages .Where(r => repoData.FloatingPackages.All(p => !r.IsMatch(p.Name))) .ToList()); }
internal RepoConfig( IEnumerable<NuGetPackage> fixedPackages, IEnumerable<string> toolsetPackages, IEnumerable<Regex> nuspecExcludes, IEnumerable<Regex> projectJsonExcludes, GenerateData? msbuildGenerateData) { Debug.Assert(toolsetPackages.Distinct().Count() == toolsetPackages.Count()); MSBuildGenerateData = msbuildGenerateData; FixedPackages = fixedPackages.OrderBy(x => x.Name).ToImmutableArray(); NuSpecExcludes = nuspecExcludes.ToImmutableArray(); ProjectJsonExcludes = projectJsonExcludes.ToImmutableArray(); ToolsetPackages = toolsetPackages.OrderBy(x => x).ToImmutableArray(); var map = new Dictionary<string, List<string>>(); foreach (var nugetRef in fixedPackages) { List<string> list; if (!map.TryGetValue(nugetRef.Name, out list)) { list = new List<string>(capacity: 1); map[nugetRef.Name] = list; } list.Add(nugetRef.Version); } }
/// <summary> /// Get any regex entries that match no packages. Such entries are stale. /// </summary> internal static List<Regex> GetStaleRegex(GenerateData generateData, RepoData repoData) { return generateData .Packages .Where(r => repoData.FloatingPackages.All(p => !r.IsMatch(p.Name))) .ToList(); }
/// <summary> /// Get the subset of packages which match the specified filter for the generated file. /// </summary> internal static List <NuGetPackage> GetFilteredPackages(GenerateData generateData, RepoData repoData) { // Fixed packages are never included in generated output. Doing so would create conflicts because it's // possible for two versions to exist for the same package. Take for example System.Collections.Immuatble // which is both fixed and floating in Roslyn. return(repoData .FloatingPackages .Where(x => generateData.Packages.Any(y => y.IsMatch(x.Name))) .ToList()); }
/// <summary> /// Get the subset of packages which match the specified filter for the generated file. /// </summary> internal static List<NuGetPackage> GetFilteredPackages(GenerateData generateData, RepoData repoData) { // Fixed packages are never included in generated output. Doing so would create conflicts because it's // possible for two versions to exist for the same package. Take for example System.Collections.Immuatble // which is both fixed and floating in Roslyn. return repoData .FloatingPackages .Where(x => generateData.Packages.Any(y => y.IsMatch(x.Name))) .ToList(); }
/// <summary> /// Get the subset of packages which match the specified filter for the generated file. /// </summary> internal static List<NuGetPackage> GetFilteredPackages(GenerateData generateData, RepoData repoData) { // Only fixed packages with 'generate names' are included in generated output. Doing // otherwise would create conflicts because it's possible for two versions to exist // for the same package. Take for example System.Collections.Immuatble which is both // fixed and floating in Roslyn. var fixedWithGenerate = repoData .FixedPackages .Where(x => x.GenerateNameOpt != null); return repoData .FloatingPackages .Concat(fixedWithGenerate) .OrderBy(x => x.Name) .Where(x => generateData.Packages.Any(y => y.IsMatch(x.Name))) .ToList(); }
/// <summary> /// Get the subset of packages which match the specified filter for the generated file. /// </summary> internal static List <NuGetPackage> GetFilteredPackages(GenerateData generateData, RepoData repoData) { // Only fixed packages with 'generate names' are included in generated output. Doing // otherwise would create conflicts because it's possible for two versions to exist // for the same package. Take for example System.Collections.Immuatble which is both // fixed and floating in Roslyn. var fixedWithGenerate = repoData .FixedPackages .Where(x => x.GenerateNameOpt != null); return(repoData .FloatingPackages .Concat(fixedWithGenerate) .OrderBy(x => x.Name) .Where(x => generateData.Packages.Any(y => y.IsMatch(x.Name))) .ToList()); }