From 0d4df529a7e34f033112a1c6f16f749880334e7d Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 16 Mar 2021 10:52:55 -0700 Subject: Use validation now implemented in Core.Native Fixes wixtoolset/issues#5946 --- .../Bind/BindDatabaseCommand.cs | 50 +++++++++++----------- 1 file changed, 24 insertions(+), 26 deletions(-) (limited to 'src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs') diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs index df1c824a..6503ba65 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs @@ -21,11 +21,11 @@ namespace WixToolset.Core.WindowsInstaller.Bind // As outlined in RFC 4122, this is our namespace for generating name-based (version 3) UUIDs. internal static readonly Guid WixComponentGuidNamespace = new Guid("{3064E5C6-FB63-4FE9-AC49-E446A792EFA5}"); - public BindDatabaseCommand(IBindContext context, IEnumerable backendExtension, Validator validator) : this(context, backendExtension, null, validator) + public BindDatabaseCommand(IBindContext context, IEnumerable backendExtension, string cubeFile) : this(context, backendExtension, null, cubeFile) { } - public BindDatabaseCommand(IBindContext context, IEnumerable backendExtension, IEnumerable subStorages, Validator validator) + public BindDatabaseCommand(IBindContext context, IEnumerable backendExtension, IEnumerable subStorages, string cubeFile) { this.ServiceProvider = context.ServiceProvider; @@ -50,7 +50,11 @@ namespace WixToolset.Core.WindowsInstaller.Bind this.SuppressLayout = context.SuppressLayout; this.SubStorages = subStorages; - this.Validator = validator; + + this.SuppressValidation = context.SuppressValidation; + this.Ices = context.Ices; + this.SuppressedIces = context.SuppressIces; + this.CubeFiles = String.IsNullOrEmpty(cubeFile) ? null : new[] { cubeFile }; this.BackendExtensions = backendExtension; } @@ -97,7 +101,13 @@ namespace WixToolset.Core.WindowsInstaller.Bind private string IntermediateFolder { get; } - private Validator Validator { get; } + private bool SuppressValidation { get; } + + private IEnumerable Ices { get; } + + private IEnumerable SuppressedIces { get; } + + private IEnumerable CubeFiles { get; } public IBindResult Execute() { @@ -522,34 +532,22 @@ namespace WixToolset.Core.WindowsInstaller.Bind if (this.Messaging.EncounteredError) { return null; - } + } -#if TODO_FINISH_VALIDATION - // Validate the output if there is an MSI validator. - if (null != this.Validator) + // Validate the output if there are CUBe files and we're not explicitly suppressing validation. + if (this.CubeFiles != null && !this.SuppressValidation) { - Stopwatch stopwatch = Stopwatch.StartNew(); - - // set the output file for source line information - this.Validator.Output = this.Output; - - Messaging.Instance.Write(WixVerboses.ValidatingDatabase()); - - this.Validator.Validate(this.OutputPath); - - stopwatch.Stop(); - Messaging.Instance.Write(WixVerboses.ValidatedDatabase(stopwatch.ElapsedMilliseconds)); + var command = new ValidateDatabaseCommand(this.Messaging, this.IntermediateFolder, data, this.OutputPath, this.CubeFiles, this.Ices, this.SuppressedIces); + command.Execute(); + } - // Stop processing if an error occurred. - if (Messaging.Instance.EncounteredError) - { - return; - } + if (this.Messaging.EncounteredError) + { + return null; } -#endif // Process uncompressed files. - if (!this.Messaging.EncounteredError && !this.SuppressLayout && uncompressedFiles.Any()) + if (!this.SuppressLayout && uncompressedFiles.Any()) { var command = new ProcessUncompressedFilesCommand(section, this.WindowsInstallerBackendHelper, this.PathResolver); command.Compressed = compressed; -- cgit v1.2.3-55-g6feb