@joebigelow / wix / commits / 3eef7b69

Fix Enforce.

Sean Hall committed Mar 5, 2021 at 15:15 UTC 3eef7b697ecebffc20d13bc2c199573620c38ccf
4 files changed +14 -5
src/test/WixToolsetTest.Dependency/DependencyExtensionFixture.cs
+8 -2
@@ -2,6 +2,8 @@
2
3 namespace WixToolsetTest.Dependency
4 {
5 + using System.Linq;
6 + using System.Text.RegularExpressions;
7 using WixBuildTools.TestSupport;
8 using WixToolset.Core.TestPackage;
9 using WixToolset.Dependency;
@@ -15,11 +17,15 @@ namespace WixToolsetTest.Dependency
17 var folder = TestData.Get(@"TestData\UsingProvides");
18 var build = new Builder(folder, typeof(DependencyExtensionFactory), new[] { folder });
19
18 - var results = build.BuildAndQuery(Build, "CustomAction", "WixDependencyProvider");
19 - Assert.Equal(new[]
20 + var results = build.BuildAndQuery(Build, "CustomAction", "WixDependencyProvider")
21 + .Select(r => Regex.Replace(r, "{[^}]*}", "{*}"))
22 + .ToArray();
23 + WixAssert.CompareLineByLine(new[]
24 {
25 "CustomAction:Wix4DependencyCheck_X86\t1\tDependencyCA_X86\tWixDependencyCheck\t",
26 + "CustomAction:Wix4DependencyRequire_X86\t1\tDependencyCA_X86\tWixDependencyRequire\t",
27 "WixDependencyProvider:dep74OfIcniaqxA7EprRGBw4Oyy3r8\tfilF5_pLhBuF5b4N9XEo52g_hUM5Lo\tUsingProvides\t\t\t",
28 + "WixDependencyProvider:depTpv28q7slcxvXPWmU4Z0GfbiI.4\tfilF5_pLhBuF5b4N9XEo52g_hUM5Lo\t{*}\t\t\t",
29 }, results);
30 }
31
src/test/WixToolsetTest.Dependency/TestData/UsingProvides/Package.wxs
+3
@@ -9,6 +9,9 @@
9 <Component Directory="INSTALLFOLDER">
10 <File Name="example.txt" Source="Package.wxs" />
11 <Provides Key="UsingProvides" dep:Check="yes" />
12 + <Provides>
13 + <Requires ProviderKey="UsingRequires" Minimum="1.0.0.0" dep:Enforce="yes" />
14 + </Provides>
15 </Component>
16 </Feature>
17
src/wixext/DependencyCompiler.cs
+2 -2
@@ -30,14 +30,14 @@ namespace WixToolset.Dependency
30 switch (parentElement.Name.LocalName)
31 {
32 case "Provides":
33 - if (attribute.Name.LocalName == "Check" && parentElement.Parent.Name.LocalName == "Component")
33 + if (attribute.Name.LocalName == "Check" && parentElement.Parent?.Name.LocalName == "Component")
34 {
35 addCheck = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attribute);
36 }
37 break;
38 case "Requires":
39 case "RequiresRef":
40 - if (attribute.Name.LocalName == "Enforce" && parentElement.Parent.Name.LocalName == "Component")
40 + if (attribute.Name.LocalName == "Enforce" && parentElement.Parent?.Parent?.Name.LocalName == "Component")
41 {
42 addRequire = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attribute);
43 }
src/wixlib/DependencyExtension_Platform.wxi
+1 -1
@@ -7,7 +7,7 @@
7 <Fragment>
8 <CustomAction Id="$(var.Prefix)DependencyRequire$(var.Suffix)" DllEntry="WixDependencyRequire" Execute="immediate" Return="check" SuppressModularization="yes" BinaryRef="DependencyCA$(var.Suffix)" />
9 <InstallExecuteSequence>
10 - <Custom Action="$(var.Prefix)DependencyRequire$(var.Suffix)" Before="WixDependencyCheck$(var.Suffix)" Overridable="yes" Condition="NOT DISABLEDEPENDENCYCHECK" />
10 + <Custom Action="$(var.Prefix)DependencyRequire$(var.Suffix)" Before="$(var.Prefix)DependencyCheck$(var.Suffix)" Overridable="yes" Condition="NOT DISABLEDEPENDENCYCHECK" />
11 </InstallExecuteSequence>
12 <UIRef Id="WixDependencyErrors" />
13 <PropertyRef Id="DISABLEDEPENDENCYCHECK" />