public IEnumerable <LockFileTargetLibrary> GetRuntimeLibraries(IEnumerable <string> excludeFromPublishPackageIds) { IEnumerable <LockFileTargetLibrary> runtimeLibraries = _lockFileTarget.Libraries; Dictionary <string, LockFileTargetLibrary> libraryLookup = runtimeLibraries.ToDictionary(e => e.Name, StringComparer.OrdinalIgnoreCase); HashSet <string> allExclusionList = new HashSet <string>(StringComparer.OrdinalIgnoreCase); if (IsFrameworkDependent && PlatformLibrary != null) { allExclusionList.UnionWith(_lockFileTarget.GetPlatformExclusionList(PlatformLibrary, libraryLookup)); // If the platform library is not Microsoft.NETCore.App, treat it as an implicit dependency. // This makes it so Microsoft.AspNet.* 2.x platforms also exclude Microsoft.NETCore.App files. if (PlatformLibrary.Name.Length > 0 && !String.Equals(PlatformLibrary.Name, NetCorePlatformLibrary, StringComparison.OrdinalIgnoreCase)) { var library = _lockFileTarget.GetLibrary(NetCorePlatformLibrary); if (library != null) { allExclusionList.UnionWith(_lockFileTarget.GetPlatformExclusionList(library, libraryLookup)); } } } if (excludeFromPublishPackageIds?.Any() == true) { HashSet <string> excludeFromPublishList = GetExcludeFromPublishList( excludeFromPublishPackageIds, libraryLookup); allExclusionList.UnionWith(excludeFromPublishList); } if (PackagesToBeFiltered != null) { var filterLookup = new Dictionary <string, HashSet <PackageIdentity> >(StringComparer.OrdinalIgnoreCase); foreach (var pkg in PackagesToBeFiltered) { HashSet <PackageIdentity> packageinfos; if (filterLookup.TryGetValue(pkg.Id, out packageinfos)) { packageinfos.Add(pkg); } else { packageinfos = new HashSet <PackageIdentity>(); packageinfos.Add(pkg); filterLookup.Add(pkg.Id, packageinfos); } } allExclusionList.UnionWith(GetPackagesToBeFiltered(filterLookup, libraryLookup)); } return(runtimeLibraries.Filter(allExclusionList).ToArray()); }
public IEnumerable <LockFileTargetLibrary> GetRuntimeLibraries(IEnumerable <string> privateAssetPackageIds) { IEnumerable <LockFileTargetLibrary> runtimeLibraries = _lockFileTarget.Libraries; Dictionary <string, LockFileTargetLibrary> libraryLookup = runtimeLibraries.ToDictionary(e => e.Name, StringComparer.OrdinalIgnoreCase); HashSet <string> allExclusionList = new HashSet <string>(StringComparer.OrdinalIgnoreCase); if (IsPortable) { allExclusionList.UnionWith(_lockFileTarget.GetPlatformExclusionList(PlatformLibrary, libraryLookup)); } if (privateAssetPackageIds?.Any() == true) { HashSet <string> privateAssetsExclusionList = GetPrivateAssetsExclusionList( privateAssetPackageIds, libraryLookup); allExclusionList.UnionWith(privateAssetsExclusionList); } return(runtimeLibraries.Filter(allExclusionList).ToArray()); }
public IEnumerable <LockFileTargetLibrary> GetRuntimeLibraries(IEnumerable <string> excludeFromPublishPackageIds) { IEnumerable <LockFileTargetLibrary> runtimeLibraries = _lockFileTarget.Libraries; Dictionary <string, LockFileTargetLibrary> libraryLookup = runtimeLibraries.ToDictionary(e => e.Name, StringComparer.OrdinalIgnoreCase); HashSet <string> allExclusionList = new HashSet <string>(StringComparer.OrdinalIgnoreCase); if (IsFrameworkDependent) { if (PlatformLibrary != null) { allExclusionList.UnionWith(_lockFileTarget.GetPlatformExclusionList(PlatformLibrary, libraryLookup)); } } if (excludeFromPublishPackageIds?.Any() == true) { HashSet <string> excludeFromPublishList = GetExcludeFromPublishList( excludeFromPublishPackageIds, libraryLookup); allExclusionList.UnionWith(excludeFromPublishList); } if (PackagesToBeFiltered != null) { var filterLookup = new Dictionary <string, HashSet <PackageIdentity> >(StringComparer.OrdinalIgnoreCase); foreach (var pkg in PackagesToBeFiltered) { HashSet <PackageIdentity> packageinfos; if (filterLookup.TryGetValue(pkg.Id, out packageinfos)) { packageinfos.Add(pkg); } else { packageinfos = new HashSet <PackageIdentity>(); packageinfos.Add(pkg); filterLookup.Add(pkg.Id, packageinfos); } } allExclusionList.UnionWith(GetPackagesToBeFiltered(filterLookup, libraryLookup)); } return(runtimeLibraries.Filter(allExclusionList).ToArray()); }
public static IEnumerable <LockFileTargetLibrary> GetRuntimeLibraries(this LockFileTarget lockFileTarget) { IEnumerable <LockFileTargetLibrary> runtimeLibraries = lockFileTarget.Libraries; Dictionary <string, LockFileTargetLibrary> libraryLookup = runtimeLibraries.ToDictionary(e => e.Name, StringComparer.OrdinalIgnoreCase); HashSet <string> allExclusionList = new HashSet <string>(); if (lockFileTarget.IsPortable()) { allExclusionList.UnionWith(lockFileTarget.GetPlatformExclusionList(libraryLookup)); } return(runtimeLibraries.Filter(allExclusionList).ToArray()); }