From b279d9c6d38058ff60b8461b35f33d5c056334c9 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Wed, 16 Mar 2022 19:38:46 -0500 Subject: Change IParseHelper to not be an IBundleValidator. --- .../Services/IParseHelper.cs | 2 +- .../PerformBundleBackendValidationCommand.cs | 8 ++++---- .../ExtensibilityServices/BurnBackendHelper.cs | 2 ++ src/wix/WixToolset.Core/Compiler.cs | 3 ++- src/wix/WixToolset.Core/CompilerCore.cs | 9 +++++--- .../ExtensibilityServices/ParseHelper.cs | 24 +--------------------- 6 files changed, 16 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/api/wix/WixToolset.Extensibility/Services/IParseHelper.cs b/src/api/wix/WixToolset.Extensibility/Services/IParseHelper.cs index de2c6f9f..3a71d120 100644 --- a/src/api/wix/WixToolset.Extensibility/Services/IParseHelper.cs +++ b/src/api/wix/WixToolset.Extensibility/Services/IParseHelper.cs @@ -13,7 +13,7 @@ namespace WixToolset.Extensibility.Services /// /// Interface provided to help compiler extensions parse. /// - public interface IParseHelper : IBundleValidator + public interface IParseHelper { /// /// Creates a version 3 name-based UUID. diff --git a/src/wix/WixToolset.Core.Burn/Bundles/PerformBundleBackendValidationCommand.cs b/src/wix/WixToolset.Core.Burn/Bundles/PerformBundleBackendValidationCommand.cs index ee18ff2c..2db5841b 100644 --- a/src/wix/WixToolset.Core.Burn/Bundles/PerformBundleBackendValidationCommand.cs +++ b/src/wix/WixToolset.Core.Burn/Bundles/PerformBundleBackendValidationCommand.cs @@ -19,13 +19,13 @@ namespace WixToolset.Core.Burn.Bundles this.PackageFacadesById = packageFacadesById; } - public IMessaging Messaging { get; } + private IMessaging Messaging { get; } - public IBurnBackendHelper BackendHelper { get; } + private IBurnBackendHelper BackendHelper { get; } - public IntermediateSection Section { get; } + private IntermediateSection Section { get; } - public IDictionary PackageFacadesById { get; } + private IDictionary PackageFacadesById { get; } public void Execute() { diff --git a/src/wix/WixToolset.Core.Burn/ExtensibilityServices/BurnBackendHelper.cs b/src/wix/WixToolset.Core.Burn/ExtensibilityServices/BurnBackendHelper.cs index d77606fb..ed662b7f 100644 --- a/src/wix/WixToolset.Core.Burn/ExtensibilityServices/BurnBackendHelper.cs +++ b/src/wix/WixToolset.Core.Burn/ExtensibilityServices/BurnBackendHelper.cs @@ -158,6 +158,7 @@ namespace WixToolset.Core.Burn.ExtensibilityServices #endregion #region IBundleValidator + public string GetCanonicalRelativePath(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string relativePath) { return this.bundleValidator.GetCanonicalRelativePath(sourceLineNumbers, elementName, attributeName, relativePath); @@ -177,6 +178,7 @@ namespace WixToolset.Core.Burn.ExtensibilityServices { return this.bundleValidator.ValidateBundleCondition(sourceLineNumbers, elementName, attributeName, condition, phase); } + #endregion #region IInternalBurnBackendHelper interfaces diff --git a/src/wix/WixToolset.Core/Compiler.cs b/src/wix/WixToolset.Core/Compiler.cs index 301a4f6a..5e2b3342 100644 --- a/src/wix/WixToolset.Core/Compiler.cs +++ b/src/wix/WixToolset.Core/Compiler.cs @@ -114,9 +114,10 @@ namespace WixToolset.Core // Try to compile it. try { + var bundleValidator = this.Context.ServiceProvider.GetService(); var parseHelper = this.Context.ServiceProvider.GetService(); - this.Core = new CompilerCore(target, this.Messaging, parseHelper, extensionsByNamespace); + this.Core = new CompilerCore(target, this.Messaging, bundleValidator, parseHelper, extensionsByNamespace); this.Core.ShowPedanticMessages = this.ShowPedanticMessages; this.componentIdPlaceholders = new Dictionary(); diff --git a/src/wix/WixToolset.Core/CompilerCore.cs b/src/wix/WixToolset.Core/CompilerCore.cs index 7effa0b9..e23b1e70 100644 --- a/src/wix/WixToolset.Core/CompilerCore.cs +++ b/src/wix/WixToolset.Core/CompilerCore.cs @@ -26,6 +26,7 @@ namespace WixToolset.Core internal static readonly XNamespace WixNamespace = "http://wixtoolset.org/schemas/v4/wxs"; private readonly Dictionary extensions; + private readonly IBundleValidator bundleValidator; private readonly IParseHelper parseHelper; private readonly Intermediate intermediate; private readonly IMessaging messaging; @@ -37,11 +38,13 @@ namespace WixToolset.Core /// /// The Intermediate object representing compiled source document. /// + /// /// /// The WiX extensions collection. - internal CompilerCore(Intermediate intermediate, IMessaging messaging, IParseHelper parseHelper, Dictionary extensions) + internal CompilerCore(Intermediate intermediate, IMessaging messaging, IBundleValidator bundleValidator, IParseHelper parseHelper, Dictionary extensions) { this.extensions = extensions; + this.bundleValidator = bundleValidator; this.parseHelper = parseHelper; this.intermediate = intermediate; this.messaging = messaging; @@ -765,7 +768,7 @@ namespace WixToolset.Core if (!String.IsNullOrEmpty(value)) { - this.parseHelper.ValidateBundleVariableName(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, value); + this.bundleValidator.ValidateBundleVariableName(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, value); } return value; @@ -783,7 +786,7 @@ namespace WixToolset.Core if (0 < value.Length) { - this.parseHelper.ValidateBundleMsiPropertyName(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, value); + this.bundleValidator.ValidateBundleMsiPropertyName(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, value); } return value; diff --git a/src/wix/WixToolset.Core/ExtensibilityServices/ParseHelper.cs b/src/wix/WixToolset.Core/ExtensibilityServices/ParseHelper.cs index fa4f50ba..2d5c5b2e 100644 --- a/src/wix/WixToolset.Core/ExtensibilityServices/ParseHelper.cs +++ b/src/wix/WixToolset.Core/ExtensibilityServices/ParseHelper.cs @@ -468,7 +468,7 @@ namespace WixToolset.Core.ExtensibilityServices } else if (allowRelative) { - value = this.GetCanonicalRelativePath(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, value); + value = this.BundleValidator.GetCanonicalRelativePath(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, value); } else if (CompilerCore.IsAmbiguousFilename(value)) { @@ -859,27 +859,5 @@ namespace WixToolset.Core.ExtensibilityServices return extension != null; } - - #region IBundleValidator - public string GetCanonicalRelativePath(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string relativePath) - { - return this.BundleValidator.GetCanonicalRelativePath(sourceLineNumbers, elementName, attributeName, relativePath); - } - - public bool ValidateBundleMsiPropertyName(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string propertyName) - { - return this.BundleValidator.ValidateBundleMsiPropertyName(sourceLineNumbers, elementName, attributeName, propertyName); - } - - public bool ValidateBundleVariableName(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string variableName) - { - return this.BundleValidator.ValidateBundleVariableName(sourceLineNumbers, elementName, attributeName, variableName); - } - - public bool ValidateBundleCondition(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string condition, BundleConditionPhase phase) - { - return this.BundleValidator.ValidateBundleCondition(sourceLineNumbers, elementName, attributeName, condition, phase); - } - #endregion } } -- cgit v1.2.3-55-g6feb