Change IParseHelper to not be an IBundleValidator.
Sean Hall committed
Mar 16, 2022 at 19:38 UTC
b279d9c6d38058ff60b8461b35f33d5c056334c9
6 files changed
+16
-32
src/api/wix/WixToolset.Extensibility/Services/IParseHelper.cs
+1
-1
@@ -13,7 +13,7 @@ namespace WixToolset.Extensibility.Services
13
/// <summary>
14
/// Interface provided to help compiler extensions parse.
15
/// </summary>
16
- public interface IParseHelper : IBundleValidator
16
+ public interface IParseHelper
17
{
18
/// <summary>
19
/// Creates a version 3 name-based UUID.
src/wix/WixToolset.Core.Burn/Bundles/PerformBundleBackendValidationCommand.cs
+4
-4
@@ -19,13 +19,13 @@ namespace WixToolset.Core.Burn.Bundles
19
this.PackageFacadesById = packageFacadesById;
20
}
21
22
- public IMessaging Messaging { get; }
22
+ private IMessaging Messaging { get; }
23
24
- public IBurnBackendHelper BackendHelper { get; }
24
+ private IBurnBackendHelper BackendHelper { get; }
25
26
- public IntermediateSection Section { get; }
26
+ private IntermediateSection Section { get; }
27
28
- public IDictionary<string, PackageFacade> PackageFacadesById { get; }
28
+ private IDictionary<string, PackageFacade> PackageFacadesById { get; }
29
30
public void Execute()
31
{
src/wix/WixToolset.Core.Burn/ExtensibilityServices/BurnBackendHelper.cs
+2
@@ -158,6 +158,7 @@ namespace WixToolset.Core.Burn.ExtensibilityServices
158
#endregion
159
160
#region IBundleValidator
161
+
162
public string GetCanonicalRelativePath(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string relativePath)
163
{
164
return this.bundleValidator.GetCanonicalRelativePath(sourceLineNumbers, elementName, attributeName, relativePath);
@@ -177,6 +178,7 @@ namespace WixToolset.Core.Burn.ExtensibilityServices
178
{
179
return this.bundleValidator.ValidateBundleCondition(sourceLineNumbers, elementName, attributeName, condition, phase);
180
}
181
+
182
#endregion
183
184
#region IInternalBurnBackendHelper interfaces
src/wix/WixToolset.Core/Compiler.cs
+2
-1
@@ -114,9 +114,10 @@ namespace WixToolset.Core
114
// Try to compile it.
115
try
116
{
117
+ var bundleValidator = this.Context.ServiceProvider.GetService<IBundleValidator>();
118
var parseHelper = this.Context.ServiceProvider.GetService<IParseHelper>();
119
119
- this.Core = new CompilerCore(target, this.Messaging, parseHelper, extensionsByNamespace);
120
+ this.Core = new CompilerCore(target, this.Messaging, bundleValidator, parseHelper, extensionsByNamespace);
121
this.Core.ShowPedanticMessages = this.ShowPedanticMessages;
122
this.componentIdPlaceholders = new Dictionary<string, string>();
123
src/wix/WixToolset.Core/CompilerCore.cs
+6
-3
@@ -26,6 +26,7 @@ namespace WixToolset.Core
26
internal static readonly XNamespace WixNamespace = "http://wixtoolset.org/schemas/v4/wxs";
27
28
private readonly Dictionary<XNamespace, ICompilerExtension> extensions;
29
+ private readonly IBundleValidator bundleValidator;
30
private readonly IParseHelper parseHelper;
31
private readonly Intermediate intermediate;
32
private readonly IMessaging messaging;
@@ -37,11 +38,13 @@ namespace WixToolset.Core
38
/// </summary>
39
/// <param name="intermediate">The Intermediate object representing compiled source document.</param>
40
/// <param name="messaging"></param>
41
+ /// <param name="bundleValidator"></param>
42
/// <param name="parseHelper"></param>
43
/// <param name="extensions">The WiX extensions collection.</param>
42
- internal CompilerCore(Intermediate intermediate, IMessaging messaging, IParseHelper parseHelper, Dictionary<XNamespace, ICompilerExtension> extensions)
44
+ internal CompilerCore(Intermediate intermediate, IMessaging messaging, IBundleValidator bundleValidator, IParseHelper parseHelper, Dictionary<XNamespace, ICompilerExtension> extensions)
45
{
46
this.extensions = extensions;
47
+ this.bundleValidator = bundleValidator;
48
this.parseHelper = parseHelper;
49
this.intermediate = intermediate;
50
this.messaging = messaging;
@@ -765,7 +768,7 @@ namespace WixToolset.Core
768
769
if (!String.IsNullOrEmpty(value))
770
{
768
- this.parseHelper.ValidateBundleVariableName(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, value);
771
+ this.bundleValidator.ValidateBundleVariableName(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, value);
772
}
773
774
return value;
@@ -783,7 +786,7 @@ namespace WixToolset.Core
786
787
if (0 < value.Length)
788
{
786
- this.parseHelper.ValidateBundleMsiPropertyName(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, value);
789
+ this.bundleValidator.ValidateBundleMsiPropertyName(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, value);
790
}
791
792
return value;
src/wix/WixToolset.Core/ExtensibilityServices/ParseHelper.cs
+1
-23
@@ -468,7 +468,7 @@ namespace WixToolset.Core.ExtensibilityServices
468
}
469
else if (allowRelative)
470
{
471
- value = this.GetCanonicalRelativePath(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, value);
471
+ value = this.BundleValidator.GetCanonicalRelativePath(sourceLineNumbers, attribute.Parent.Name.LocalName, attribute.Name.LocalName, value);
472
}
473
else if (CompilerCore.IsAmbiguousFilename(value))
474
{
@@ -859,27 +859,5 @@ namespace WixToolset.Core.ExtensibilityServices
859
860
return extension != null;
861
}
862
-
863
- #region IBundleValidator
864
- public string GetCanonicalRelativePath(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string relativePath)
865
- {
866
- return this.BundleValidator.GetCanonicalRelativePath(sourceLineNumbers, elementName, attributeName, relativePath);
867
- }
868
-
869
- public bool ValidateBundleMsiPropertyName(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string propertyName)
870
- {
871
- return this.BundleValidator.ValidateBundleMsiPropertyName(sourceLineNumbers, elementName, attributeName, propertyName);
872
- }
873
-
874
- public bool ValidateBundleVariableName(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string variableName)
875
- {
876
- return this.BundleValidator.ValidateBundleVariableName(sourceLineNumbers, elementName, attributeName, variableName);
877
- }
878
-
879
- public bool ValidateBundleCondition(SourceLineNumber sourceLineNumbers, string elementName, string attributeName, string condition, BundleConditionPhase phase)
880
- {
881
- return this.BundleValidator.ValidateBundleCondition(sourceLineNumbers, elementName, attributeName, condition, phase);
882
- }
883
- #endregion
862
}
863
}