diff options
author | Bob Arnson <bob@firegiant.com> | 2023-06-29 21:16:35 -0400 |
---|---|---|
committer | Bob Arnson <bob@firegiant.com> | 2023-06-30 09:59:16 -0400 |
commit | 22dadeafca72b87e75ed697162fa33ccc85723dd (patch) | |
tree | 5b555562985047c0e60bc6080ce98bfa6e685b99 | |
parent | ed2a8d1468f58c734903ed9668700921d7deb32a (diff) | |
download | wix-22dadeafca72b87e75ed697162fa33ccc85723dd.tar.gz wix-22dadeafca72b87e75ed697162fa33ccc85723dd.tar.bz2 wix-22dadeafca72b87e75ed697162fa33ccc85723dd.zip |
Extract object fields with modularization GUIDs.
4 files changed, 30 insertions, 4 deletions
diff --git a/src/internal/WixInternal.TestSupport/XunitExtensions/WixAssert.cs b/src/internal/WixInternal.TestSupport/XunitExtensions/WixAssert.cs index 66f831a1..083e34f5 100644 --- a/src/internal/WixInternal.TestSupport/XunitExtensions/WixAssert.cs +++ b/src/internal/WixInternal.TestSupport/XunitExtensions/WixAssert.cs | |||
@@ -4,6 +4,7 @@ namespace WixInternal.TestSupport | |||
4 | { | 4 | { |
5 | using System; | 5 | using System; |
6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
7 | using System.IO; | ||
7 | using System.Linq; | 8 | using System.Linq; |
8 | using System.Text; | 9 | using System.Text; |
9 | using System.Xml.Linq; | 10 | using System.Xml.Linq; |
@@ -30,8 +31,8 @@ namespace WixInternal.TestSupport | |||
30 | 31 | ||
31 | public static void CompareXml(XContainer xExpected, XContainer xActual) | 32 | public static void CompareXml(XContainer xExpected, XContainer xActual) |
32 | { | 33 | { |
33 | var expecteds = xExpected.Descendants().Select(x => $"{x.Name.LocalName}:{String.Join(",", x.Attributes().OrderBy(a => a.Name.LocalName).Select(a => $"{a.Name.LocalName}={a.Value}"))}"); | 34 | var expecteds = ComparableElements(xExpected); |
34 | var actuals = xActual.Descendants().Select(x => $"{x.Name.LocalName}:{String.Join(",", x.Attributes().OrderBy(a => a.Name.LocalName).Select(a => $"{a.Name.LocalName}={a.Value}"))}"); | 35 | var actuals = ComparableElements(xActual); |
35 | 36 | ||
36 | CompareLineByLine(expecteds.OrderBy(s => s).ToArray(), actuals.OrderBy(s => s).ToArray()); | 37 | CompareLineByLine(expecteds.OrderBy(s => s).ToArray(), actuals.OrderBy(s => s).ToArray()); |
37 | } | 38 | } |
@@ -44,6 +45,22 @@ namespace WixInternal.TestSupport | |||
44 | CompareXml(expectedDoc, actualDoc); | 45 | CompareXml(expectedDoc, actualDoc); |
45 | } | 46 | } |
46 | 47 | ||
48 | private static IEnumerable<string> ComparableElements(XContainer container) | ||
49 | { | ||
50 | return container.Descendants().Select(x => $"{x.Name.LocalName}:{String.Join(",", x.Attributes().OrderBy(a => a.Name.LocalName).Select(a => $"{a.Name.LocalName}={ComparableAttribute(a)}"))}"); | ||
51 | } | ||
52 | |||
53 | private static string ComparableAttribute(XAttribute attribute) | ||
54 | { | ||
55 | switch (attribute.Name.LocalName) | ||
56 | { | ||
57 | case "SourceFile": | ||
58 | return "<SourceFile>"; | ||
59 | default: | ||
60 | return attribute.Value; | ||
61 | } | ||
62 | } | ||
63 | |||
47 | /// <summary> | 64 | /// <summary> |
48 | /// Dynamically skips the test. | 65 | /// Dynamically skips the test. |
49 | /// Requires that the test was marked with a fact attribute derived from <see cref="WixInternal.TestSupport.XunitExtensions.SkippableFactAttribute" /> | 66 | /// Requires that the test was marked with a fact attribute derived from <see cref="WixInternal.TestSupport.XunitExtensions.SkippableFactAttribute" /> |
diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Unbind/UnbindDatabaseCommand.cs b/src/wix/WixToolset.Core.WindowsInstaller/Unbind/UnbindDatabaseCommand.cs index 9ad936e4..cfa53269 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Unbind/UnbindDatabaseCommand.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Unbind/UnbindDatabaseCommand.cs | |||
@@ -146,6 +146,7 @@ namespace WixToolset.Core.WindowsInstaller.Unbind | |||
146 | { | 146 | { |
147 | View validationView = null; | 147 | View validationView = null; |
148 | string modularizationGuid = null; | 148 | string modularizationGuid = null; |
149 | string modularizationSuffix = null; | ||
149 | 150 | ||
150 | try | 151 | try |
151 | { | 152 | { |
@@ -204,6 +205,11 @@ namespace WixToolset.Core.WindowsInstaller.Unbind | |||
204 | { | 205 | { |
205 | source = Path.Combine(this.ExportBasePath, tableName, row.GetPrimaryKey('.')); | 206 | source = Path.Combine(this.ExportBasePath, tableName, row.GetPrimaryKey('.')); |
206 | 207 | ||
208 | if (!String.IsNullOrEmpty(modularizationSuffix)) | ||
209 | { | ||
210 | source += modularizationSuffix; | ||
211 | } | ||
212 | |||
207 | Directory.CreateDirectory(Path.Combine(this.ExportBasePath, tableName)); | 213 | Directory.CreateDirectory(Path.Combine(this.ExportBasePath, tableName)); |
208 | 214 | ||
209 | using (var fs = this.FileSystem.OpenFile(null, source, FileMode.Create, FileAccess.Write, FileShare.None)) | 215 | using (var fs = this.FileSystem.OpenFile(null, source, FileMode.Create, FileAccess.Write, FileShare.None)) |
@@ -238,6 +244,8 @@ namespace WixToolset.Core.WindowsInstaller.Unbind | |||
238 | if (null == modularizationGuid) | 244 | if (null == modularizationGuid) |
239 | { | 245 | { |
240 | var match = Modularization.Match(value); | 246 | var match = Modularization.Match(value); |
247 | modularizationSuffix = match.Value; | ||
248 | |||
241 | if (match.Success) | 249 | if (match.Success) |
242 | { | 250 | { |
243 | modularizationGuid = String.Concat('{', match.Value.Substring(1).Replace('_', '-'), '}'); | 251 | modularizationGuid = String.Concat('{', match.Value.Substring(1).Replace('_', '-'), '}'); |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DecompileTargetDirMergeModule/Expected.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DecompileTargetDirMergeModule/Expected.wxs index 4a89f56b..501daabb 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DecompileTargetDirMergeModule/Expected.wxs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DecompileTargetDirMergeModule/Expected.wxs | |||
@@ -1,6 +1,7 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | 2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> |
3 | <Module Codepage="65001" Id="MergeModule1" Language="1033" Version="1.0.0.0" InstallerVersion="200" Guid="{F844F0E3-8CB4-4A0F-973E-31C4F9338382}"> | 3 | <Module Codepage="65001" Id="MergeModule1" Language="1033" Version="1.0.0.0" InstallerVersion="200" Guid="{F844F0E3-8CB4-4A0F-973E-31C4F9338382}"> |
4 | <Binary Id="Binary1" SourceFile="Expected.wxs" /> | ||
4 | <StandardDirectory Id="ProgramFilesFolder"> | 5 | <StandardDirectory Id="ProgramFilesFolder"> |
5 | <Directory Id="WixTestDir" ShortName="7bhhvaai" Name="WiX Toolset Test Directory"> | 6 | <Directory Id="WixTestDir" ShortName="7bhhvaai" Name="WiX Toolset Test Directory"> |
6 | <Component Id="ModuleComponent1" Guid="{D86EC5A2-9576-4699-BDC3-00586FF72CBE}" Bitness="always32"> | 7 | <Component Id="ModuleComponent1" Guid="{D86EC5A2-9576-4699-BDC3-00586FF72CBE}" Bitness="always32"> |
@@ -20,4 +21,4 @@ | |||
20 | </Component> | 21 | </Component> |
21 | </StandardDirectory> | 22 | </StandardDirectory> |
22 | </Module> | 23 | </Module> |
23 | </Wix> \ No newline at end of file | 24 | </Wix> |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DecompileTargetDirMergeModule/MergeModule1.msm b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DecompileTargetDirMergeModule/MergeModule1.msm index a09cab20..227712a4 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DecompileTargetDirMergeModule/MergeModule1.msm +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DecompileTargetDirMergeModule/MergeModule1.msm | |||
Binary files differ | |||