/// <summary> /// Builds a new fusion package into <paramref name="fusion"/> with all the required package versions. /// </summary> /// <param name="fusionConfig">Configuration of the fusion that needs to be builded.</param> /// <param name="fusion">Fusion that needs to be builded.</param> /// <param name="packageVersions">Versions of the packages that needs to be included in the fusion.</param> /// <inheritdoc /> public void Build(FusePackConfig fusionConfig, IFusion fusion, IEnumerable <PackageVersion> packageVersions) { EnsureArg.IsNotNull(fusionConfig, nameof(fusionConfig)); EnsureArg.IsNotNull(fusion, nameof(fusion)); EnsureArg.IsNotNull(packageVersions, nameof(packageVersions)); IEnumerable <IPackage> packages = null; try { packages = packageVersions .Select(_ => packService.LoadPackage(_)) .Stale(); var finalEntries = GetFinalEntries(fusionConfig, packages); foreach (var entry in finalEntries) { SaveEntryOnFusion(fusion, entry, fusionConfig); logService.Debug($"Entry: '{entry.Name}' added to fusion: '{fusionConfig.Id}'."); } } finally { if (packages != null) { foreach (var package in packages) { (package as IDisposable)?.Dispose(); } } } }
private void SaveEntryOnFusion( IFusion fusion, IPackageEntry entry, FusePackConfig fusionConfig) { foreach (var filter in fusionFilters) { filter.BeforeAddEntry(fusionConfig, entry); } fusion.AddEntry(entry); }