Simplify BindDatabaseCommand by using WindowsInstallerBackendHelper
Rob Mensching committed
Mar 2, 2021 at 00:00 UTC
16c221a8663361ff29e140a0a395d3173daa0625
1 file changed
+10
-13
src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs
+10
-13
@@ -32,7 +32,6 @@ namespace WixToolset.Core.WindowsInstaller.Bind
32
33
this.Messaging = context.ServiceProvider.GetService<IMessaging>();
34
35
- this.BackendHelper = context.ServiceProvider.GetService<IBackendHelper>();
35
this.WindowsInstallerBackendHelper = context.ServiceProvider.GetService<IWindowsInstallerBackendHelper>();
36
37
this.PathResolver = this.ServiceProvider.GetService<IPathResolver>();
@@ -61,8 +60,6 @@ namespace WixToolset.Core.WindowsInstaller.Bind
60
61
private IMessaging Messaging { get; }
62
64
- private IBackendHelper BackendHelper { get; }
65
-
63
private IWindowsInstallerBackendHelper WindowsInstallerBackendHelper { get; }
64
65
private IPathResolver PathResolver { get; }
@@ -237,7 +234,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
234
235
// Extract files that come from binary .wixlibs and WixExtensions (this does not extract files from merge modules).
236
{
240
- var command = new ExtractEmbeddedFilesCommand(this.BackendHelper, this.ExpectedEmbeddedFiles);
237
+ var command = new ExtractEmbeddedFilesCommand(this.WindowsInstallerBackendHelper, this.ExpectedEmbeddedFiles);
238
command.Execute();
239
240
trackedFiles.AddRange(command.TrackedFiles);
@@ -371,7 +368,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
368
369
// Set generated component guids.
370
{
374
- var command = new CalculateComponentGuids(this.Messaging, this.BackendHelper, this.PathResolver, section, platform);
371
+ var command = new CalculateComponentGuids(this.Messaging, this.WindowsInstallerBackendHelper, this.PathResolver, section, platform);
372
command.Execute();
373
}
374
@@ -384,7 +381,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
381
Dictionary<MediaSymbol, IEnumerable<FileFacade>> filesByCabinetMedia;
382
IEnumerable<FileFacade> uncompressedFiles;
383
{
387
- var order = new OptimizeFileFacadesOrderCommand(this.BackendHelper, this.PathResolver, section, platform, fileFacades);
384
+ var order = new OptimizeFileFacadesOrderCommand(this.WindowsInstallerBackendHelper, this.PathResolver, section, platform, fileFacades);
385
order.Execute();
386
387
fileFacades = order.FileFacades;
@@ -457,7 +454,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
454
455
var mediaTemplate = section.Symbols.OfType<WixMediaTemplateSymbol>().FirstOrDefault();
456
460
- var command = new CreateCabinetsCommand(this.ServiceProvider, this.BackendHelper, mediaTemplate);
457
+ var command = new CreateCabinetsCommand(this.ServiceProvider, this.WindowsInstallerBackendHelper, mediaTemplate);
458
command.CabbingThreadCount = this.CabbingThreadCount;
459
command.CabCachePath = this.CabCachePath;
460
command.DefaultCompressionLevel = this.DefaultCompressionLevel;
@@ -486,7 +483,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
483
// We can create instance transforms since Component Guids and Outputs are created.
484
if (output.Type == OutputType.Product)
485
{
489
- var command = new CreateInstanceTransformsCommand(section, output, tableDefinitions, this.BackendHelper);
486
+ var command = new CreateInstanceTransformsCommand(section, output, tableDefinitions, this.WindowsInstallerBackendHelper);
487
command.Execute();
488
}
489
else if (output.Type == OutputType.Patch)
@@ -500,10 +497,10 @@ namespace WixToolset.Core.WindowsInstaller.Bind
497
this.Messaging.Write(VerboseMessages.GeneratingDatabase());
498
499
{
503
- var trackMsi = this.BackendHelper.TrackFile(this.OutputPath, TrackedFileType.Final);
500
+ var trackMsi = this.WindowsInstallerBackendHelper.TrackFile(this.OutputPath, TrackedFileType.Final);
501
trackedFiles.Add(trackMsi);
502
506
- var command = new GenerateDatabaseCommand(this.Messaging, this.BackendHelper, this.FileSystemManager, output, trackMsi.Path, tableDefinitions, this.IntermediateFolder, this.Codepage, keepAddedColumns: false, this.SuppressAddingValidationRows, useSubdirectory: false);
503
+ var command = new GenerateDatabaseCommand(this.Messaging, this.WindowsInstallerBackendHelper, this.FileSystemManager, output, trackMsi.Path, tableDefinitions, this.IntermediateFolder, this.Codepage, keepAddedColumns: false, this.SuppressAddingValidationRows, useSubdirectory: false);
504
command.Execute();
505
506
trackedFiles.AddRange(command.GeneratedTemporaryFiles);
@@ -556,7 +553,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
553
// Process uncompressed files.
554
if (!this.Messaging.EncounteredError && !this.SuppressLayout && uncompressedFiles.Any())
555
{
559
- var command = new ProcessUncompressedFilesCommand(section, this.BackendHelper, this.PathResolver);
556
+ var command = new ProcessUncompressedFilesCommand(section, this.WindowsInstallerBackendHelper, this.PathResolver);
557
command.Compressed = compressed;
558
command.FileFacades = uncompressedFiles;
559
command.LayoutDirectory = layoutDirectory;
@@ -570,7 +567,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
567
}
568
569
// TODO: this is not sufficient to collect all Input files (for example, it misses Binary and Icon tables).
573
- trackedFiles.AddRange(fileFacades.Select(f => this.BackendHelper.TrackFile(f.SourcePath, TrackedFileType.Input, f.SourceLineNumber)));
570
+ trackedFiles.AddRange(fileFacades.Select(f => this.WindowsInstallerBackendHelper.TrackFile(f.SourcePath, TrackedFileType.Input, f.SourceLineNumber)));
571
572
var result = this.ServiceProvider.GetService<IBindResult>();
573
result.FileTransfers = fileTransfers;
@@ -590,7 +587,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
587
}
588
else
589
{
593
- var trackPdb = this.BackendHelper.TrackFile(this.OutputPdbPath, TrackedFileType.Final);
590
+ var trackPdb = this.WindowsInstallerBackendHelper.TrackFile(this.OutputPdbPath, TrackedFileType.Final);
591
trackedFiles.Add(trackPdb);
592
593
wixout = WixOutput.Create(trackPdb.Path);