diff options
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs')
| -rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs | 52 |
1 files changed, 39 insertions, 13 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs index 9194c4c7..a7da13bb 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs | |||
| @@ -39,6 +39,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 39 | this.FileSystemExtensions = context.FileSystemExtensions; | 39 | this.FileSystemExtensions = context.FileSystemExtensions; |
| 40 | this.Intermediate = context.IntermediateRepresentation; | 40 | this.Intermediate = context.IntermediateRepresentation; |
| 41 | this.OutputPath = context.OutputPath; | 41 | this.OutputPath = context.OutputPath; |
| 42 | this.OutputPdbPath = context.OutputPdbPath; | ||
| 42 | this.IntermediateFolder = context.IntermediateFolder; | 43 | this.IntermediateFolder = context.IntermediateFolder; |
| 43 | this.Validator = validator; | 44 | this.Validator = validator; |
| 44 | 45 | ||
| @@ -71,6 +72,8 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 71 | 72 | ||
| 72 | private string OutputPath { get; } | 73 | private string OutputPath { get; } |
| 73 | 74 | ||
| 75 | private string OutputPdbPath { get; } | ||
| 76 | |||
| 74 | private bool SuppressAddingValidationRows { get; } | 77 | private bool SuppressAddingValidationRows { get; } |
| 75 | 78 | ||
| 76 | private bool SuppressLayout { get; } | 79 | private bool SuppressLayout { get; } |
| @@ -83,7 +86,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 83 | 86 | ||
| 84 | public IEnumerable<IFileTransfer> FileTransfers { get; private set; } | 87 | public IEnumerable<IFileTransfer> FileTransfers { get; private set; } |
| 85 | 88 | ||
| 86 | public IEnumerable<string> ContentFilePaths { get; private set; } | 89 | public IEnumerable<ITrackedFile> TrackedFiles { get; private set; } |
| 87 | 90 | ||
| 88 | public Pdb Pdb { get; private set; } | 91 | public Pdb Pdb { get; private set; } |
| 89 | 92 | ||
| @@ -92,6 +95,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 92 | var section = this.Intermediate.Sections.Single(); | 95 | var section = this.Intermediate.Sections.Single(); |
| 93 | 96 | ||
| 94 | var fileTransfers = new List<IFileTransfer>(); | 97 | var fileTransfers = new List<IFileTransfer>(); |
| 98 | var trackedFiles = new List<ITrackedFile>(); | ||
| 95 | 99 | ||
| 96 | var containsMergeModules = false; | 100 | var containsMergeModules = false; |
| 97 | var suppressedTableNames = new HashSet<string>(); | 101 | var suppressedTableNames = new HashSet<string>(); |
| @@ -396,6 +400,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 396 | command.Execute(); | 400 | command.Execute(); |
| 397 | 401 | ||
| 398 | fileTransfers.AddRange(command.FileTransfers); | 402 | fileTransfers.AddRange(command.FileTransfers); |
| 403 | trackedFiles.AddRange(command.TrackedFiles); | ||
| 399 | } | 404 | } |
| 400 | 405 | ||
| 401 | #if TODO_FINISH_PATCH | 406 | #if TODO_FINISH_PATCH |
| @@ -416,11 +421,12 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 416 | 421 | ||
| 417 | // Generate database file. | 422 | // Generate database file. |
| 418 | this.Messaging.Write(VerboseMessages.GeneratingDatabase()); | 423 | this.Messaging.Write(VerboseMessages.GeneratingDatabase()); |
| 419 | string tempDatabaseFile = Path.Combine(this.IntermediateFolder, Path.GetFileName(this.OutputPath)); | ||
| 420 | this.GenerateDatabase(output, tempDatabaseFile, false, false); | ||
| 421 | 424 | ||
| 422 | var transfer = this.BackendHelper.CreateFileTransfer(tempDatabaseFile, this.OutputPath, true, FileTransferType.Built); // note where this database needs to move in the future | 425 | var trackMsi = this.BackendHelper.TrackFile(this.OutputPath, TrackedFileType.Final); |
| 423 | fileTransfers.Add(transfer); | 426 | trackedFiles.Add(trackMsi); |
| 427 | |||
| 428 | var temporaryFiles = this.GenerateDatabase(output, trackMsi.Path, false, false); | ||
| 429 | trackedFiles.AddRange(temporaryFiles); | ||
| 424 | 430 | ||
| 425 | // Stop processing if an error previously occurred. | 431 | // Stop processing if an error previously occurred. |
| 426 | if (this.Messaging.EncounteredError) | 432 | if (this.Messaging.EncounteredError) |
| @@ -455,7 +461,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 455 | var command = new MergeModulesCommand(); | 461 | var command = new MergeModulesCommand(); |
| 456 | command.FileFacades = fileFacades; | 462 | command.FileFacades = fileFacades; |
| 457 | command.Output = output; | 463 | command.Output = output; |
| 458 | command.OutputPath = tempDatabaseFile; | 464 | command.OutputPath = this.OutputPath; |
| 459 | command.SuppressedTableNames = suppressedTableNames; | 465 | command.SuppressedTableNames = suppressedTableNames; |
| 460 | command.Execute(); | 466 | command.Execute(); |
| 461 | } | 467 | } |
| @@ -476,7 +482,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 476 | 482 | ||
| 477 | Messaging.Instance.Write(WixVerboses.ValidatingDatabase()); | 483 | Messaging.Instance.Write(WixVerboses.ValidatingDatabase()); |
| 478 | 484 | ||
| 479 | this.Validator.Validate(tempDatabaseFile); | 485 | this.Validator.Validate(this.OutputPath); |
| 480 | 486 | ||
| 481 | stopwatch.Stop(); | 487 | stopwatch.Stop(); |
| 482 | Messaging.Instance.Write(WixVerboses.ValidatedDatabase(stopwatch.ElapsedMilliseconds)); | 488 | Messaging.Instance.Write(WixVerboses.ValidatedDatabase(stopwatch.ElapsedMilliseconds)); |
| @@ -498,19 +504,36 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 498 | command.LayoutDirectory = layoutDirectory; | 504 | command.LayoutDirectory = layoutDirectory; |
| 499 | command.LongNamesInImage = longNames; | 505 | command.LongNamesInImage = longNames; |
| 500 | command.ResolveMedia = this.ResolveMedia; | 506 | command.ResolveMedia = this.ResolveMedia; |
| 501 | command.DatabasePath = tempDatabaseFile; | 507 | command.DatabasePath = this.OutputPath; |
| 502 | command.Execute(); | 508 | command.Execute(); |
| 503 | 509 | ||
| 504 | fileTransfers.AddRange(command.FileTransfers); | 510 | fileTransfers.AddRange(command.FileTransfers); |
| 511 | trackedFiles.AddRange(command.TrackedFiles); | ||
| 505 | } | 512 | } |
| 506 | 513 | ||
| 507 | this.FileTransfers = fileTransfers; | ||
| 508 | this.ContentFilePaths = fileFacades.Select(r => r.WixFile.Source.Path).ToList(); | ||
| 509 | this.Pdb = new Pdb { Output = output }; | 514 | this.Pdb = new Pdb { Output = output }; |
| 510 | 515 | ||
| 516 | if (!String.IsNullOrEmpty(this.OutputPdbPath)) | ||
| 517 | { | ||
| 518 | var trackPdb = this.BackendHelper.TrackFile(this.OutputPdbPath, TrackedFileType.Final); | ||
| 519 | trackedFiles.Add(trackPdb); | ||
| 520 | |||
| 521 | this.Pdb.Save(trackPdb.Path); | ||
| 522 | } | ||
| 523 | |||
| 524 | this.FileTransfers = fileTransfers; | ||
| 525 | // TODO: this is not sufficient to collect all Input files (for example, it misses Binary and Icon tables). | ||
| 526 | trackedFiles.AddRange(fileFacades.Select(f => this.BackendHelper.TrackFile(f.WixFile.Source.Path, TrackedFileType.Input, f.File.SourceLineNumbers))); | ||
| 527 | this.TrackedFiles = trackedFiles; | ||
| 528 | |||
| 511 | // TODO: Eventually this gets removed | 529 | // TODO: Eventually this gets removed |
| 512 | var intermediate = new Intermediate(this.Intermediate.Id, new[] { section }, this.Intermediate.Localizations.ToDictionary(l => l.Culture, StringComparer.OrdinalIgnoreCase), this.Intermediate.EmbedFilePaths); | 530 | var intermediate = new Intermediate(this.Intermediate.Id, new[] { section }, this.Intermediate.Localizations.ToDictionary(l => l.Culture, StringComparer.OrdinalIgnoreCase), this.Intermediate.EmbedFilePaths); |
| 513 | intermediate.Save(Path.ChangeExtension(this.OutputPath, "wir")); | 531 | var trackIntermediate = this.BackendHelper.TrackFile(Path.Combine(this.IntermediateFolder, Path.GetFileName(Path.ChangeExtension(this.OutputPath, "wir"))), TrackedFileType.Intermediate); |
| 532 | intermediate.Save(trackIntermediate.Path); | ||
| 533 | trackedFiles.Add(trackIntermediate); | ||
| 534 | |||
| 535 | //transfer = this.BackendHelper.CreateFileTransfer(intermediatePath, Path.ChangeExtension(this.OutputPath, "wir"), true, FileTransferType.Built); | ||
| 536 | //fileTransfers.Add(transfer); | ||
| 514 | } | 537 | } |
| 515 | 538 | ||
| 516 | #if TODO_FINISH_PATCH | 539 | #if TODO_FINISH_PATCH |
| @@ -881,9 +904,10 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 881 | /// <param name="databaseFile">The database file to create.</param> | 904 | /// <param name="databaseFile">The database file to create.</param> |
| 882 | /// <param name="keepAddedColumns">Whether to keep columns added in a transform.</param> | 905 | /// <param name="keepAddedColumns">Whether to keep columns added in a transform.</param> |
| 883 | /// <param name="useSubdirectory">Whether to use a subdirectory based on the <paramref name="databaseFile"/> file name for intermediate files.</param> | 906 | /// <param name="useSubdirectory">Whether to use a subdirectory based on the <paramref name="databaseFile"/> file name for intermediate files.</param> |
| 884 | private void GenerateDatabase(Output output, string databaseFile, bool keepAddedColumns, bool useSubdirectory) | 907 | private IEnumerable<ITrackedFile> GenerateDatabase(Output output, string databaseFile, bool keepAddedColumns, bool useSubdirectory) |
| 885 | { | 908 | { |
| 886 | var command = new GenerateDatabaseCommand(); | 909 | var command = new GenerateDatabaseCommand(); |
| 910 | command.BackendHelper = this.BackendHelper; | ||
| 887 | command.Extensions = this.FileSystemExtensions; | 911 | command.Extensions = this.FileSystemExtensions; |
| 888 | command.Output = output; | 912 | command.Output = output; |
| 889 | command.OutputPath = databaseFile; | 913 | command.OutputPath = databaseFile; |
| @@ -891,9 +915,11 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 891 | command.UseSubDirectory = useSubdirectory; | 915 | command.UseSubDirectory = useSubdirectory; |
| 892 | command.SuppressAddingValidationRows = this.SuppressAddingValidationRows; | 916 | command.SuppressAddingValidationRows = this.SuppressAddingValidationRows; |
| 893 | command.TableDefinitions = this.TableDefinitions; | 917 | command.TableDefinitions = this.TableDefinitions; |
| 894 | command.TempFilesLocation = this.IntermediateFolder; | 918 | command.IntermediateFolder = this.IntermediateFolder; |
| 895 | command.Codepage = this.Codepage; | 919 | command.Codepage = this.Codepage; |
| 896 | command.Execute(); | 920 | command.Execute(); |
| 921 | |||
| 922 | return command.GeneratedTemporaryFiles; | ||
| 897 | } | 923 | } |
| 898 | } | 924 | } |
| 899 | } | 925 | } |
