diff options
author | Rob Mensching <rob@firegiant.com> | 2022-02-06 09:52:51 -0800 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2022-02-08 09:42:04 -0800 |
commit | 718dce937b6c8aa0abe309364d3f298d206f4aae (patch) | |
tree | 6b6cdae3b082cf267af1061602bba99362d00292 | |
parent | fe689d65adcb20c5f1cfc0eedfe75559c686adbb (diff) | |
download | wix-718dce937b6c8aa0abe309364d3f298d206f4aae.tar.gz wix-718dce937b6c8aa0abe309364d3f298d206f4aae.tar.bz2 wix-718dce937b6c8aa0abe309364d3f298d206f4aae.zip |
Fix several bugs with Merge Modules
7 files changed, 65 insertions, 32 deletions
diff --git a/src/wix/WixToolset.Core.Native/WixToolset.Core.Native.csproj b/src/wix/WixToolset.Core.Native/WixToolset.Core.Native.csproj index 619b85b6..30c0b845 100644 --- a/src/wix/WixToolset.Core.Native/WixToolset.Core.Native.csproj +++ b/src/wix/WixToolset.Core.Native/WixToolset.Core.Native.csproj | |||
@@ -24,16 +24,11 @@ | |||
24 | <ProjectReference Include="..\wixnative\wixnative.vcxproj" ReferenceOutputAssembly="false" PrivateAssets="All" Properties="Platform=x64" /> | 24 | <ProjectReference Include="..\wixnative\wixnative.vcxproj" ReferenceOutputAssembly="false" PrivateAssets="All" Properties="Platform=x64" /> |
25 | </ItemGroup> | 25 | </ItemGroup> |
26 | 26 | ||
27 | <!-- Copy the x86 binaries for unittests (especially CI) but use x64 binaries when in NCrunch --> | 27 | <!-- Copy the x64 binaries for unittests since we've standardized on VS2022 (which is 64-bit only) --> |
28 | <ItemGroup Condition=" '$(NCrunch)'=='' "> | 28 | <ItemGroup> |
29 | <None Include="..\wixnative\Win32\mergemod.dll" CopyToOutputDirectory="PreserveNewest" /> | 29 | <None Include="..\wixnative\x64\mergemod.dll" CopyToOutputDirectory="PreserveNewest" /> |
30 | <None Include="$(BaseOutputPath)$(Configuration)\x86\wixnative.exe" CopyToOutputDirectory="PreserveNewest" /> | 30 | <None Include="$(BaseOutputPath)$(Configuration)\x64\wixnative.exe" CopyToOutputDirectory="PreserveNewest" /> |
31 | <None Include="$(BaseOutputPath)$(Configuration)\x86\wixnative.pdb" CopyToOutputDirectory="PreserveNewest" /> | 31 | <None Include="$(BaseOutputPath)$(Configuration)\x64\wixnative.pdb" CopyToOutputDirectory="PreserveNewest" /> |
32 | </ItemGroup> | ||
33 | <ItemGroup Condition=" '$(NCrunch)'=='1' "> | ||
34 | <None Include="$(NCrunchOriginalProjectDir)..\wixnative\x64\mergemod.dll" CopyToOutputDirectory="PreserveNewest" /> | ||
35 | <None Include="$(NCrunchOriginalProjectDir)..\..\..\build\$(SegmentName)\$(Configuration)\x86\wixnative.exe" CopyToOutputDirectory="PreserveNewest" /> | ||
36 | <None Include="$(NCrunchOriginalProjectDir)..\..\..\build\$(SegmentName)\$(Configuration)\x86\wixnative.pdb" CopyToOutputDirectory="PreserveNewest" /> | ||
37 | </ItemGroup> | 32 | </ItemGroup> |
38 | 33 | ||
39 | <ItemGroup> | 34 | <ItemGroup> |
diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs b/src/wix/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs index 7c1e085c..aac4dd4f 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs | |||
@@ -91,17 +91,22 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
91 | { | 91 | { |
92 | var uniqueModuleFileIdentifiers = new Dictionary<string, IFileFacade>(StringComparer.OrdinalIgnoreCase); | 92 | var uniqueModuleFileIdentifiers = new Dictionary<string, IFileFacade>(StringComparer.OrdinalIgnoreCase); |
93 | 93 | ||
94 | using (var view = db.OpenExecuteView("SELECT `File`, `Directory_` FROM `File`, `Component` WHERE `Component_`=`Component`")) | 94 | using (var view = db.OpenExecuteView("SELECT `File`, `Component_`, `FileName`, `Directory_` FROM `File`, `Component` WHERE `Component_`=`Component`")) |
95 | { | 95 | { |
96 | // add each file row from the merge module into the file row collection (check for errors along the way) | 96 | // add each file row from the merge module into the file row collection (check for errors along the way) |
97 | foreach (var record in view.Records) | 97 | foreach (var record in view.Records) |
98 | { | 98 | { |
99 | var splitFilename = this.BackendHelper.SplitMsiFileName(record[3]); | ||
100 | |||
99 | // NOTE: this is very tricky - the merge module file rows are not added to the | 101 | // NOTE: this is very tricky - the merge module file rows are not added to the |
100 | // file table because they should not be created via idt import. Instead, these | 102 | // file table because they should not be created via idt import. Instead, these |
101 | // rows are created by merging in the actual modules. | 103 | // rows are created by merging in the actual modules. |
102 | var fileSymbol = new FileSymbol(wixMergeRow.SourceLineNumbers, new Identifier(AccessModifier.Section, record[1])); | 104 | var fileSymbol = new FileSymbol(wixMergeRow.SourceLineNumbers, new Identifier(AccessModifier.Section, record[1])); |
103 | fileSymbol.Attributes = wixMergeRow.FileAttributes; | 105 | fileSymbol.Attributes = wixMergeRow.FileAttributes; |
104 | fileSymbol.DirectoryRef = record[2]; | 106 | fileSymbol.ComponentRef = record[2]; |
107 | fileSymbol.Name = splitFilename[1] ?? splitFilename[0]; | ||
108 | fileSymbol.ShortName = splitFilename[1] is null ? null : splitFilename[0]; | ||
109 | fileSymbol.DirectoryRef = record[4]; | ||
105 | fileSymbol.DiskId = wixMergeRow.DiskId; | 110 | fileSymbol.DiskId = wixMergeRow.DiskId; |
106 | fileSymbol.Source = new IntermediateFieldPathValue { Path = Path.Combine(this.IntermediateFolder, wixMergeRow.Id.Id, record[1]) }; | 111 | fileSymbol.Source = new IntermediateFieldPathValue { Path = Path.Combine(this.IntermediateFolder, wixMergeRow.Id.Id, record[1]) }; |
107 | 112 | ||
diff --git a/src/wix/WixToolset.Core.WindowsInstaller/Bind/UpdateMediaSequencesCommand.cs b/src/wix/WixToolset.Core.WindowsInstaller/Bind/UpdateMediaSequencesCommand.cs index affec09f..e0ed56b1 100644 --- a/src/wix/WixToolset.Core.WindowsInstaller/Bind/UpdateMediaSequencesCommand.cs +++ b/src/wix/WixToolset.Core.WindowsInstaller/Bind/UpdateMediaSequencesCommand.cs | |||
@@ -68,7 +68,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
68 | 68 | ||
69 | patchGroup.Add(facade); | 69 | patchGroup.Add(facade); |
70 | } | 70 | } |
71 | else if (!facade.FromModule) | 71 | else |
72 | { | 72 | { |
73 | facade.Sequence = ++lastSequence; | 73 | facade.Sequence = ++lastSequence; |
74 | } | 74 | } |
diff --git a/src/wix/WixToolset.Core/Compiler_Module.cs b/src/wix/WixToolset.Core/Compiler_Module.cs index 3986c8da..7b708981 100644 --- a/src/wix/WixToolset.Core/Compiler_Module.cs +++ b/src/wix/WixToolset.Core/Compiler_Module.cs | |||
@@ -249,7 +249,7 @@ namespace WixToolset.Core | |||
249 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | 249 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) |
250 | { | 250 | { |
251 | PropertyId = SummaryInformationType.Keywords, | 251 | PropertyId = SummaryInformationType.Keywords, |
252 | Value = "Installer" | 252 | Value = "MergeModule, MSI, database" |
253 | }); | 253 | }); |
254 | } | 254 | } |
255 | 255 | ||
@@ -266,6 +266,24 @@ namespace WixToolset.Core | |||
266 | Value = moduleId | 266 | Value = moduleId |
267 | }); | 267 | }); |
268 | 268 | ||
269 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
270 | { | ||
271 | PropertyId = SummaryInformationType.Title, | ||
272 | Value = "Merge Module" | ||
273 | }); | ||
274 | |||
275 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
276 | { | ||
277 | PropertyId = SummaryInformationType.WordCount, | ||
278 | Value = "0" | ||
279 | }); | ||
280 | |||
281 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
282 | { | ||
283 | PropertyId = SummaryInformationType.Comments, | ||
284 | Value = String.Format(CultureInfo.InvariantCulture, "This merge module contains the logic and data required to install {0}.", this.activeName) | ||
285 | }); | ||
286 | |||
269 | this.ValidateAndAddCommonSummaryInformationSymbols(sourceLineNumbers, msiVersion, platform, this.activeLanguage); | 287 | this.ValidateAndAddCommonSummaryInformationSymbols(sourceLineNumbers, msiVersion, platform, this.activeLanguage); |
270 | } | 288 | } |
271 | } | 289 | } |
diff --git a/src/wix/WixToolset.Core/Compiler_Package.cs b/src/wix/WixToolset.Core/Compiler_Package.cs index d3db2e80..d969decb 100644 --- a/src/wix/WixToolset.Core/Compiler_Package.cs +++ b/src/wix/WixToolset.Core/Compiler_Package.cs | |||
@@ -182,6 +182,18 @@ namespace WixToolset.Core | |||
182 | this.AddProperty(sourceLineNumbers, new Identifier(AccessModifier.Global, "ALLUSERS"), "1", false, false, false, false); | 182 | this.AddProperty(sourceLineNumbers, new Identifier(AccessModifier.Global, "ALLUSERS"), "1", false, false, false, false); |
183 | } | 183 | } |
184 | 184 | ||
185 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
186 | { | ||
187 | PropertyId = SummaryInformationType.Title, | ||
188 | Value = "Installation Database" | ||
189 | }); | ||
190 | |||
191 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
192 | { | ||
193 | PropertyId = SummaryInformationType.Comments, | ||
194 | Value = String.Format(CultureInfo.InvariantCulture, "This installer database contains the logic and data required to install {0}.", this.activeName) | ||
195 | }); | ||
196 | |||
185 | this.ValidateAndAddCommonSummaryInformationSymbols(sourceLineNumbers, msiVersion, platform, productLanguage); | 197 | this.ValidateAndAddCommonSummaryInformationSymbols(sourceLineNumbers, msiVersion, platform, productLanguage); |
186 | 198 | ||
187 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | 199 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) |
@@ -451,18 +463,6 @@ namespace WixToolset.Core | |||
451 | 463 | ||
452 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | 464 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) |
453 | { | 465 | { |
454 | PropertyId = SummaryInformationType.Comments, | ||
455 | Value = String.Format(CultureInfo.InvariantCulture, "This installer database contains the logic and data required to install {0}.", this.activeName) | ||
456 | }); | ||
457 | |||
458 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
459 | { | ||
460 | PropertyId = SummaryInformationType.Title, | ||
461 | Value = "Installation Database" | ||
462 | }); | ||
463 | |||
464 | this.Core.AddSymbol(new SummaryInformationSymbol(sourceLineNumbers) | ||
465 | { | ||
466 | PropertyId = SummaryInformationType.PlatformAndLanguage, | 466 | PropertyId = SummaryInformationType.PlatformAndLanguage, |
467 | Value = $"{platform};{language}" | 467 | Value = $"{platform};{language}" |
468 | }); | 468 | }); |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs index 7489bb47..2b3bfc88 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs | |||
@@ -834,9 +834,10 @@ namespace WixToolsetTest.CoreIntegration | |||
834 | } | 834 | } |
835 | } | 835 | } |
836 | 836 | ||
837 | [Fact(Skip = "Test fails in new repo")] | 837 | [Fact] |
838 | public void CanMergeModule() | 838 | public void CanMergeModule() |
839 | { | 839 | { |
840 | var msmFolder = TestData.Get(@"TestData\SimpleModule"); | ||
840 | var folder = TestData.Get(@"TestData\SimpleMerge"); | 841 | var folder = TestData.Get(@"TestData\SimpleMerge"); |
841 | 842 | ||
842 | using (var fs = new DisposableFileSystem()) | 843 | using (var fs = new DisposableFileSystem()) |
@@ -845,12 +846,24 @@ namespace WixToolsetTest.CoreIntegration | |||
845 | var msiPath = Path.Combine(intermediateFolder, @"bin\test.msi"); | 846 | var msiPath = Path.Combine(intermediateFolder, @"bin\test.msi"); |
846 | var cabPath = Path.Combine(intermediateFolder, @"bin\cab1.cab"); | 847 | var cabPath = Path.Combine(intermediateFolder, @"bin\cab1.cab"); |
847 | 848 | ||
849 | var msmResult = WixRunner.Execute(new[] | ||
850 | { | ||
851 | "build", | ||
852 | Path.Combine(msmFolder, "Module.wxs"), | ||
853 | "-loc", Path.Combine(msmFolder, "Module.en-us.wxl"), | ||
854 | "-bindpath", Path.Combine(msmFolder, "data"), | ||
855 | "-intermediateFolder", intermediateFolder, | ||
856 | "-o", Path.Combine(intermediateFolder, "bin", "test", "test.msm") | ||
857 | }); | ||
858 | |||
859 | msmResult.AssertSuccess(); | ||
860 | |||
848 | var result = WixRunner.Execute(new[] | 861 | var result = WixRunner.Execute(new[] |
849 | { | 862 | { |
850 | "build", | 863 | "build", |
851 | Path.Combine(folder, "Package.wxs"), | 864 | Path.Combine(folder, "Package.wxs"), |
852 | "-loc", Path.Combine(folder, "Package.en-us.wxl"), | 865 | "-loc", Path.Combine(folder, "Package.en-us.wxl"), |
853 | "-bindpath", Path.Combine(folder, ".data"), | 866 | "-bindpath", Path.Combine(intermediateFolder, "bin", "test"), |
854 | "-intermediateFolder", intermediateFolder, | 867 | "-intermediateFolder", intermediateFolder, |
855 | "-o", msiPath | 868 | "-o", msiPath |
856 | }); | 869 | }); |
@@ -870,13 +883,15 @@ namespace WixToolsetTest.CoreIntegration | |||
870 | var results = Query.QueryDatabase(msiPath, new[] { "File" }); | 883 | var results = Query.QueryDatabase(msiPath, new[] { "File" }); |
871 | WixAssert.CompareLineByLine(new[] | 884 | WixAssert.CompareLineByLine(new[] |
872 | { | 885 | { |
873 | "File:filyIq8rqcxxf903Hsn5K9L0SWV73g.243FB739_4D05_472F_9CFB_EF6B1017B6DE\tModuleComponent.243FB739_4D05_472F_9CFB_EF6B1017B6DE\ttest.txt\t17\t\t\t512\t0" | 886 | "File:File1.243FB739_4D05_472F_9CFB_EF6B1017B6DE\tModuleComponent1.243FB739_4D05_472F_9CFB_EF6B1017B6DE\tfile1.txt\t17\t\t\t512\t1", |
887 | "File:File2.243FB739_4D05_472F_9CFB_EF6B1017B6DE\tModuleComponent2.243FB739_4D05_472F_9CFB_EF6B1017B6DE\tfile2.txt\t17\t\t\t512\t2", | ||
874 | }, results); | 888 | }, results); |
875 | 889 | ||
876 | var files = Query.GetCabinetFiles(cabPath); | 890 | var files = Query.GetCabinetFiles(cabPath); |
877 | WixAssert.CompareLineByLine(new[] | 891 | WixAssert.CompareLineByLine(new[] |
878 | { | 892 | { |
879 | "filyIq8rqcxxf903Hsn5K9L0SWV73g.243FB739_4D05_472F_9CFB_EF6B1017B6DE" | 893 | "File1.243FB739_4D05_472F_9CFB_EF6B1017B6DE", |
894 | "File2.243FB739_4D05_472F_9CFB_EF6B1017B6DE" | ||
880 | }, files.Select(f => f.Name).ToArray()); | 895 | }, files.Select(f => f.Name).ToArray()); |
881 | } | 896 | } |
882 | } | 897 | } |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModule/Module.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModule/Module.wxs index 8317e7af..0b0ce141 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModule/Module.wxs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/SimpleModule/Module.wxs | |||
@@ -4,13 +4,13 @@ | |||
4 | 4 | ||
5 | <Directory Id="MergeRedirectFolder"> | 5 | <Directory Id="MergeRedirectFolder"> |
6 | <Component Id="ModuleComponent1" Guid="A04E61B2-3ED4-4803-B2EB-4B773576FA45"> | 6 | <Component Id="ModuleComponent1" Guid="A04E61B2-3ED4-4803-B2EB-4B773576FA45"> |
7 | <File Id="File1" Source="test.txt" /> | 7 | <File Id="File1" Name="file1.txt" Source="test.txt" /> |
8 | </Component> | 8 | </Component> |
9 | </Directory> | 9 | </Directory> |
10 | 10 | ||
11 | <Directory Id="NotTheMergeRedirectFolder"> | 11 | <Directory Id="NotTheMergeRedirectFolder"> |
12 | <Component Id="ModuleComponent2" Guid="EADB3047-BD32-417B-AABF-B8D9CCDC22DA"> | 12 | <Component Id="ModuleComponent2" Guid="EADB3047-BD32-417B-AABF-B8D9CCDC22DA"> |
13 | <File Id="File2" Source="test.txt" /> | 13 | <File Id="File2" Name="file2.txt" Source="test.txt" /> |
14 | </Component> | 14 | </Component> |
15 | </Directory> | 15 | </Directory> |
16 | </Module> | 16 | </Module> |