diff options
| author | Rob Mensching <rob@firegiant.com> | 2019-10-25 00:48:35 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2019-10-25 00:53:29 -0700 |
| commit | 9c714a8f1baa6e0130e5cd00cbdca649cebaf6a5 (patch) | |
| tree | ebf26d0e37244f3014e0c4924a29af7f7e56e2f2 /src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs | |
| parent | 87580cbe111a8df836231a0192dee674cf482f08 (diff) | |
| download | wix-9c714a8f1baa6e0130e5cd00cbdca649cebaf6a5.tar.gz wix-9c714a8f1baa6e0130e5cd00cbdca649cebaf6a5.tar.bz2 wix-9c714a8f1baa6e0130e5cd00cbdca649cebaf6a5.zip | |
Update to WixOutput file structure to fix embedded file handling
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs')
| -rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs | 66 |
1 files changed, 51 insertions, 15 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs index 411f64bf..3e4806a7 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs | |||
| @@ -17,11 +17,13 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 17 | /// <summary> | 17 | /// <summary> |
| 18 | /// Binds a databse. | 18 | /// Binds a databse. |
| 19 | /// </summary> | 19 | /// </summary> |
| 20 | internal class BindDatabaseCommand | 20 | internal class BindDatabaseCommand : IDisposable |
| 21 | { | 21 | { |
| 22 | // As outlined in RFC 4122, this is our namespace for generating name-based (version 3) UUIDs. | 22 | // As outlined in RFC 4122, this is our namespace for generating name-based (version 3) UUIDs. |
| 23 | internal static readonly Guid WixComponentGuidNamespace = new Guid("{3064E5C6-FB63-4FE9-AC49-E446A792EFA5}"); | 23 | internal static readonly Guid WixComponentGuidNamespace = new Guid("{3064E5C6-FB63-4FE9-AC49-E446A792EFA5}"); |
| 24 | 24 | ||
| 25 | private bool disposed; | ||
| 26 | |||
| 25 | public BindDatabaseCommand(IBindContext context, IEnumerable<IWindowsInstallerBackendBinderExtension> backendExtension, Validator validator) | 27 | public BindDatabaseCommand(IBindContext context, IEnumerable<IWindowsInstallerBackendBinderExtension> backendExtension, Validator validator) |
| 26 | { | 28 | { |
| 27 | this.ServiceProvider = context.ServiceProvider; | 29 | this.ServiceProvider = context.ServiceProvider; |
| @@ -92,7 +94,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 92 | 94 | ||
| 93 | public IEnumerable<ITrackedFile> TrackedFiles { get; private set; } | 95 | public IEnumerable<ITrackedFile> TrackedFiles { get; private set; } |
| 94 | 96 | ||
| 95 | public Pdb Pdb { get; private set; } | 97 | public WixOutput Wixout { get; private set; } |
| 96 | 98 | ||
| 97 | public void Execute() | 99 | public void Execute() |
| 98 | { | 100 | { |
| @@ -524,29 +526,41 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 524 | trackedFiles.AddRange(command.TrackedFiles); | 526 | trackedFiles.AddRange(command.TrackedFiles); |
| 525 | } | 527 | } |
| 526 | 528 | ||
| 527 | this.Pdb = new Pdb { Output = output }; | 529 | this.Wixout = this.CreateWixout(trackedFiles, this.Intermediate, output); |
| 528 | |||
| 529 | if (!String.IsNullOrEmpty(this.OutputPdbPath)) | ||
| 530 | { | ||
| 531 | var trackPdb = this.BackendHelper.TrackFile(this.OutputPdbPath, TrackedFileType.Final); | ||
| 532 | trackedFiles.Add(trackPdb); | ||
| 533 | |||
| 534 | this.Pdb.Save(trackPdb.Path); | ||
| 535 | } | ||
| 536 | 530 | ||
| 537 | this.FileTransfers = fileTransfers; | 531 | this.FileTransfers = fileTransfers; |
| 538 | // TODO: this is not sufficient to collect all Input files (for example, it misses Binary and Icon tables). | 532 | // TODO: this is not sufficient to collect all Input files (for example, it misses Binary and Icon tables). |
| 539 | trackedFiles.AddRange(fileFacades.Select(f => this.BackendHelper.TrackFile(f.File.Source.Path, TrackedFileType.Input, f.File.SourceLineNumbers))); | 533 | trackedFiles.AddRange(fileFacades.Select(f => this.BackendHelper.TrackFile(f.File.Source.Path, TrackedFileType.Input, f.File.SourceLineNumbers))); |
| 540 | this.TrackedFiles = trackedFiles; | 534 | this.TrackedFiles = trackedFiles; |
| 541 | 535 | ||
| 542 | // TODO: Eventually this gets removed | 536 | // TODO: Eventually this gets removed |
| 543 | var intermediate = new Intermediate(this.Intermediate.Id, new[] { section }, this.Intermediate.Localizations.ToDictionary(l => l.Culture, StringComparer.OrdinalIgnoreCase), this.Intermediate.EmbedFilePaths); | 537 | var intermediate = new Intermediate(this.Intermediate.Id, new[] { section }, this.Intermediate.Localizations.ToDictionary(l => l.Culture, StringComparer.OrdinalIgnoreCase)); |
| 544 | var trackIntermediate = this.BackendHelper.TrackFile(Path.Combine(this.IntermediateFolder, Path.GetFileName(Path.ChangeExtension(this.OutputPath, "wir"))), TrackedFileType.Intermediate); | 538 | var trackIntermediate = this.BackendHelper.TrackFile(Path.Combine(this.IntermediateFolder, Path.GetFileName(Path.ChangeExtension(this.OutputPath, "wir"))), TrackedFileType.Intermediate); |
| 545 | intermediate.Save(trackIntermediate.Path); | 539 | intermediate.Save(trackIntermediate.Path); |
| 546 | trackedFiles.Add(trackIntermediate); | 540 | trackedFiles.Add(trackIntermediate); |
| 541 | } | ||
| 547 | 542 | ||
| 548 | //transfer = this.BackendHelper.CreateFileTransfer(intermediatePath, Path.ChangeExtension(this.OutputPath, "wir"), true, FileTransferType.Built); | 543 | private WixOutput CreateWixout(List<ITrackedFile> trackedFiles, Intermediate intermediate, Output output) |
| 549 | //fileTransfers.Add(transfer); | 544 | { |
| 545 | WixOutput wixout; | ||
| 546 | |||
| 547 | if (String.IsNullOrEmpty(this.OutputPdbPath)) | ||
| 548 | { | ||
| 549 | wixout = WixOutput.Create(); | ||
| 550 | } | ||
| 551 | else | ||
| 552 | { | ||
| 553 | var trackPdb = this.BackendHelper.TrackFile(this.OutputPdbPath, TrackedFileType.Final); | ||
| 554 | trackedFiles.Add(trackPdb); | ||
| 555 | |||
| 556 | wixout = WixOutput.Create(trackPdb.Path); | ||
| 557 | } | ||
| 558 | |||
| 559 | intermediate.Save(wixout); | ||
| 560 | |||
| 561 | output.Save(wixout); | ||
| 562 | |||
| 563 | return wixout; | ||
| 550 | } | 564 | } |
| 551 | 565 | ||
| 552 | #if TODO_FINISH_PATCH | 566 | #if TODO_FINISH_PATCH |
| @@ -934,5 +948,27 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 934 | 948 | ||
| 935 | return command.GeneratedTemporaryFiles; | 949 | return command.GeneratedTemporaryFiles; |
| 936 | } | 950 | } |
| 951 | |||
| 952 | #region IDisposable Support | ||
| 953 | |||
| 954 | public void Dispose() | ||
| 955 | { | ||
| 956 | this.Dispose(true); | ||
| 957 | } | ||
| 958 | |||
| 959 | protected virtual void Dispose(bool disposing) | ||
| 960 | { | ||
| 961 | if (!this.disposed) | ||
| 962 | { | ||
| 963 | if (disposing) | ||
| 964 | { | ||
| 965 | this.Wixout?.Dispose(); | ||
| 966 | } | ||
| 967 | |||
| 968 | this.disposed = true; | ||
| 969 | } | ||
| 970 | } | ||
| 971 | |||
| 972 | #endregion | ||
| 937 | } | 973 | } |
| 938 | } | 974 | } |
