aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core.WindowsInstaller
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2021-03-14 11:27:44 -0500
committerRob Mensching <rob@firegiant.com>2021-03-14 09:40:59 -0700
commitdad79129d26cfb12f0d8894d9189334fa982b823 (patch)
tree8ba6ed0bf7cb707eaf2a91f242b1a80089d7ace2 /src/WixToolset.Core.WindowsInstaller
parent3ccd5e439da4296d6f2b66ce47075ab20d039676 (diff)
downloadwix-dad79129d26cfb12f0d8894d9189334fa982b823.tar.gz
wix-dad79129d26cfb12f0d8894d9189334fa982b823.tar.bz2
wix-dad79129d26cfb12f0d8894d9189334fa982b823.zip
Remove references to Core from backends.
#6340
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller')
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/CreateCabinetsCommand.cs1
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/CreateDeltaPatchesCommand.cs1
-rw-r--r--src/WixToolset.Core.WindowsInstaller/UnbindContext.cs29
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Unbinder.cs98
-rw-r--r--src/WixToolset.Core.WindowsInstaller/WixToolset.Core.WindowsInstaller.csproj6
-rw-r--r--src/WixToolset.Core.WindowsInstaller/WixToolsetCoreServiceProviderExtensions.cs1
6 files changed, 2 insertions, 134 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/CreateCabinetsCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/CreateCabinetsCommand.cs
index 0a543650..43afd718 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/CreateCabinetsCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/CreateCabinetsCommand.cs
@@ -8,7 +8,6 @@ namespace WixToolset.Core.WindowsInstaller.Bind
8 using System.IO; 8 using System.IO;
9 using System.Linq; 9 using System.Linq;
10 using System.Runtime.InteropServices; 10 using System.Runtime.InteropServices;
11 using WixToolset.Core.Bind;
12 using WixToolset.Data; 11 using WixToolset.Data;
13 using WixToolset.Data.Symbols; 12 using WixToolset.Data.Symbols;
14 using WixToolset.Data.WindowsInstaller; 13 using WixToolset.Data.WindowsInstaller;
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/CreateDeltaPatchesCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/CreateDeltaPatchesCommand.cs
index 640322e6..b587e6d9 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/CreateDeltaPatchesCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/CreateDeltaPatchesCommand.cs
@@ -6,7 +6,6 @@ namespace WixToolset.Core.WindowsInstaller.Bind
6 using System.Collections.Generic; 6 using System.Collections.Generic;
7 using System.Globalization; 7 using System.Globalization;
8 using System.IO; 8 using System.IO;
9 using WixToolset.Core.Bind;
10 using WixToolset.Data; 9 using WixToolset.Data;
11 using WixToolset.Data.Symbols; 10 using WixToolset.Data.Symbols;
12 using WixToolset.Extensibility.Data; 11 using WixToolset.Extensibility.Data;
diff --git a/src/WixToolset.Core.WindowsInstaller/UnbindContext.cs b/src/WixToolset.Core.WindowsInstaller/UnbindContext.cs
deleted file mode 100644
index acfb8f1e..00000000
--- a/src/WixToolset.Core.WindowsInstaller/UnbindContext.cs
+++ /dev/null
@@ -1,29 +0,0 @@
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
3namespace WixToolset.Core
4{
5 using WixToolset.Extensibility.Data;
6 using WixToolset.Extensibility.Services;
7
8 internal class UnbindContext : IUnbindContext
9 {
10 internal UnbindContext(IWixToolsetServiceProvider serviceProvider)
11 {
12 this.ServiceProvider = serviceProvider;
13 }
14
15 public IWixToolsetServiceProvider ServiceProvider { get; }
16
17 public string ExportBasePath { get; set; }
18
19 public string InputFilePath { get; set; }
20
21 public string IntermediateFolder { get; set; }
22
23 public bool IsAdminImage { get; set; }
24
25 public bool SuppressExtractCabinets { get; set; }
26
27 public bool SuppressDemodularization { get; set; }
28 }
29}
diff --git a/src/WixToolset.Core.WindowsInstaller/Unbinder.cs b/src/WixToolset.Core.WindowsInstaller/Unbinder.cs
deleted file mode 100644
index f712ec3f..00000000
--- a/src/WixToolset.Core.WindowsInstaller/Unbinder.cs
+++ /dev/null
@@ -1,98 +0,0 @@
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
3namespace WixToolset.Core
4{
5 using System.Collections.Generic;
6 using System.IO;
7 using WixToolset.Data;
8 using WixToolset.Extensibility;
9 using WixToolset.Extensibility.Services;
10
11 /// <summary>
12 /// Unbinder core of the WiX toolset.
13 /// </summary>
14 internal sealed class Unbinder : IUnbinder
15 {
16 public Unbinder(IWixToolsetServiceProvider serviceProvider)
17 {
18 this.ServiceProvider = serviceProvider;
19
20 var extensionManager = this.ServiceProvider.GetService<IExtensionManager>();
21 this.BackendFactories = extensionManager.GetServices<IBackendFactory>();
22 }
23
24 public IWixToolsetServiceProvider ServiceProvider { get; }
25
26 public IEnumerable<IBackendFactory> BackendFactories { get; }
27
28 /// <summary>
29 /// Gets or sets whether the input msi is an admin image.
30 /// </summary>
31 /// <value>Set to true if the input msi is part of an admin image.</value>
32 public bool IsAdminImage { get; set; }
33
34 /// <summary>
35 /// Gets or sets the option to suppress demodularizing values.
36 /// </summary>
37 /// <value>The option to suppress demodularizing values.</value>
38 public bool SuppressDemodularization { get; set; }
39
40 /// <summary>
41 /// Gets or sets the option to suppress extracting cabinets.
42 /// </summary>
43 /// <value>The option to suppress extracting cabinets.</value>
44 public bool SuppressExtractCabinets { get; set; }
45
46 /// <summary>
47 /// Gets or sets the temporary path for the Binder. If left null, the binder
48 /// will use %TEMP% environment variable.
49 /// </summary>
50 /// <value>Path to temp files.</value>
51 public string TempFilesLocation => Path.GetTempPath();
52
53 /// <summary>
54 /// Unbind a Windows Installer file.
55 /// </summary>
56 /// <param name="file">The Windows Installer file.</param>
57 /// <param name="outputType">The type of output to create.</param>
58 /// <param name="exportBasePath">The path where files should be exported.</param>
59 /// <returns>The output representing the database.</returns>
60 public Intermediate Unbind(string file, OutputType outputType, string exportBasePath)
61 {
62 if (!File.Exists(file))
63 {
64 if (OutputType.Transform == outputType)
65 {
66 throw new WixException(ErrorMessages.FileNotFound(null, file, "Transform"));
67 }
68 else
69 {
70 throw new WixException(ErrorMessages.FileNotFound(null, file, "Database"));
71 }
72 }
73
74 // if we don't have the temporary files object yet, get one
75 Directory.CreateDirectory(this.TempFilesLocation); // ensure the base path is there
76
77 var context = new UnbindContext(this.ServiceProvider);
78 context.InputFilePath = file;
79 context.ExportBasePath = exportBasePath;
80 context.IntermediateFolder = this.TempFilesLocation;
81 context.IsAdminImage = this.IsAdminImage;
82 context.SuppressDemodularization = this.SuppressDemodularization;
83 context.SuppressExtractCabinets = this.SuppressExtractCabinets;
84
85 foreach (var factory in this.BackendFactories)
86 {
87 if (factory.TryCreateBackend(outputType.ToString(), file, out var backend))
88 {
89 return backend.Unbind(context);
90 }
91 }
92
93 // TODO: Display message that could not find a unbinder for output type?
94
95 return null;
96 }
97 }
98}
diff --git a/src/WixToolset.Core.WindowsInstaller/WixToolset.Core.WindowsInstaller.csproj b/src/WixToolset.Core.WindowsInstaller/WixToolset.Core.WindowsInstaller.csproj
index 900115ec..cd2c917c 100644
--- a/src/WixToolset.Core.WindowsInstaller/WixToolset.Core.WindowsInstaller.csproj
+++ b/src/WixToolset.Core.WindowsInstaller/WixToolset.Core.WindowsInstaller.csproj
@@ -13,12 +13,10 @@
13 </PropertyGroup> 13 </PropertyGroup>
14 14
15 <ItemGroup> 15 <ItemGroup>
16 <ProjectReference Include="..\WixToolset.Core\WixToolset.Core.csproj" />
17 </ItemGroup>
18
19 <ItemGroup>
20 <PackageReference Include="WixToolset.Core.Native" Version="4.0.*" /> 16 <PackageReference Include="WixToolset.Core.Native" Version="4.0.*" />
17 <PackageReference Include="WixToolset.Data" Version="4.0.*" />
21 <PackageReference Include="WixToolset.Dtf.WindowsInstaller" Version="4.0.*" /> 18 <PackageReference Include="WixToolset.Dtf.WindowsInstaller" Version="4.0.*" />
19 <PackageReference Include="WixToolset.Extensibility" Version="4.0.*" />
22 </ItemGroup> 20 </ItemGroup>
23 21
24 <ItemGroup> 22 <ItemGroup>
diff --git a/src/WixToolset.Core.WindowsInstaller/WixToolsetCoreServiceProviderExtensions.cs b/src/WixToolset.Core.WindowsInstaller/WixToolsetCoreServiceProviderExtensions.cs
index d9649dec..e686fa49 100644
--- a/src/WixToolset.Core.WindowsInstaller/WixToolsetCoreServiceProviderExtensions.cs
+++ b/src/WixToolset.Core.WindowsInstaller/WixToolsetCoreServiceProviderExtensions.cs
@@ -31,7 +31,6 @@ namespace WixToolset.Core.WindowsInstaller
31 { 31 {
32 // Singletons. 32 // Singletons.
33 coreProvider.AddService((provider, singletons) => AddSingleton<IWindowsInstallerBackendHelper>(singletons, new WindowsInstallerBackendHelper(provider))); 33 coreProvider.AddService((provider, singletons) => AddSingleton<IWindowsInstallerBackendHelper>(singletons, new WindowsInstallerBackendHelper(provider)));
34 coreProvider.AddService<IUnbinder>((provider, singletons) => new Unbinder(provider));
35 } 34 }
36 35
37 private static T AddSingleton<T>(Dictionary<Type, object> singletons, T service) where T : class 36 private static T AddSingleton<T>(Dictionary<Type, object> singletons, T service) where T : class