diff options
Diffstat (limited to 'src')
7 files changed, 47 insertions, 22 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs index c9659287..5c84a82f 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs | |||
| @@ -134,7 +134,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 134 | bool compressed; | 134 | bool compressed; |
| 135 | bool longNames; | 135 | bool longNames; |
| 136 | int installerVersion; | 136 | int installerVersion; |
| 137 | string modularizationGuid; | 137 | string modularizationSuffix; |
| 138 | { | 138 | { |
| 139 | var command = new BindSummaryInfoCommand(section); | 139 | var command = new BindSummaryInfoCommand(section); |
| 140 | command.Execute(); | 140 | command.Execute(); |
| @@ -142,7 +142,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 142 | compressed = command.Compressed; | 142 | compressed = command.Compressed; |
| 143 | longNames = command.LongNames; | 143 | longNames = command.LongNames; |
| 144 | installerVersion = command.InstallerVersion; | 144 | installerVersion = command.InstallerVersion; |
| 145 | modularizationGuid = command.ModularizationGuid; | 145 | modularizationSuffix = command.ModularizationSuffix; |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | // Add binder variables for all properties. | 148 | // Add binder variables for all properties. |
| @@ -362,7 +362,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 362 | // Modularize identifiers. | 362 | // Modularize identifiers. |
| 363 | if (OutputType.Module == output.Type) | 363 | if (OutputType.Module == output.Type) |
| 364 | { | 364 | { |
| 365 | var command = new ModularizeCommand(output, modularizationGuid, section.Tuples.OfType<WixSuppressModularizationTuple>()); | 365 | var command = new ModularizeCommand(output, modularizationSuffix, section.Tuples.OfType<WixSuppressModularizationTuple>()); |
| 366 | command.Execute(); | 366 | command.Execute(); |
| 367 | } | 367 | } |
| 368 | else if (output.Type == OutputType.Patch) | 368 | else if (output.Type == OutputType.Patch) |
| @@ -448,6 +448,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 448 | command.BackendExtensions = this.BackendExtensions; | 448 | command.BackendExtensions = this.BackendExtensions; |
| 449 | command.LayoutDirectory = layoutDirectory; | 449 | command.LayoutDirectory = layoutDirectory; |
| 450 | command.Compressed = compressed; | 450 | command.Compressed = compressed; |
| 451 | command.ModularizationSuffix = modularizationSuffix; | ||
| 451 | command.FileRowsByCabinet = filesByCabinetMedia; | 452 | command.FileRowsByCabinet = filesByCabinetMedia; |
| 452 | command.ResolveMedia = this.ResolveMedia; | 453 | command.ResolveMedia = this.ResolveMedia; |
| 453 | command.TableDefinitions = tableDefinitions; | 454 | command.TableDefinitions = tableDefinitions; |
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/BindSummaryInfoCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/BindSummaryInfoCommand.cs index 6483f0fc..d5806fee 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/BindSummaryInfoCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/BindSummaryInfoCommand.cs | |||
| @@ -35,14 +35,14 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 35 | /// <summary> | 35 | /// <summary> |
| 36 | /// Modularization guid, or null if the output is not a module. | 36 | /// Modularization guid, or null if the output is not a module. |
| 37 | /// </summary> | 37 | /// </summary> |
| 38 | public string ModularizationGuid { get; private set; } | 38 | public string ModularizationSuffix { get; private set; } |
| 39 | 39 | ||
| 40 | public void Execute() | 40 | public void Execute() |
| 41 | { | 41 | { |
| 42 | this.Compressed = false; | 42 | this.Compressed = false; |
| 43 | this.LongNames = false; | 43 | this.LongNames = false; |
| 44 | this.InstallerVersion = 0; | 44 | this.InstallerVersion = 0; |
| 45 | this.ModularizationGuid = null; | 45 | this.ModularizationSuffix = null; |
| 46 | 46 | ||
| 47 | var foundCreateDataTime = false; | 47 | var foundCreateDataTime = false; |
| 48 | var foundLastSaveDataTime = false; | 48 | var foundLastSaveDataTime = false; |
| @@ -71,7 +71,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 71 | 71 | ||
| 72 | if (SectionType.Module == this.Section.Type) | 72 | if (SectionType.Module == this.Section.Type) |
| 73 | { | 73 | { |
| 74 | this.ModularizationGuid = packageCode.Substring(1, 36).Replace('-', '_'); | 74 | this.ModularizationSuffix = "." + packageCode.Substring(1, 36).Replace('-', '_'); |
| 75 | } | 75 | } |
| 76 | else if ("*" == packageCode) | 76 | else if ("*" == packageCode) |
| 77 | { | 77 | { |
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/CabinetBuilder.cs b/src/WixToolset.Core.WindowsInstaller/Bind/CabinetBuilder.cs index f70548d9..5f19fd2a 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/CabinetBuilder.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/CabinetBuilder.cs | |||
| @@ -166,8 +166,8 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 166 | 166 | ||
| 167 | var files = cabinetWorkItem.FileFacades | 167 | var files = cabinetWorkItem.FileFacades |
| 168 | .Select(facade => facade.Hash == null ? | 168 | .Select(facade => facade.Hash == null ? |
| 169 | new CabinetCompressFile(facade.SourcePath, facade.Id) : | 169 | new CabinetCompressFile(facade.SourcePath, facade.Id + cabinetWorkItem.ModularizationSuffix) : |
| 170 | new CabinetCompressFile(facade.SourcePath, facade.Id, facade.Hash.HashPart1, facade.Hash.HashPart2, facade.Hash.HashPart3, facade.Hash.HashPart4)) | 170 | new CabinetCompressFile(facade.SourcePath, facade.Id + cabinetWorkItem.ModularizationSuffix, facade.Hash.HashPart1, facade.Hash.HashPart2, facade.Hash.HashPart3, facade.Hash.HashPart4)) |
| 171 | .ToList(); | 171 | .ToList(); |
| 172 | 172 | ||
| 173 | var cab = new Cabinet(cabinetPath); | 173 | var cab = new Cabinet(cabinetPath); |
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/CabinetWorkItem.cs b/src/WixToolset.Core.WindowsInstaller/Bind/CabinetWorkItem.cs index 405b840b..760b5fb9 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/CabinetWorkItem.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/CabinetWorkItem.cs | |||
| @@ -25,9 +25,11 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 25 | /// <param name="compressionLevel">The compression level of the cabinet.</param> | 25 | /// <param name="compressionLevel">The compression level of the cabinet.</param> |
| 26 | /// <param name="binderFileManager">The binder file manager.</param> | 26 | /// <param name="binderFileManager">The binder file manager.</param> |
| 27 | public CabinetWorkItem(IEnumerable<FileFacade> fileFacades, string cabinetFile, int maxThreshold, CompressionLevel compressionLevel /*, BinderFileManager binderFileManager*/) | 27 | public CabinetWorkItem(IEnumerable<FileFacade> fileFacades, string cabinetFile, int maxThreshold, CompressionLevel compressionLevel /*, BinderFileManager binderFileManager*/) |
| 28 | public CabinetWorkItem(IEnumerable<FileFacade> fileFacades, string cabinetFile, int maxThreshold, CompressionLevel compressionLevel, string modularizationSuffix /*, BinderFileManager binderFileManager*/) | ||
| 28 | { | 29 | { |
| 29 | this.cabinetFile = cabinetFile; | 30 | this.cabinetFile = cabinetFile; |
| 30 | this.compressionLevel = compressionLevel; | 31 | this.compressionLevel = compressionLevel; |
| 32 | this.ModularizationSuffix = modularizationSuffix; | ||
| 31 | this.FileFacades = fileFacades; | 33 | this.FileFacades = fileFacades; |
| 32 | //this.binderFileManager = binderFileManager; | 34 | //this.binderFileManager = binderFileManager; |
| 33 | this.maxThreshold = maxThreshold; | 35 | this.maxThreshold = maxThreshold; |
| @@ -52,6 +54,11 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 52 | } | 54 | } |
| 53 | 55 | ||
| 54 | /// <summary> | 56 | /// <summary> |
| 57 | /// Gets the modularization suffix used when building a Merge Module. | ||
| 58 | /// </summary> | ||
| 59 | public string ModularizationSuffix { get; } | ||
| 60 | |||
| 61 | /// <summary> | ||
| 55 | /// Gets the collection of files in this cabinet. | 62 | /// Gets the collection of files in this cabinet. |
| 56 | /// </summary> | 63 | /// </summary> |
| 57 | /// <value>The collection of files in this cabinet.</value> | 64 | /// <value>The collection of files in this cabinet.</value> |
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/CreateCabinetsCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/CreateCabinetsCommand.cs index 2536eeac..6852772e 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/CreateCabinetsCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/CreateCabinetsCommand.cs | |||
| @@ -75,6 +75,8 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 75 | 75 | ||
| 76 | public bool Compressed { private get; set; } | 76 | public bool Compressed { private get; set; } |
| 77 | 77 | ||
| 78 | public string ModularizationSuffix { private get; set; } | ||
| 79 | |||
| 78 | public Dictionary<MediaTuple, IEnumerable<FileFacade>> FileRowsByCabinet { private get; set; } | 80 | public Dictionary<MediaTuple, IEnumerable<FileFacade>> FileRowsByCabinet { private get; set; } |
| 79 | 81 | ||
| 80 | public Func<MediaTuple, string, string, string> ResolveMedia { private get; set; } | 82 | public Func<MediaTuple, string, string, string> ResolveMedia { private get; set; } |
| @@ -214,9 +216,8 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 214 | // create a cabinet work item if it's not being skipped | 216 | // create a cabinet work item if it's not being skipped |
| 215 | if (CabinetBuildOption.BuildAndCopy == resolvedCabinet.BuildOption || CabinetBuildOption.BuildAndMove == resolvedCabinet.BuildOption) | 217 | if (CabinetBuildOption.BuildAndCopy == resolvedCabinet.BuildOption || CabinetBuildOption.BuildAndMove == resolvedCabinet.BuildOption) |
| 216 | { | 218 | { |
| 217 | int maxThreshold = 0; // default to the threshold for best smartcabbing (makes smallest cabinet). | 219 | // Default to the threshold for best smartcabbing (makes smallest cabinet). |
| 218 | 220 | cabinetWorkItem = new CabinetWorkItem(fileFacades, resolvedCabinet.Path, maxThreshold: 0, compressionLevel, this.ModularizationSuffix /*, this.FileManager*/); | |
| 219 | cabinetWorkItem = new CabinetWorkItem(fileFacades, resolvedCabinet.Path, maxThreshold, compressionLevel/*, this.FileManager*/); | ||
| 220 | } | 221 | } |
| 221 | else // reuse the cabinet from the cabinet cache. | 222 | else // reuse the cabinet from the cabinet cache. |
| 222 | { | 223 | { |
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/ModularizeCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/ModularizeCommand.cs index 64257ccf..8b459d69 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/ModularizeCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/ModularizeCommand.cs | |||
| @@ -15,10 +15,10 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 15 | 15 | ||
| 16 | internal class ModularizeCommand | 16 | internal class ModularizeCommand |
| 17 | { | 17 | { |
| 18 | public ModularizeCommand(WindowsInstallerData output, string modularizationGuid, IEnumerable<WixSuppressModularizationTuple> suppressTuples) | 18 | public ModularizeCommand(WindowsInstallerData output, string modularizationSuffix, IEnumerable<WixSuppressModularizationTuple> suppressTuples) |
| 19 | { | 19 | { |
| 20 | this.Output = output; | 20 | this.Output = output; |
| 21 | this.ModularizationGuid = modularizationGuid; | 21 | this.ModularizationSuffix = modularizationSuffix; |
| 22 | 22 | ||
| 23 | // Gather all the unique suppress modularization identifiers. | 23 | // Gather all the unique suppress modularization identifiers. |
| 24 | this.SuppressModularizationIdentifiers = new HashSet<string>(suppressTuples.Select(s => s.Id.Id)); | 24 | this.SuppressModularizationIdentifiers = new HashSet<string>(suppressTuples.Select(s => s.Id.Id)); |
| @@ -26,7 +26,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 26 | 26 | ||
| 27 | private WindowsInstallerData Output { get; } | 27 | private WindowsInstallerData Output { get; } |
| 28 | 28 | ||
| 29 | private string ModularizationGuid { get; } | 29 | private string ModularizationSuffix { get; } |
| 30 | 30 | ||
| 31 | private HashSet<string> SuppressModularizationIdentifiers { get; } | 31 | private HashSet<string> SuppressModularizationIdentifiers { get; } |
| 32 | 32 | ||
| @@ -129,7 +129,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 129 | // if we're not supposed to suppress modularization of this identifier | 129 | // if we're not supposed to suppress modularization of this identifier |
| 130 | if (!this.SuppressModularizationIdentifiers.Contains(fieldData)) | 130 | if (!this.SuppressModularizationIdentifiers.Contains(fieldData)) |
| 131 | { | 131 | { |
| 132 | fieldData = String.Concat(fieldData, ".", this.ModularizationGuid); | 132 | fieldData = String.Concat(fieldData, this.ModularizationSuffix); |
| 133 | } | 133 | } |
| 134 | break; | 134 | break; |
| 135 | 135 | ||
| @@ -178,8 +178,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 178 | var identifier = group.Value; | 178 | var identifier = group.Value; |
| 179 | if (!WindowsInstallerStandard.IsStandardProperty(identifier) && !this.SuppressModularizationIdentifiers.Contains(identifier)) | 179 | if (!WindowsInstallerStandard.IsStandardProperty(identifier) && !this.SuppressModularizationIdentifiers.Contains(identifier)) |
| 180 | { | 180 | { |
| 181 | sb.Insert(group.Index + group.Length, '.'); | 181 | sb.Insert(group.Index + group.Length, this.ModularizationSuffix); |
| 182 | sb.Insert(group.Index + group.Length + 1, this.ModularizationGuid); | ||
| 183 | } | 182 | } |
| 184 | } | 183 | } |
| 185 | } | 184 | } |
| @@ -193,7 +192,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 193 | if (!this.SuppressModularizationIdentifiers.Contains(fieldData) && | 192 | if (!this.SuppressModularizationIdentifiers.Contains(fieldData) && |
| 194 | 0 < fieldData.Length && !Char.IsDigit(fieldData, 0)) | 193 | 0 < fieldData.Length && !Char.IsDigit(fieldData, 0)) |
| 195 | { | 194 | { |
| 196 | fieldData = String.Concat(fieldData, ".", this.ModularizationGuid); | 195 | fieldData = String.Concat(fieldData, this.ModularizationSuffix); |
| 197 | } | 196 | } |
| 198 | break; | 197 | break; |
| 199 | 198 | ||
| @@ -203,11 +202,11 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 203 | var start = fieldData.LastIndexOf(".", StringComparison.Ordinal); | 202 | var start = fieldData.LastIndexOf(".", StringComparison.Ordinal); |
| 204 | if (-1 == start) | 203 | if (-1 == start) |
| 205 | { | 204 | { |
| 206 | fieldData = String.Concat(fieldData, ".", this.ModularizationGuid); | 205 | fieldData = String.Concat(fieldData, this.ModularizationSuffix); |
| 207 | } | 206 | } |
| 208 | else | 207 | else |
| 209 | { | 208 | { |
| 210 | fieldData = String.Concat(fieldData.Substring(0, start), ".", this.ModularizationGuid, fieldData.Substring(start)); | 209 | fieldData = String.Concat(fieldData.Substring(0, start), this.ModularizationSuffix, fieldData.Substring(start)); |
| 211 | } | 210 | } |
| 212 | } | 211 | } |
| 213 | break; | 212 | break; |
| @@ -218,7 +217,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 218 | { | 217 | { |
| 219 | if (!String.IsNullOrEmpty(keys[i])) | 218 | if (!String.IsNullOrEmpty(keys[i])) |
| 220 | { | 219 | { |
| 221 | keys[i] = String.Concat(keys[i], ".", this.ModularizationGuid); | 220 | keys[i] = String.Concat(keys[i], this.ModularizationSuffix); |
| 222 | } | 221 | } |
| 223 | } | 222 | } |
| 224 | 223 | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs b/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs index 5af256c1..075f7733 100644 --- a/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs | |||
| @@ -346,15 +346,32 @@ namespace WixToolsetTest.CoreIntegration | |||
| 346 | 346 | ||
| 347 | result.AssertSuccess(); | 347 | result.AssertSuccess(); |
| 348 | 348 | ||
| 349 | Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\test.msm"))); | 349 | var msmPath = Path.Combine(intermediateFolder, @"bin\test.msm"); |
| 350 | Assert.True(File.Exists(msmPath)); | ||
| 350 | Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\test.wixpdb"))); | 351 | Assert.True(File.Exists(Path.Combine(intermediateFolder, @"bin\test.wixpdb"))); |
| 351 | 352 | ||
| 352 | var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"bin\test.wixpdb")); | 353 | var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"bin\test.wixpdb")); |
| 353 | var section = intermediate.Sections.Single(); | 354 | var section = intermediate.Sections.Single(); |
| 354 | 355 | ||
| 355 | var fileTuple = section.Tuples.OfType<FileTuple>().Single(); | 356 | var fileTuple = section.Tuples.OfType<FileTuple>().Single(); |
| 357 | Assert.Equal("filyIq8rqcxxf903Hsn5K9L0SWV73g", fileTuple.Id.Id); | ||
| 356 | Assert.Equal(Path.Combine(folder, @"data\test.txt"), fileTuple[FileTupleFields.Source].AsPath().Path); | 358 | Assert.Equal(Path.Combine(folder, @"data\test.txt"), fileTuple[FileTupleFields.Source].AsPath().Path); |
| 357 | Assert.Equal(@"test.txt", fileTuple[FileTupleFields.Source].PreviousValue.AsPath().Path); | 359 | Assert.Equal(@"test.txt", fileTuple[FileTupleFields.Source].PreviousValue.AsPath().Path); |
| 360 | |||
| 361 | var data = WindowsInstallerData.Load(Path.Combine(intermediateFolder, @"bin\test.wixpdb")); | ||
| 362 | var fileRows = data.Tables["File"].Rows; | ||
| 363 | Assert.Equal(new[] | ||
| 364 | { | ||
| 365 | "filyIq8rqcxxf903Hsn5K9L0SWV73g.243FB739_4D05_472F_9CFB_EF6B1017B6DE" | ||
| 366 | }, fileRows.Select(r => r.FieldAsString(0)).ToArray()); | ||
| 367 | |||
| 368 | var cabPath = Path.Combine(intermediateFolder, "msm-test.cab"); | ||
| 369 | Query.ExtractStream(msmPath, "MergeModule.CABinet", cabPath); | ||
| 370 | var files = Query.GetCabinetFiles(cabPath); | ||
| 371 | Assert.Equal(new[] | ||
| 372 | { | ||
| 373 | "filyIq8rqcxxf903Hsn5K9L0SWV73g.243FB739_4D05_472F_9CFB_EF6B1017B6DE" | ||
| 374 | }, files.Select(f => Path.Combine(f.Path, f.Name)).ToArray()); | ||
| 358 | } | 375 | } |
| 359 | } | 376 | } |
| 360 | 377 | ||
