aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core.WindowsInstaller/Bind/CabinetResolver.cs
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2019-03-01 11:12:52 -0800
committerRob Mensching <rob@robmensching.com>2019-03-01 11:15:40 -0800
commit5392cf57c09bddde7157e5b26c5c2a013f819ead (patch)
tree96063a49293bd9eea122218e770b52d3c20812f2 /src/WixToolset.Core.WindowsInstaller/Bind/CabinetResolver.cs
parenta4f5a5a042c00254607fbecdf132a2e2a91a1bdd (diff)
downloadwix-5392cf57c09bddde7157e5b26c5c2a013f819ead.tar.gz
wix-5392cf57c09bddde7157e5b26c5c2a013f819ead.tar.bz2
wix-5392cf57c09bddde7157e5b26c5c2a013f819ead.zip
Integrate interface-only WixToolset.Extensibility change
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Bind/CabinetResolver.cs')
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/CabinetResolver.cs28
1 files changed, 22 insertions, 6 deletions
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
3namespace WixToolset.Core.WindowsInstaller.Bind 3namespace 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