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 | |
| 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')
8 files changed, 49 insertions, 21 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 | ||
diff --git a/src/WixToolset.Core.WindowsInstaller/Decompile/DecompileMsiOrMsmCommand.cs b/src/WixToolset.Core.WindowsInstaller/Decompile/DecompileMsiOrMsmCommand.cs index a98b4584..d44a863d 100644 --- a/src/WixToolset.Core.WindowsInstaller/Decompile/DecompileMsiOrMsmCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Decompile/DecompileMsiOrMsmCommand.cs | |||
| @@ -28,9 +28,9 @@ namespace WixToolset.Core.WindowsInstaller.Unbind | |||
| 28 | 28 | ||
| 29 | private IMessaging Messaging { get; } | 29 | private IMessaging Messaging { get; } |
| 30 | 30 | ||
| 31 | public DecompileResult Execute() | 31 | public IDecompileResult Execute() |
| 32 | { | 32 | { |
| 33 | var result = new DecompileResult(); | 33 | var result = this.Context.ServiceProvider.GetService<IDecompileResult>(); |
| 34 | 34 | ||
| 35 | try | 35 | try |
| 36 | { | 36 | { |
diff --git a/src/WixToolset.Core.WindowsInstaller/MsiBackend.cs b/src/WixToolset.Core.WindowsInstaller/MsiBackend.cs index b633ea31..f105473b 100644 --- a/src/WixToolset.Core.WindowsInstaller/MsiBackend.cs +++ b/src/WixToolset.Core.WindowsInstaller/MsiBackend.cs | |||
| @@ -13,7 +13,7 @@ namespace WixToolset.Core.WindowsInstaller | |||
| 13 | 13 | ||
| 14 | internal class MsiBackend : IBackend | 14 | internal class MsiBackend : IBackend |
| 15 | { | 15 | { |
| 16 | public BindResult Bind(IBindContext context) | 16 | public IBindResult Bind(IBindContext context) |
| 17 | { | 17 | { |
| 18 | var extensionManager = context.ServiceProvider.GetService<IExtensionManager>(); | 18 | var extensionManager = context.ServiceProvider.GetService<IExtensionManager>(); |
| 19 | 19 | ||
| @@ -29,7 +29,9 @@ namespace WixToolset.Core.WindowsInstaller | |||
| 29 | var command = new BindDatabaseCommand(context, backendExtensions, validator); | 29 | var command = new BindDatabaseCommand(context, backendExtensions, validator); |
| 30 | command.Execute(); | 30 | command.Execute(); |
| 31 | 31 | ||
| 32 | var result = new BindResult { FileTransfers = command.FileTransfers, TrackedFiles = command.TrackedFiles }; | 32 | var result = context.ServiceProvider.GetService<IBindResult>(); |
| 33 | result.FileTransfers = command.FileTransfers; | ||
| 34 | result.TrackedFiles = command.TrackedFiles; | ||
| 33 | 35 | ||
| 34 | foreach (var extension in backendExtensions) | 36 | foreach (var extension in backendExtensions) |
| 35 | { | 37 | { |
| @@ -38,7 +40,7 @@ namespace WixToolset.Core.WindowsInstaller | |||
| 38 | return result; | 40 | return result; |
| 39 | } | 41 | } |
| 40 | 42 | ||
| 41 | public DecompileResult Decompile(IDecompileContext context) | 43 | public IDecompileResult Decompile(IDecompileContext context) |
| 42 | { | 44 | { |
| 43 | var extensionManager = context.ServiceProvider.GetService<IExtensionManager>(); | 45 | var extensionManager = context.ServiceProvider.GetService<IExtensionManager>(); |
| 44 | 46 | ||
diff --git a/src/WixToolset.Core.WindowsInstaller/MsmBackend.cs b/src/WixToolset.Core.WindowsInstaller/MsmBackend.cs index 84588572..d17aad8e 100644 --- a/src/WixToolset.Core.WindowsInstaller/MsmBackend.cs +++ b/src/WixToolset.Core.WindowsInstaller/MsmBackend.cs | |||
| @@ -12,7 +12,7 @@ namespace WixToolset.Core.WindowsInstaller | |||
| 12 | 12 | ||
| 13 | internal class MsmBackend : IBackend | 13 | internal class MsmBackend : IBackend |
| 14 | { | 14 | { |
| 15 | public BindResult Bind(IBindContext context) | 15 | public IBindResult Bind(IBindContext context) |
| 16 | { | 16 | { |
| 17 | var extensionManager = context.ServiceProvider.GetService<IExtensionManager>(); | 17 | var extensionManager = context.ServiceProvider.GetService<IExtensionManager>(); |
| 18 | 18 | ||
| @@ -28,7 +28,9 @@ namespace WixToolset.Core.WindowsInstaller | |||
| 28 | var command = new BindDatabaseCommand(context, backendExtensions, validator); | 28 | var command = new BindDatabaseCommand(context, backendExtensions, validator); |
| 29 | command.Execute(); | 29 | command.Execute(); |
| 30 | 30 | ||
| 31 | var result = new BindResult { FileTransfers = command.FileTransfers, TrackedFiles = command.TrackedFiles }; | 31 | var result = context.ServiceProvider.GetService<IBindResult>(); |
| 32 | result.FileTransfers = command.FileTransfers; | ||
| 33 | result.TrackedFiles = command.TrackedFiles; | ||
| 32 | 34 | ||
| 33 | foreach (var extension in backendExtensions) | 35 | foreach (var extension in backendExtensions) |
| 34 | { | 36 | { |
| @@ -43,7 +45,7 @@ namespace WixToolset.Core.WindowsInstaller | |||
| 43 | return result; | 45 | return result; |
| 44 | } | 46 | } |
| 45 | 47 | ||
| 46 | public DecompileResult Decompile(IDecompileContext context) | 48 | public IDecompileResult Decompile(IDecompileContext context) |
| 47 | { | 49 | { |
| 48 | var extensionManager = context.ServiceProvider.GetService<IExtensionManager>(); | 50 | var extensionManager = context.ServiceProvider.GetService<IExtensionManager>(); |
| 49 | 51 | ||
diff --git a/src/WixToolset.Core.WindowsInstaller/MspBackend.cs b/src/WixToolset.Core.WindowsInstaller/MspBackend.cs index df4eb44c..90e67336 100644 --- a/src/WixToolset.Core.WindowsInstaller/MspBackend.cs +++ b/src/WixToolset.Core.WindowsInstaller/MspBackend.cs | |||
| @@ -16,12 +16,12 @@ namespace WixToolset.Core.WindowsInstaller | |||
| 16 | 16 | ||
| 17 | internal class MspBackend : IBackend | 17 | internal class MspBackend : IBackend |
| 18 | { | 18 | { |
| 19 | public BindResult Bind(IBindContext context) | 19 | public IBindResult Bind(IBindContext context) |
| 20 | { | 20 | { |
| 21 | throw new NotImplementedException(); | 21 | throw new NotImplementedException(); |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | public DecompileResult Decompile(IDecompileContext context) | 24 | public IDecompileResult Decompile(IDecompileContext context) |
| 25 | { | 25 | { |
| 26 | throw new NotImplementedException(); | 26 | throw new NotImplementedException(); |
| 27 | } | 27 | } |
diff --git a/src/WixToolset.Core.WindowsInstaller/MstBackend.cs b/src/WixToolset.Core.WindowsInstaller/MstBackend.cs index 6460821a..b64f417a 100644 --- a/src/WixToolset.Core.WindowsInstaller/MstBackend.cs +++ b/src/WixToolset.Core.WindowsInstaller/MstBackend.cs | |||
| @@ -10,7 +10,7 @@ namespace WixToolset.Core.WindowsInstaller | |||
| 10 | 10 | ||
| 11 | internal class MstBackend : IBackend | 11 | internal class MstBackend : IBackend |
| 12 | { | 12 | { |
| 13 | public BindResult Bind(IBindContext context) | 13 | public IBindResult Bind(IBindContext context) |
| 14 | { | 14 | { |
| 15 | #if REVISIT_FOR_PATCHING | 15 | #if REVISIT_FOR_PATCHING |
| 16 | var command = new BindTransformCommand(); | 16 | var command = new BindTransformCommand(); |
| @@ -25,7 +25,7 @@ namespace WixToolset.Core.WindowsInstaller | |||
| 25 | throw new NotImplementedException(); | 25 | throw new NotImplementedException(); |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | public DecompileResult Decompile(IDecompileContext context) | 28 | public IDecompileResult Decompile(IDecompileContext context) |
| 29 | { | 29 | { |
| 30 | throw new NotImplementedException(); | 30 | throw new NotImplementedException(); |
| 31 | } | 31 | } |
