Rename IWindowsInstallerDecompileContext...
...TreatProductAsModule to KeepModularizationIds to better describe what it does. Fixes https://github.com/wixtoolset/issues/issues/7607.
Bob Arnson committed
Dec 31, 2023 at 17:08 UTC
d56481c18f831991cc36d9720e06ce6874f1bea1
6 files changed
+11
-19
src/api/wix/WixToolset.Extensibility/Data/IWindowsInstallerDecompileContext.cs
+1
-1
@@ -96,6 +96,6 @@ namespace WixToolset.Extensibility.Data
96
/// Gets or sets whether the decompiler should keep modularization
97
/// GUIDs (true) or remove them (default/false).
98
/// </summary>
99
- bool TreatProductAsModule { get; set; }
99
+ bool KeepModularizationIds { get; set; }
100
}
101
}
src/wix/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs
+4
-4
@@ -43,7 +43,7 @@ namespace WixToolset.Core.WindowsInstaller.Decompile
43
/// <summary>
44
/// Creates a new decompiler object with a default set of table definitions.
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
{
48
this.Messaging = messaging;
49
this.BackendHelper = backendHelper;
@@ -56,7 +56,7 @@ namespace WixToolset.Core.WindowsInstaller.Decompile
56
this.SuppressDroppingEmptyTables = suppressDroppingEmptyTables;
57
this.SuppressRelativeActionSequencing = suppressRelativeActionSequencing;
58
this.SuppressUI = suppressUI;
59
- this.TreatProductAsModule = treatProductAsModule;
59
+ this.KeepModularizationIds = keepModularizationIds;
60
61
this.ExtensionsByTableName = new Dictionary<string, IWindowsInstallerDecompilerExtension>();
62
this.StandardActions = WindowsInstallerStandard.StandardActions().ToDictionary(a => a.Id.Id);
@@ -88,7 +88,7 @@ namespace WixToolset.Core.WindowsInstaller.Decompile
88
89
private bool SuppressUI { get; }
90
91
- private bool TreatProductAsModule { get; }
91
+ private bool KeepModularizationIds { get; }
92
93
private OutputType OutputType { get; set; }
94
@@ -1188,7 +1188,7 @@ namespace WixToolset.Core.WindowsInstaller.Decompile
1188
var fileName = xFile?.Attribute("Name")?.Value;
1189
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
{
1193
xFile.SetAttributeValue("Source", String.Concat(this.BaseSourcePath, Path.DirectorySeparatorChar, "File", Path.DirectorySeparatorChar, fileId, '.', this.ModularizationGuid.Substring(1, 36).Replace('-', '_')));
1194
}
src/wix/WixToolset.Core.WindowsInstaller/Melter.cs
+1
-1
@@ -85,7 +85,7 @@ namespace WixToolset
85
PreDecompile(wixout);
86
87
wixout.Type = OutputType.Package;
88
- this.decompiler.TreatProductAsModule = true;
88
+ this.decompiler.KeepModularizationIds = true;
89
Wix.Wix wix = this.decompiler.Decompile(wixout);
90
91
if (null == wix)
src/wix/WixToolset.Core.WindowsInstaller/WindowsInstallerDecompileContext.cs
+1
-1
@@ -49,6 +49,6 @@ namespace WixToolset.Core.WindowsInstaller
49
50
public bool SuppressUI { get; set; }
51
52
- public bool TreatProductAsModule { get; set; }
52
+ public bool KeepModularizationIds { get; set; }
53
}
54
}
src/wix/WixToolset.Core.WindowsInstaller/WindowsInstallerDecompiler.cs
+2
-10
@@ -94,21 +94,13 @@ namespace WixToolset.Core.WindowsInstaller
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;
96
97
- // IWindowsInstallerDecompileContext.TreatProductAsModule is broken. So broken, in fact,
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;
97
+ var demodularize = !context.KeepModularizationIds;
98
var sectionType = context.DecompileType;
99
var unbindCommand = new UnbindDatabaseCommand(this.Messaging, backendHelper, fileSystem, pathResolver, context.DecompilePath, null, sectionType, context.ExtractFolder, extractFilesFolder, context.IntermediateFolder, demodularize, skipSummaryInfo: false);
100
var output = unbindCommand.Execute();
101
var extractedFilePaths = unbindCommand.ExportedFiles;
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);
104
var document = decompiler.Decompile(output);
105
106
var result = context.ServiceProvider.GetService<IWindowsInstallerDecompileResult>();
src/wix/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs
+2
-2
@@ -108,7 +108,7 @@ namespace WixToolsetTest.CoreIntegration
108
}
109
110
[Fact]
111
- public void CanDecompileMergeModuleWithTreatProductAsModule()
111
+ public void CanDecompileMergeModuleWithKeepModularizationIds()
112
{
113
using (var fs = new DisposableFileSystem())
114
{
@@ -127,7 +127,7 @@ namespace WixToolsetTest.CoreIntegration
127
context.ExtensionData = extensionManager.GetServices<IExtensionData>();
128
context.DecompilePath = Path.Combine(sourceFolder, "MergeModule1.msm");
129
context.DecompileType = OutputType.Module;
130
- context.TreatProductAsModule = true;
130
+ context.KeepModularizationIds = true;
131
context.IntermediateFolder = intermediateFolder;
132
context.ExtractFolder = outputFolder;
133
context.CabinetExtractFolder = outputFolder;