diff options
| author | Rob Mensching <rob@firegiant.com> | 2019-03-01 11:12:52 -0800 |
|---|---|---|
| committer | Rob Mensching <rob@robmensching.com> | 2019-03-01 11:15:40 -0800 |
| commit | 5392cf57c09bddde7157e5b26c5c2a013f819ead (patch) | |
| tree | 96063a49293bd9eea122218e770b52d3c20812f2 /src/WixToolset.Core.WindowsInstaller/Bind | |
| parent | a4f5a5a042c00254607fbecdf132a2e2a91a1bdd (diff) | |
| download | wix-5392cf57c09bddde7157e5b26c5c2a013f819ead.tar.gz wix-5392cf57c09bddde7157e5b26c5c2a013f819ead.tar.bz2 wix-5392cf57c09bddde7157e5b26c5c2a013f819ead.zip | |
Integrate interface-only WixToolset.Extensibility change
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Bind')
3 files changed, 33 insertions, 9 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs index 020f58b3..f78cb42c 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs | |||
| @@ -24,6 +24,8 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 24 | 24 | ||
| 25 | public BindDatabaseCommand(IBindContext context, IEnumerable<IWindowsInstallerBackendBinderExtension> backendExtension, Validator validator) | 25 | public BindDatabaseCommand(IBindContext context, IEnumerable<IWindowsInstallerBackendBinderExtension> backendExtension, Validator validator) |
| 26 | { | 26 | { |
| 27 | this.ServiceProvider = context.ServiceProvider; | ||
| 28 | |||
| 27 | this.Messaging = context.ServiceProvider.GetService<IMessaging>(); | 29 | this.Messaging = context.ServiceProvider.GetService<IMessaging>(); |
| 28 | 30 | ||
| 29 | this.BackendHelper = context.ServiceProvider.GetService<IBackendHelper>(); | 31 | this.BackendHelper = context.ServiceProvider.GetService<IBackendHelper>(); |
| @@ -46,6 +48,8 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 46 | this.BackendExtensions = backendExtension; | 48 | this.BackendExtensions = backendExtension; |
| 47 | } | 49 | } |
| 48 | 50 | ||
| 51 | public IServiceProvider ServiceProvider { get; } | ||
| 52 | |||
| 49 | private IMessaging Messaging { get; } | 53 | private IMessaging Messaging { get; } |
| 50 | 54 | ||
| 51 | private IBackendHelper BackendHelper { get; } | 55 | private IBackendHelper BackendHelper { get; } |
| @@ -383,7 +387,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 383 | { | 387 | { |
| 384 | this.Messaging.Write(VerboseMessages.CreatingCabinetFiles()); | 388 | this.Messaging.Write(VerboseMessages.CreatingCabinetFiles()); |
| 385 | 389 | ||
| 386 | var command = new CreateCabinetsCommand(this.BackendHelper); | 390 | var command = new CreateCabinetsCommand(this.ServiceProvider, this.BackendHelper); |
| 387 | command.CabbingThreadCount = this.CabbingThreadCount; | 391 | command.CabbingThreadCount = this.CabbingThreadCount; |
| 388 | command.CabCachePath = this.CabCachePath; | 392 | command.CabCachePath = this.CabCachePath; |
| 389 | command.DefaultCompressionLevel = this.DefaultCompressionLevel; | 393 | command.DefaultCompressionLevel = this.DefaultCompressionLevel; |
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/CabinetResolver.cs b/src/WixToolset.Core.WindowsInstaller/Bind/CabinetResolver.cs index 2a717ec5..054e3c71 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/CabinetResolver.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/CabinetResolver.cs | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
| 2 | 2 | ||
| 3 | namespace WixToolset.Core.WindowsInstaller.Bind | 3 | namespace WixToolset.Core.WindowsInstaller.Bind |
| 4 | { | 4 | { |
| @@ -11,25 +11,30 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 11 | using WixToolset.Data; | 11 | using WixToolset.Data; |
| 12 | using WixToolset.Extensibility; | 12 | using WixToolset.Extensibility; |
| 13 | using WixToolset.Extensibility.Data; | 13 | using WixToolset.Extensibility.Data; |
| 14 | using WixToolset.Extensibility.Services; | ||
| 14 | 15 | ||
| 15 | public class CabinetResolver | 16 | public class CabinetResolver |
| 16 | { | 17 | { |
| 17 | public CabinetResolver(string cabCachePath, IEnumerable<IWindowsInstallerBackendBinderExtension> backendExtensions) | 18 | public CabinetResolver(IServiceProvider serviceProvider, string cabCachePath, IEnumerable<IWindowsInstallerBackendBinderExtension> backendExtensions) |
| 18 | { | 19 | { |
| 20 | this.ServiceProvider = serviceProvider; | ||
| 21 | |||
| 19 | this.CabCachePath = cabCachePath; | 22 | this.CabCachePath = cabCachePath; |
| 20 | 23 | ||
| 21 | this.BackendExtensions = backendExtensions; | 24 | this.BackendExtensions = backendExtensions; |
| 22 | } | 25 | } |
| 23 | 26 | ||
| 27 | private IServiceProvider ServiceProvider { get; } | ||
| 28 | |||
| 24 | private string CabCachePath { get; } | 29 | private string CabCachePath { get; } |
| 25 | 30 | ||
| 26 | private IEnumerable<IWindowsInstallerBackendBinderExtension> BackendExtensions { get; } | 31 | private IEnumerable<IWindowsInstallerBackendBinderExtension> BackendExtensions { get; } |
| 27 | 32 | ||
| 28 | public ResolvedCabinet ResolveCabinet(string cabinetPath, IEnumerable<FileFacade> fileFacades) | 33 | public IResolvedCabinet ResolveCabinet(string cabinetPath, IEnumerable<FileFacade> fileFacades) |
| 29 | { | 34 | { |
| 30 | var filesWithPath = fileFacades.Select(f => new BindFileWithPath() { Id = f.File.File, Path = f.WixFile.Source.Path }).ToList(); | 35 | var filesWithPath = fileFacades.Select(this.CreateBindFileWithPath).ToList(); |
| 31 | 36 | ||
| 32 | ResolvedCabinet resolved = null; | 37 | IResolvedCabinet resolved = null; |
| 33 | 38 | ||
| 34 | foreach (var extension in this.BackendExtensions) | 39 | foreach (var extension in this.BackendExtensions) |
| 35 | { | 40 | { |
| @@ -42,7 +47,9 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 42 | } | 47 | } |
| 43 | 48 | ||
| 44 | // By default cabinet should be built and moved to the suggested location. | 49 | // By default cabinet should be built and moved to the suggested location. |
| 45 | resolved = new ResolvedCabinet() { BuildOption = CabinetBuildOption.BuildAndMove, Path = cabinetPath }; | 50 | resolved = this.ServiceProvider.GetService<IResolvedCabinet>(); |
| 51 | resolved.BuildOption = CabinetBuildOption.BuildAndMove; | ||
| 52 | resolved.Path = cabinetPath; | ||
| 46 | 53 | ||
| 47 | // If a cabinet cache path was provided, change the location for the cabinet | 54 | // If a cabinet cache path was provided, change the location for the cabinet |
| 48 | // to be built to and check if there is a cabinet that can be reused. | 55 | // to be built to and check if there is a cabinet that can be reused. |
| @@ -102,6 +109,15 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 102 | return resolved; | 109 | return resolved; |
| 103 | } | 110 | } |
| 104 | 111 | ||
| 112 | private IBindFileWithPath CreateBindFileWithPath(FileFacade facade) | ||
| 113 | { | ||
| 114 | var result = this.ServiceProvider.GetService<IBindFileWithPath>(); | ||
| 115 | result.Id = facade.File.File; | ||
| 116 | result.Path = facade.WixFile.Source.Path; | ||
| 117 | |||
| 118 | return result; | ||
| 119 | } | ||
| 120 | |||
| 105 | private static bool CheckFileExists(string path) | 121 | private static bool CheckFileExists(string path) |
| 106 | { | 122 | { |
| 107 | try | 123 | try |
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/CreateCabinetsCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/CreateCabinetsCommand.cs index 88be831e..890c446c 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/CreateCabinetsCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/CreateCabinetsCommand.cs | |||
| @@ -34,7 +34,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 34 | 34 | ||
| 35 | private Dictionary<string, string> lastCabinetAddedToMediaTable; // Key is First Cabinet Name, Value is Last Cabinet Added in the Split Sequence | 35 | private Dictionary<string, string> lastCabinetAddedToMediaTable; // Key is First Cabinet Name, Value is Last Cabinet Added in the Split Sequence |
| 36 | 36 | ||
| 37 | public CreateCabinetsCommand(IBackendHelper backendHelper) | 37 | public CreateCabinetsCommand(IServiceProvider serviceProvider, IBackendHelper backendHelper) |
| 38 | { | 38 | { |
| 39 | this.fileTransfers = new List<IFileTransfer>(); | 39 | this.fileTransfers = new List<IFileTransfer>(); |
| 40 | 40 | ||
| @@ -42,9 +42,13 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 42 | 42 | ||
| 43 | this.newCabNamesCallBack = this.NewCabNamesCallBack; | 43 | this.newCabNamesCallBack = this.NewCabNamesCallBack; |
| 44 | 44 | ||
| 45 | this.ServiceProvider = serviceProvider; | ||
| 46 | |||
| 45 | this.BackendHelper = backendHelper; | 47 | this.BackendHelper = backendHelper; |
| 46 | } | 48 | } |
| 47 | 49 | ||
| 50 | public IServiceProvider ServiceProvider { get; } | ||
| 51 | |||
| 48 | public IBackendHelper BackendHelper { get; } | 52 | public IBackendHelper BackendHelper { get; } |
| 49 | 53 | ||
| 50 | /// <summary> | 54 | /// <summary> |
| @@ -221,7 +225,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 221 | } | 225 | } |
| 222 | } | 226 | } |
| 223 | 227 | ||
| 224 | var cabinetResolver = new CabinetResolver(this.CabCachePath, this.BackendExtensions); | 228 | var cabinetResolver = new CabinetResolver(this.ServiceProvider, this.CabCachePath, this.BackendExtensions); |
| 225 | 229 | ||
| 226 | var resolvedCabinet = cabinetResolver.ResolveCabinet(tempCabinetFileX, fileFacades); | 230 | var resolvedCabinet = cabinetResolver.ResolveCabinet(tempCabinetFileX, fileFacades); |
| 227 | 231 | ||
