private IEnumerable <WorkloadPack> GetWorkloadPacks() { // We need to track duplicate packs so we only generate MSIs once. We'll key off the pack ID and version. IEnumerable <WorkloadManifest> manifests = WorkloadManifests.Select( w => WorkloadManifestReader.ReadWorkloadManifest(File.OpenRead(w.ItemSpec))); return(manifests.SelectMany(m => m.Packs.Values).GroupBy(x => new { x.Id, x.Version }). Select(g => g.First())); }
private IEnumerable <WorkloadPack> GetWorkloadPacks() { // We need to track duplicate packs so we only generate MSIs once. We'll key off the pack ID and version. IEnumerable <WorkloadManifest> manifests = WorkloadManifests.Select( w => WorkloadManifestReader.ReadWorkloadManifest(Path.GetFileNameWithoutExtension(w.ItemSpec), File.OpenRead(w.ItemSpec))); // We want all workloads in all manifests iff the workload has no platform or at least one // platform includes Windows var workloads = manifests.SelectMany(m => m.Workloads). Select(w => w.Value). Where(wd => (wd.Platforms == null) || wd.Platforms.Any(p => p.StartsWith("win"))); var packIds = workloads.Where(w => w.Packs != null).SelectMany(w => w.Packs).Distinct(); return(manifests.SelectMany(m => m.Packs.Values). Where(p => packIds.Contains(p.Id)). Distinct()); }