From 3eef7b697ecebffc20d13bc2c199573620c38ccf Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Fri, 5 Mar 2021 15:15:38 -0600 Subject: [PATCH] Fix Enforce. --- .../DependencyExtensionFixture.cs | 10 ++++++++-- .../TestData/UsingProvides/Package.wxs | 3 +++ src/wixext/DependencyCompiler.cs | 4 ++-- src/wixlib/DependencyExtension_Platform.wxi | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs b/src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs index 968b8de..708ae65 100644 --- a/src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs +++ b/src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs @@ -2,6 +2,8 @@ namespace WixToolsetTest.Dependency { + using System.Linq; + using System.Text.RegularExpressions; using WixBuildTools.TestSupport; using WixToolset.Core.TestPackage; using WixToolset.Dependency; @@ -15,11 +17,15 @@ public void CanBuildUsingProvides() var folder = TestData.Get(@"TestData\UsingProvides"); var build = new Builder(folder, typeof(DependencyExtensionFactory), new[] { folder }); - var results = build.BuildAndQuery(Build, "CustomAction", "WixDependencyProvider"); - Assert.Equal(new[] + var results = build.BuildAndQuery(Build, "CustomAction", "WixDependencyProvider") + .Select(r => Regex.Replace(r, "{[^}]*}", "{*}")) + .ToArray(); + WixAssert.CompareLineByLine(new[] { "CustomAction:Wix4DependencyCheck_X86\t1\tDependencyCA_X86\tWixDependencyCheck\t", + "CustomAction:Wix4DependencyRequire_X86\t1\tDependencyCA_X86\tWixDependencyRequire\t", "WixDependencyProvider:dep74OfIcniaqxA7EprRGBw4Oyy3r8\tfilF5_pLhBuF5b4N9XEo52g_hUM5Lo\tUsingProvides\t\t\t", + "WixDependencyProvider:depTpv28q7slcxvXPWmU4Z0GfbiI.4\tfilF5_pLhBuF5b4N9XEo52g_hUM5Lo\t{*}\t\t\t", }, results); } diff --git a/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs b/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs index b15ae8d..9351519 100644 --- a/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs +++ b/src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs @@ -9,6 +9,9 @@ + + + diff --git a/src/wixext/DependencyCompiler.cs b/src/wixext/DependencyCompiler.cs index 0405c32..3d6c84a 100644 --- a/src/wixext/DependencyCompiler.cs +++ b/src/wixext/DependencyCompiler.cs @@ -30,14 +30,14 @@ public override void ParseAttribute(Intermediate intermediate, IntermediateSecti switch (parentElement.Name.LocalName) { case "Provides": - if (attribute.Name.LocalName == "Check" && parentElement.Parent.Name.LocalName == "Component") + if (attribute.Name.LocalName == "Check" && parentElement.Parent?.Name.LocalName == "Component") { addCheck = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attribute); } break; case "Requires": case "RequiresRef": - if (attribute.Name.LocalName == "Enforce" && parentElement.Parent.Name.LocalName == "Component") + if (attribute.Name.LocalName == "Enforce" && parentElement.Parent?.Parent?.Name.LocalName == "Component") { addRequire = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attribute); } diff --git a/src/wixlib/DependencyExtension_Platform.wxi b/src/wixlib/DependencyExtension_Platform.wxi index 68dec47..9ab28ef 100644 --- a/src/wixlib/DependencyExtension_Platform.wxi +++ b/src/wixlib/DependencyExtension_Platform.wxi @@ -7,7 +7,7 @@ - +