diff options
author | Bob Arnson <bob@firegiant.com> | 2023-12-31 17:08:45 -0500 |
---|---|---|
committer | Bob Arnson <github@bobs.org> | 2023-12-31 17:52:55 -0500 |
commit | d56481c18f831991cc36d9720e06ce6874f1bea1 (patch) | |
tree | 36d218b9e39989e7daae7c1b6ca2f2e26a884415 /src | |
parent | c890f0e1a360d949d5e0b5d9ab619c4a78d9fbd3 (diff) | |
download | wix-d56481c18f831991cc36d9720e06ce6874f1bea1.tar.gz wix-d56481c18f831991cc36d9720e06ce6874f1bea1.tar.bz2 wix-d56481c18f831991cc36d9720e06ce6874f1bea1.zip |
Rename IWindowsInstallerDecompileContext...
...TreatProductAsModule to KeepModularizationIds to better describe what
it does.
Fixes https://github.com/wixtoolset/issues/issues/7607.
Diffstat (limited to 'src')
6 files changed, 11 insertions, 19 deletions
diff --git a/src/api/wix/WixToolset.Extensibility/Data/IWindowsInstallerDecompileContext.cs b/src/api/wix/WixToolset.Extensibility/Data/IWindowsInstallerDecompileContext.cs index 845c89a5..1d729b72 100644 --- a/src/api/wix/WixToolset.Extensibility/Data/IWindowsInstallerDecompileContext.cs +++ b/src/api/wix/WixToolset.Extensibility/Data/IWindowsInstallerDecompileContext.cs | |||
@@ -96,6 +96,6 @@ namespace WixToolset.Extensibility.Data | |||
96 | /// Gets or sets whether the decompiler should keep modularization | 96 | /// Gets or sets whether the decompiler should keep modularization |
97 | /// GUIDs (true) or remove them (default/false). | 97 | /// GUIDs (true) or remove them (default/false). |
98 | /// </summary> | 98 | /// </summary> |
99 | bool TreatProductAsModule { get; set; } | 99 | bool KeepModularizationIds { get; set; } |
100 | } | 100 | } |
101 | } | 101 | } |
diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs b/src/wix/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs index 71e1b22b..e3609b30 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs | |||
@@ -43,7 +43,7 @@ namespace WixToolset.Core.WindowsInstaller.Decompile | |||
43 | /// <summary> | 43 | /// <summary> |
44 | /// Creates a new decompiler object with a default set of table definitions. | 44 | /// Creates a new decompiler object with a default set of table definitions. |
45 | /// </summary> | 45 | /// </summary> |
46 | public Decompiler(IMessaging messaging, IBackendHelper backendHelper, IWindowsInstallerDecompilerHelper decompilerHelper, IEnumerable<IWindowsInstallerDecompilerExtension> extensions, IEnumerable<IExtensionData> extensionData, ISymbolDefinitionCreator creator, string baseSourcePath, bool suppressCustomTables, bool suppressDroppingEmptyTables, bool suppressRelativeActionSequencing, bool suppressUI, bool treatProductAsModule) | 46 | public Decompiler(IMessaging messaging, IBackendHelper backendHelper, IWindowsInstallerDecompilerHelper decompilerHelper, IEnumerable<IWindowsInstallerDecompilerExtension> extensions, IEnumerable<IExtensionData> extensionData, ISymbolDefinitionCreator creator, string baseSourcePath, bool suppressCustomTables, bool suppressDroppingEmptyTables, bool suppressRelativeActionSequencing, bool suppressUI, bool keepModularizationIds) |
47 | { | 47 | { |
48 | this.Messaging = messaging; | 48 | this.Messaging = messaging; |
49 | this.BackendHelper = backendHelper; | 49 | this.BackendHelper = backendHelper; |
@@ -56,7 +56,7 @@ namespace WixToolset.Core.WindowsInstaller.Decompile | |||
56 | this.SuppressDroppingEmptyTables = suppressDroppingEmptyTables; | 56 | this.SuppressDroppingEmptyTables = suppressDroppingEmptyTables; |
57 | this.SuppressRelativeActionSequencing = suppressRelativeActionSequencing; | 57 | this.SuppressRelativeActionSequencing = suppressRelativeActionSequencing; |
58 | this.SuppressUI = suppressUI; | 58 | this.SuppressUI = suppressUI; |
59 | this.TreatProductAsModule = treatProductAsModule; | 59 | this.KeepModularizationIds = keepModularizationIds; |
60 | 60 | ||
61 | this.ExtensionsByTableName = new Dictionary<string, IWindowsInstallerDecompilerExtension>(); | 61 | this.ExtensionsByTableName = new Dictionary<string, IWindowsInstallerDecompilerExtension>(); |
62 | this.StandardActions = WindowsInstallerStandard.StandardActions().ToDictionary(a => a.Id.Id); | 62 | this.StandardActions = WindowsInstallerStandard.StandardActions().ToDictionary(a => a.Id.Id); |
@@ -88,7 +88,7 @@ namespace WixToolset.Core.WindowsInstaller.Decompile | |||
88 | 88 | ||
89 | private bool SuppressUI { get; } | 89 | private bool SuppressUI { get; } |
90 | 90 | ||
91 | private bool TreatProductAsModule { get; } | 91 | private bool KeepModularizationIds { get; } |
92 | 92 | ||
93 | private OutputType OutputType { get; set; } | 93 | private OutputType OutputType { get; set; } |
94 | 94 | ||
@@ -1188,7 +1188,7 @@ namespace WixToolset.Core.WindowsInstaller.Decompile | |||
1188 | var fileName = xFile?.Attribute("Name")?.Value; | 1188 | var fileName = xFile?.Attribute("Name")?.Value; |
1189 | 1189 | ||
1190 | // set the source (done here because it requires information from the Directory table) | 1190 | // set the source (done here because it requires information from the Directory table) |
1191 | if (OutputType.Module == this.OutputType && !this.TreatProductAsModule) | 1191 | if (OutputType.Module == this.OutputType && !this.KeepModularizationIds) |
1192 | { | 1192 | { |
1193 | xFile.SetAttributeValue("Source", String.Concat(this.BaseSourcePath, Path.DirectorySeparatorChar, "File", Path.DirectorySeparatorChar, fileId, '.', this.ModularizationGuid.Substring(1, 36).Replace('-', '_'))); | 1193 | xFile.SetAttributeValue("Source", String.Concat(this.BaseSourcePath, Path.DirectorySeparatorChar, "File", Path.DirectorySeparatorChar, fileId, '.', this.ModularizationGuid.Substring(1, 36).Replace('-', '_'))); |
1194 | } | 1194 | } |
diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Melter.cs b/src/wix/WixToolset.Core.WindowsInstaller/Melter.cs index 7073e952..10a60eb8 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Melter.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Melter.cs | |||
@@ -85,7 +85,7 @@ namespace WixToolset | |||
85 | PreDecompile(wixout); | 85 | PreDecompile(wixout); |
86 | 86 | ||
87 | wixout.Type = OutputType.Package; | 87 | wixout.Type = OutputType.Package; |
88 | this.decompiler.TreatProductAsModule = true; | 88 | this.decompiler.KeepModularizationIds = true; |
89 | Wix.Wix wix = this.decompiler.Decompile(wixout); | 89 | Wix.Wix wix = this.decompiler.Decompile(wixout); |
90 | 90 | ||
91 | if (null == wix) | 91 | if (null == wix) |
diff --git a/src/wix/WixToolset.Core.WindowsInstaller/WindowsInstallerDecompileContext.cs b/src/wix/WixToolset.Core.WindowsInstaller/WindowsInstallerDecompileContext.cs index 22745ab0..13065fb5 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/WindowsInstallerDecompileContext.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/WindowsInstallerDecompileContext.cs | |||
@@ -49,6 +49,6 @@ namespace WixToolset.Core.WindowsInstaller | |||
49 | 49 | ||
50 | public bool SuppressUI { get; set; } | 50 | public bool SuppressUI { get; set; } |
51 | 51 | ||
52 | public bool TreatProductAsModule { get; set; } | 52 | public bool KeepModularizationIds { get; set; } |
53 | } | 53 | } |
54 | } | 54 | } |
diff --git a/src/wix/WixToolset.Core.WindowsInstaller/WindowsInstallerDecompiler.cs b/src/wix/WixToolset.Core.WindowsInstaller/WindowsInstallerDecompiler.cs index 267fe495..56ebd5f3 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/WindowsInstallerDecompiler.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/WindowsInstallerDecompiler.cs | |||
@@ -94,21 +94,13 @@ namespace WixToolset.Core.WindowsInstaller | |||
94 | var extractFilesFolder = context.SuppressExtractCabinets || (String.IsNullOrEmpty(context.CabinetExtractFolder) && String.IsNullOrEmpty(context.ExtractFolder)) ? null : | 94 | var extractFilesFolder = context.SuppressExtractCabinets || (String.IsNullOrEmpty(context.CabinetExtractFolder) && String.IsNullOrEmpty(context.ExtractFolder)) ? null : |
95 | String.IsNullOrEmpty(context.CabinetExtractFolder) ? Path.Combine(context.ExtractFolder, "File") : context.CabinetExtractFolder; | 95 | String.IsNullOrEmpty(context.CabinetExtractFolder) ? Path.Combine(context.ExtractFolder, "File") : context.CabinetExtractFolder; |
96 | 96 | ||
97 | // IWindowsInstallerDecompileContext.TreatProductAsModule is broken. So broken, in fact, | 97 | var demodularize = !context.KeepModularizationIds; |
98 | // that it's been broken since WiX v3.0 in 2008. It was introduced (according to lore) | ||
99 | // to support Melt, which decompiles merge modules into fragments so you can consume | ||
100 | // merge modules without actually going through the black box that is mergemod.dll. But | ||
101 | // the name is wrong: It's not TreatProductAsModule; if anything it should instead be | ||
102 | // TreatModuleAsProduct, though even that's wrong (because you want a fragment, not a | ||
103 | // product/package). In WiX v5, rename to `KeepModularizeIds` (or something better) to | ||
104 | // reflect the functionality. | ||
105 | var demodularize = !context.TreatProductAsModule; | ||
106 | var sectionType = context.DecompileType; | 98 | var sectionType = context.DecompileType; |
107 | var unbindCommand = new UnbindDatabaseCommand(this.Messaging, backendHelper, fileSystem, pathResolver, context.DecompilePath, null, sectionType, context.ExtractFolder, extractFilesFolder, context.IntermediateFolder, demodularize, skipSummaryInfo: false); | 99 | var unbindCommand = new UnbindDatabaseCommand(this.Messaging, backendHelper, fileSystem, pathResolver, context.DecompilePath, null, sectionType, context.ExtractFolder, extractFilesFolder, context.IntermediateFolder, demodularize, skipSummaryInfo: false); |
108 | var output = unbindCommand.Execute(); | 100 | var output = unbindCommand.Execute(); |
109 | var extractedFilePaths = unbindCommand.ExportedFiles; | 101 | var extractedFilePaths = unbindCommand.ExportedFiles; |
110 | 102 | ||
111 | var decompiler = new Decompiler(this.Messaging, backendHelper, decompilerHelper, context.Extensions, context.ExtensionData, context.SymbolDefinitionCreator, context.BaseSourcePath, context.SuppressCustomTables, context.SuppressDroppingEmptyTables, context.SuppressRelativeActionSequencing, context.SuppressUI, context.TreatProductAsModule); | 103 | var decompiler = new Decompiler(this.Messaging, backendHelper, decompilerHelper, context.Extensions, context.ExtensionData, context.SymbolDefinitionCreator, context.BaseSourcePath, context.SuppressCustomTables, context.SuppressDroppingEmptyTables, context.SuppressRelativeActionSequencing, context.SuppressUI, context.KeepModularizationIds); |
112 | var document = decompiler.Decompile(output); | 104 | var document = decompiler.Decompile(output); |
113 | 105 | ||
114 | var result = context.ServiceProvider.GetService<IWindowsInstallerDecompileResult>(); | 106 | var result = context.ServiceProvider.GetService<IWindowsInstallerDecompileResult>(); |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs index 01882fef..86da7ebd 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs | |||
@@ -108,7 +108,7 @@ namespace WixToolsetTest.CoreIntegration | |||
108 | } | 108 | } |
109 | 109 | ||
110 | [Fact] | 110 | [Fact] |
111 | public void CanDecompileMergeModuleWithTreatProductAsModule() | 111 | public void CanDecompileMergeModuleWithKeepModularizationIds() |
112 | { | 112 | { |
113 | using (var fs = new DisposableFileSystem()) | 113 | using (var fs = new DisposableFileSystem()) |
114 | { | 114 | { |
@@ -127,7 +127,7 @@ namespace WixToolsetTest.CoreIntegration | |||
127 | context.ExtensionData = extensionManager.GetServices<IExtensionData>(); | 127 | context.ExtensionData = extensionManager.GetServices<IExtensionData>(); |
128 | context.DecompilePath = Path.Combine(sourceFolder, "MergeModule1.msm"); | 128 | context.DecompilePath = Path.Combine(sourceFolder, "MergeModule1.msm"); |
129 | context.DecompileType = OutputType.Module; | 129 | context.DecompileType = OutputType.Module; |
130 | context.TreatProductAsModule = true; | 130 | context.KeepModularizationIds = true; |
131 | context.IntermediateFolder = intermediateFolder; | 131 | context.IntermediateFolder = intermediateFolder; |
132 | context.ExtractFolder = outputFolder; | 132 | context.ExtractFolder = outputFolder; |
133 | context.CabinetExtractFolder = outputFolder; | 133 | context.CabinetExtractFolder = outputFolder; |