diff options
author | Rob Mensching <rob@firegiant.com> | 2021-03-18 02:12:04 -0700 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2021-03-18 02:15:51 -0700 |
commit | a451caf6d60e3f7fcbd56b87ca3c0f393e8f7b52 (patch) | |
tree | 7080178a100de2c380af9b982d37a0c84ddc4ba5 /src | |
parent | fb2e8cb8a28a2a1a84909a8793a57d0d575da610 (diff) | |
download | wix-a451caf6d60e3f7fcbd56b87ca3c0f393e8f7b52.tar.gz wix-a451caf6d60e3f7fcbd56b87ca3c0f393e8f7b52.tar.bz2 wix-a451caf6d60e3f7fcbd56b87ca3c0f393e8f7b52.zip |
Track database copy for validation as temporary
Diffstat (limited to 'src')
-rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs | 4 | ||||
-rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Bind/ValidateDatabaseCommand.cs | 18 |
2 files changed, 17 insertions, 5 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs index 6503ba65..f645c85e 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs | |||
@@ -537,8 +537,10 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
537 | // Validate the output if there are CUBe files and we're not explicitly suppressing validation. | 537 | // Validate the output if there are CUBe files and we're not explicitly suppressing validation. |
538 | if (this.CubeFiles != null && !this.SuppressValidation) | 538 | if (this.CubeFiles != null && !this.SuppressValidation) |
539 | { | 539 | { |
540 | var command = new ValidateDatabaseCommand(this.Messaging, this.IntermediateFolder, data, this.OutputPath, this.CubeFiles, this.Ices, this.SuppressedIces); | 540 | var command = new ValidateDatabaseCommand(this.Messaging, this.WindowsInstallerBackendHelper, this.IntermediateFolder, data, this.OutputPath, this.CubeFiles, this.Ices, this.SuppressedIces); |
541 | command.Execute(); | 541 | command.Execute(); |
542 | |||
543 | trackedFiles.AddRange(command.TrackedFiles); | ||
542 | } | 544 | } |
543 | 545 | ||
544 | if (this.Messaging.EncounteredError) | 546 | if (this.Messaging.EncounteredError) |
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/ValidateDatabaseCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/ValidateDatabaseCommand.cs index 35b6018c..cf1e21c2 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/ValidateDatabaseCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/ValidateDatabaseCommand.cs | |||
@@ -4,15 +4,13 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
4 | { | 4 | { |
5 | using System; | 5 | using System; |
6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
7 | using System.ComponentModel; | ||
8 | using System.Diagnostics; | 7 | using System.Diagnostics; |
9 | using System.IO; | 8 | using System.IO; |
10 | using System.Linq; | 9 | using System.Linq; |
11 | using System.Threading; | ||
12 | using WixToolset.Core.Native; | 10 | using WixToolset.Core.Native; |
13 | using WixToolset.Core.Native.Msi; | ||
14 | using WixToolset.Data; | 11 | using WixToolset.Data; |
15 | using WixToolset.Data.WindowsInstaller; | 12 | using WixToolset.Data.WindowsInstaller; |
13 | using WixToolset.Extensibility.Data; | ||
16 | using WixToolset.Extensibility.Services; | 14 | using WixToolset.Extensibility.Services; |
17 | 15 | ||
18 | internal class ValidateDatabaseCommand : IWindowsInstallerValidatorCallback | 16 | internal class ValidateDatabaseCommand : IWindowsInstallerValidatorCallback |
@@ -20,9 +18,10 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
20 | // Set of ICEs that have equivalent-or-better checks in WiX. | 18 | // Set of ICEs that have equivalent-or-better checks in WiX. |
21 | private static readonly string[] WellKnownSuppressedIces = new[] { "ICE08", "ICE33", "ICE47", "ICE66" }; | 19 | private static readonly string[] WellKnownSuppressedIces = new[] { "ICE08", "ICE33", "ICE47", "ICE66" }; |
22 | 20 | ||
23 | public ValidateDatabaseCommand(IMessaging messaging, string intermediateFolder, WindowsInstallerData data, string outputPath, IEnumerable<string> cubeFiles, IEnumerable<string> ices, IEnumerable<string> suppressedIces) | 21 | public ValidateDatabaseCommand(IMessaging messaging, IBackendHelper backendHelper, string intermediateFolder, WindowsInstallerData data, string outputPath, IEnumerable<string> cubeFiles, IEnumerable<string> ices, IEnumerable<string> suppressedIces) |
24 | { | 22 | { |
25 | this.Messaging = messaging; | 23 | this.Messaging = messaging; |
24 | this.BackendHelper = backendHelper; | ||
26 | this.Data = data; | 25 | this.Data = data; |
27 | this.OutputPath = outputPath; | 26 | this.OutputPath = outputPath; |
28 | this.CubeFiles = cubeFiles; | 27 | this.CubeFiles = cubeFiles; |
@@ -33,6 +32,8 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
33 | this.OutputSourceLineNumber = new SourceLineNumber(outputPath); | 32 | this.OutputSourceLineNumber = new SourceLineNumber(outputPath); |
34 | } | 33 | } |
35 | 34 | ||
35 | public IEnumerable<ITrackedFile> TrackedFiles { get; private set; } | ||
36 | |||
36 | /// <summary> | 37 | /// <summary> |
37 | /// Encountered error implementation for <see cref="IWindowsInstallerValidatorCallback"/>. | 38 | /// Encountered error implementation for <see cref="IWindowsInstallerValidatorCallback"/>. |
38 | /// </summary> | 39 | /// </summary> |
@@ -40,6 +41,8 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
40 | 41 | ||
41 | private IMessaging Messaging { get; } | 42 | private IMessaging Messaging { get; } |
42 | 43 | ||
44 | private IBackendHelper BackendHelper { get; } | ||
45 | |||
43 | private WindowsInstallerData Data { get; } | 46 | private WindowsInstallerData Data { get; } |
44 | 47 | ||
45 | private string OutputPath { get; } | 48 | private string OutputPath { get; } |
@@ -61,6 +64,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
61 | 64 | ||
62 | public void Execute() | 65 | public void Execute() |
63 | { | 66 | { |
67 | var trackedFiles = new List<ITrackedFile>(); | ||
64 | var stopwatch = Stopwatch.StartNew(); | 68 | var stopwatch = Stopwatch.StartNew(); |
65 | 69 | ||
66 | this.Messaging.Write(VerboseMessages.ValidatingDatabase()); | 70 | this.Messaging.Write(VerboseMessages.ValidatingDatabase()); |
@@ -74,6 +78,9 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
74 | var workingDatabasePath = Path.Combine(workingFolder, Path.GetFileName(this.OutputPath)); | 78 | var workingDatabasePath = Path.Combine(workingFolder, Path.GetFileName(this.OutputPath)); |
75 | FileSystem.CopyFile(this.OutputPath, workingDatabasePath, allowHardlink: false); | 79 | FileSystem.CopyFile(this.OutputPath, workingDatabasePath, allowHardlink: false); |
76 | 80 | ||
81 | var trackWorkingDatabase = this.BackendHelper.TrackFile(workingDatabasePath, TrackedFileType.Temporary); | ||
82 | trackedFiles.Add(trackWorkingDatabase); | ||
83 | |||
77 | var attributes = File.GetAttributes(workingDatabasePath); | 84 | var attributes = File.GetAttributes(workingDatabasePath); |
78 | File.SetAttributes(workingDatabasePath, attributes & ~FileAttributes.ReadOnly); | 85 | File.SetAttributes(workingDatabasePath, attributes & ~FileAttributes.ReadOnly); |
79 | 86 | ||
@@ -82,6 +89,9 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
82 | 89 | ||
83 | stopwatch.Stop(); | 90 | stopwatch.Stop(); |
84 | this.Messaging.Write(VerboseMessages.ValidatedDatabase(stopwatch.ElapsedMilliseconds)); | 91 | this.Messaging.Write(VerboseMessages.ValidatedDatabase(stopwatch.ElapsedMilliseconds)); |
92 | |||
93 | |||
94 | this.TrackedFiles = trackedFiles; | ||
85 | } | 95 | } |
86 | 96 | ||
87 | private void LogValidationMessage(ValidationMessage message) | 97 | private void LogValidationMessage(ValidationMessage message) |