diff options
author | Rob Mensching <rob@firegiant.com> | 2020-06-04 11:22:16 -0700 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2020-06-04 11:32:20 -0700 |
commit | 2c3793752060e50fe2049d860a8ccb4a2475414c (patch) | |
tree | 24cd612c3dd4f7a773b6328dfc1d28f983028712 /src | |
parent | f89238b23402e33c2fc09b13a02217f03b722216 (diff) | |
download | wix-2c3793752060e50fe2049d860a8ccb4a2475414c.tar.gz wix-2c3793752060e50fe2049d860a8ccb4a2475414c.tar.bz2 wix-2c3793752060e50fe2049d860a8ccb4a2475414c.zip |
Minor code cleanup
Diffstat (limited to 'src')
4 files changed, 36 insertions, 37 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs index 8887d4eb..a4b9be85 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs | |||
@@ -238,6 +238,14 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
238 | 238 | ||
239 | // This must occur after all variables and source paths have been resolved. | 239 | // This must occur after all variables and source paths have been resolved. |
240 | List<FileFacade> fileFacades; | 240 | List<FileFacade> fileFacades; |
241 | if (SectionType.Patch == section.Type) | ||
242 | { | ||
243 | var command = new GetFileFacadesFromTransforms(this.Messaging, this.FileSystemManager, this.SubStorages); | ||
244 | command.Execute(); | ||
245 | |||
246 | fileFacades = command.FileFacades; | ||
247 | } | ||
248 | else | ||
241 | { | 249 | { |
242 | var command = new GetFileFacadesCommand(section); | 250 | var command = new GetFileFacadesCommand(section); |
243 | command.Execute(); | 251 | command.Execute(); |
@@ -254,24 +262,12 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
254 | { | 262 | { |
255 | containsMergeModules = true; | 263 | containsMergeModules = true; |
256 | 264 | ||
257 | var command = new ExtractMergeModuleFilesCommand(this.Messaging, section, wixMergeTuples); | 265 | var command = new ExtractMergeModuleFilesCommand(this.Messaging, wixMergeTuples, fileFacades, installerVersion, this.IntermediateFolder, this.SuppressLayout); |
258 | command.FileFacades = fileFacades; | ||
259 | command.OutputInstallerVersion = installerVersion; | ||
260 | command.SuppressLayout = this.SuppressLayout; | ||
261 | command.IntermediateFolder = this.IntermediateFolder; | ||
262 | command.Execute(); | 266 | command.Execute(); |
263 | 267 | ||
264 | fileFacades.AddRange(command.MergeModulesFileFacades); | 268 | fileFacades.AddRange(command.MergeModulesFileFacades); |
265 | } | 269 | } |
266 | } | 270 | } |
267 | else if (SectionType.Patch == section.Type) | ||
268 | { | ||
269 | var command = new GetFileFacadesFromTransforms(this.Messaging, this.FileSystemManager, this.SubStorages); | ||
270 | command.Execute(); | ||
271 | var filesFromTransforms = command.FileFacades; | ||
272 | |||
273 | fileFacades.AddRange(filesFromTransforms); | ||
274 | } | ||
275 | 271 | ||
276 | // stop processing if an error previously occurred | 272 | // stop processing if an error previously occurred |
277 | if (this.Messaging.EncounteredError) | 273 | if (this.Messaging.EncounteredError) |
@@ -368,11 +364,6 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
368 | output.SubStorages.Add(storage); | 364 | output.SubStorages.Add(storage); |
369 | } | 365 | } |
370 | } | 366 | } |
371 | else // we can create instance transforms since Component Guids are set. | ||
372 | { | ||
373 | var command = new CreateInstanceTransformsCommand(section, output, tableDefinitions, this.BackendHelper); | ||
374 | command.Execute(); | ||
375 | } | ||
376 | 367 | ||
377 | #if TODO_FINISH_UPDATE | 368 | #if TODO_FINISH_UPDATE |
378 | // Extended binder extensions can be called now that fields are resolved. | 369 | // Extended binder extensions can be called now that fields are resolved. |
@@ -412,6 +403,13 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
412 | 403 | ||
413 | this.ValidateComponentGuids(output); | 404 | this.ValidateComponentGuids(output); |
414 | 405 | ||
406 | // We can create instance transforms since Component Guids and Outputs are created. | ||
407 | if (output.Type == OutputType.Product) | ||
408 | { | ||
409 | var command = new CreateInstanceTransformsCommand(section, output, tableDefinitions, this.BackendHelper); | ||
410 | command.Execute(); | ||
411 | } | ||
412 | |||
415 | // Stop processing if an error previously occurred. | 413 | // Stop processing if an error previously occurred. |
416 | if (this.Messaging.EncounteredError) | 414 | if (this.Messaging.EncounteredError) |
417 | { | 415 | { |
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs index 62f7fce3..792a13a9 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/ExtractMergeModuleFilesCommand.cs | |||
@@ -21,26 +21,27 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
21 | /// </summary> | 21 | /// </summary> |
22 | internal class ExtractMergeModuleFilesCommand | 22 | internal class ExtractMergeModuleFilesCommand |
23 | { | 23 | { |
24 | public ExtractMergeModuleFilesCommand(IMessaging messaging, IntermediateSection section, List<WixMergeTuple> wixMergeTuples) | 24 | public ExtractMergeModuleFilesCommand(IMessaging messaging, IEnumerable<WixMergeTuple> wixMergeTuples, IEnumerable<FileFacade> fileFacades, int installerVersion, string intermediateFolder, bool suppressLayout) |
25 | { | 25 | { |
26 | this.Messaging = messaging; | 26 | this.Messaging = messaging; |
27 | this.Section = section; | ||
28 | this.WixMergeTuples = wixMergeTuples; | 27 | this.WixMergeTuples = wixMergeTuples; |
28 | this.FileFacades = fileFacades; | ||
29 | this.OutputInstallerVersion = installerVersion; | ||
30 | this.IntermediateFolder = intermediateFolder; | ||
31 | this.SuppressLayout = suppressLayout; | ||
29 | } | 32 | } |
30 | 33 | ||
31 | private IMessaging Messaging { get; } | 34 | private IMessaging Messaging { get; } |
32 | 35 | ||
33 | private IntermediateSection Section { get; } | 36 | private IEnumerable<WixMergeTuple> WixMergeTuples { get; } |
34 | 37 | ||
35 | private List<WixMergeTuple> WixMergeTuples { get; } | 38 | private IEnumerable<FileFacade> FileFacades { get; } |
36 | 39 | ||
37 | public IEnumerable<FileFacade> FileFacades { private get; set; } | 40 | private int OutputInstallerVersion { get; } |
38 | 41 | ||
39 | public int OutputInstallerVersion { private get; set; } | 42 | private string IntermediateFolder { get; } |
40 | 43 | ||
41 | public bool SuppressLayout { private get; set; } | 44 | private bool SuppressLayout { get; } |
42 | |||
43 | public string IntermediateFolder { private get; set; } | ||
44 | 45 | ||
45 | public IEnumerable<FileFacade> MergeModulesFileFacades { get; private set; } | 46 | public IEnumerable<FileFacade> MergeModulesFileFacades { get; private set; } |
46 | 47 | ||
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/GetFileFacadesFromTransforms.cs b/src/WixToolset.Core.WindowsInstaller/Bind/GetFileFacadesFromTransforms.cs index 99bf7101..585bdac0 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/GetFileFacadesFromTransforms.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/GetFileFacadesFromTransforms.cs | |||
@@ -27,7 +27,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
27 | 27 | ||
28 | private IEnumerable<SubStorage> SubStorages { get; } | 28 | private IEnumerable<SubStorage> SubStorages { get; } |
29 | 29 | ||
30 | public IEnumerable<FileFacade> FileFacades { get; private set; } | 30 | public List<FileFacade> FileFacades { get; private set; } |
31 | 31 | ||
32 | public void Execute() | 32 | public void Execute() |
33 | { | 33 | { |
diff --git a/src/WixToolset.Core/Linker.cs b/src/WixToolset.Core/Linker.cs index 7b381347..fb1b2488 100644 --- a/src/WixToolset.Core/Linker.cs +++ b/src/WixToolset.Core/Linker.cs | |||
@@ -168,7 +168,7 @@ namespace WixToolset.Core | |||
168 | // references that particpate in groups. | 168 | // references that particpate in groups. |
169 | sections = resolve.ResolvedSections.ToList(); | 169 | sections = resolve.ResolvedSections.ToList(); |
170 | 170 | ||
171 | // TODO: consider filtering "localizations" down to only those localizations from | 171 | // TODO: consider filtering "localizations" down to only those localizations from |
172 | // intermediates in the sections. | 172 | // intermediates in the sections. |
173 | 173 | ||
174 | this.FlattenSectionsComplexReferences(sections); | 174 | this.FlattenSectionsComplexReferences(sections); |
@@ -261,8 +261,8 @@ namespace WixToolset.Core | |||
261 | if (WindowsInstallerStandard.IsStandardDirectory(directory)) | 261 | if (WindowsInstallerStandard.IsStandardDirectory(directory)) |
262 | { | 262 | { |
263 | // if the directory table contains references to standard windows folders | 263 | // if the directory table contains references to standard windows folders |
264 | // mergemod.dll will add customactions to set the MSM directory to | 264 | // mergemod.dll will add customactions to set the MSM directory to |
265 | // the same directory as the standard windows folder and will add references to | 265 | // the same directory as the standard windows folder and will add references to |
266 | // custom action to all the standard sequence tables. A problem will occur | 266 | // custom action to all the standard sequence tables. A problem will occur |
267 | // if the MSI does not have these tables as mergemod.dll does not add these | 267 | // if the MSI does not have these tables as mergemod.dll does not add these |
268 | // tables to the MSI if absent. This code adds the tables in case mergemod.dll | 268 | // tables to the MSI if absent. This code adds the tables in case mergemod.dll |
@@ -982,7 +982,7 @@ namespace WixToolset.Core | |||
982 | } | 982 | } |
983 | 983 | ||
984 | // If the child of the complex reference is another group, then in Step 2 | 984 | // If the child of the complex reference is another group, then in Step 2 |
985 | // we're going to have to process this complex reference again to copy | 985 | // we're going to have to process this complex reference again to copy |
986 | // the child group's references into the parent group. | 986 | // the child group's references into the parent group. |
987 | if ((ComplexReferenceChildType.ComponentGroup == wixComplexReferenceRow.ChildType) || | 987 | if ((ComplexReferenceChildType.ComponentGroup == wixComplexReferenceRow.ChildType) || |
988 | (ComplexReferenceChildType.FeatureGroup == wixComplexReferenceRow.ChildType) || | 988 | (ComplexReferenceChildType.FeatureGroup == wixComplexReferenceRow.ChildType) || |
@@ -1081,14 +1081,14 @@ namespace WixToolset.Core | |||
1081 | var childTypeAndId = this.CombineTypeAndId(wixComplexReferenceRow.ChildType, wixComplexReferenceRow.Child); | 1081 | var childTypeAndId = this.CombineTypeAndId(wixComplexReferenceRow.ChildType, wixComplexReferenceRow.Child); |
1082 | if (loopDetector.Contains(childTypeAndId)) | 1082 | if (loopDetector.Contains(childTypeAndId)) |
1083 | { | 1083 | { |
1084 | // Create a comma delimited list of the references that participate in the | 1084 | // Create a comma delimited list of the references that participate in the |
1085 | // loop for the error message. Start at the bottom of the stack and work the | 1085 | // loop for the error message. Start at the bottom of the stack and work the |
1086 | // way up to present the loop as a directed graph. | 1086 | // way up to present the loop as a directed graph. |
1087 | var loop = String.Join(" -> ", loopDetector); | 1087 | var loop = String.Join(" -> ", loopDetector); |
1088 | 1088 | ||
1089 | this.Messaging.Write(ErrorMessages.ReferenceLoopDetected(wixComplexReferenceRow?.SourceLineNumbers, loop)); | 1089 | this.Messaging.Write(ErrorMessages.ReferenceLoopDetected(wixComplexReferenceRow?.SourceLineNumbers, loop)); |
1090 | 1090 | ||
1091 | // Cleanup the parentGroupsNeedingProcessing and the loopDetector just like the | 1091 | // Cleanup the parentGroupsNeedingProcessing and the loopDetector just like the |
1092 | // exit of this method does at the end because we are exiting early. | 1092 | // exit of this method does at the end because we are exiting early. |
1093 | loopDetector.Pop(); | 1093 | loopDetector.Pop(); |
1094 | parentGroupsNeedingProcessing.Remove(parentTypeAndId); | 1094 | parentGroupsNeedingProcessing.Remove(parentTypeAndId); |
@@ -1097,7 +1097,7 @@ namespace WixToolset.Core | |||
1097 | } | 1097 | } |
1098 | 1098 | ||
1099 | // Check to see if the child group still needs to be processed. If so, | 1099 | // Check to see if the child group still needs to be processed. If so, |
1100 | // go do that so that we'll get all of that children's (and children's | 1100 | // go do that so that we'll get all of that children's (and children's |
1101 | // children) complex references correctly merged into our parent group. | 1101 | // children) complex references correctly merged into our parent group. |
1102 | if (parentGroupsNeedingProcessing.ContainsKey(childTypeAndId)) | 1102 | if (parentGroupsNeedingProcessing.ContainsKey(childTypeAndId)) |
1103 | { | 1103 | { |
@@ -1107,7 +1107,7 @@ namespace WixToolset.Core | |||
1107 | // If the child is a parent to anything (i.e. the parent has grandchildren) | 1107 | // If the child is a parent to anything (i.e. the parent has grandchildren) |
1108 | // clone each of the children's complex references, repoint them to the parent | 1108 | // clone each of the children's complex references, repoint them to the parent |
1109 | // complex reference (because we're moving references up the tree), and finally | 1109 | // complex reference (because we're moving references up the tree), and finally |
1110 | // add the cloned child's complex reference to the list of complex references | 1110 | // add the cloned child's complex reference to the list of complex references |
1111 | // that we'll eventually add to the parent group. | 1111 | // that we'll eventually add to the parent group. |
1112 | if (parentGroups.TryGetValue(childTypeAndId, out var referencesToChild)) | 1112 | if (parentGroups.TryGetValue(childTypeAndId, out var referencesToChild)) |
1113 | { | 1113 | { |
@@ -1148,7 +1148,7 @@ namespace WixToolset.Core | |||
1148 | } | 1148 | } |
1149 | else if (i > 0) | 1149 | else if (i > 0) |
1150 | { | 1150 | { |
1151 | // Since the list is already sorted, we can find duplicates by simply | 1151 | // Since the list is already sorted, we can find duplicates by simply |
1152 | // looking at the next sibling in the list and tossing out one if they | 1152 | // looking at the next sibling in the list and tossing out one if they |
1153 | // match. | 1153 | // match. |
1154 | var crefCompare = referencesToParent[i - 1]; | 1154 | var crefCompare = referencesToParent[i - 1]; |