aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Arnson <bob@firegiant.com>2019-01-16 16:25:46 -0500
committerRob Mensching <rob@robmensching.com>2019-01-16 13:31:40 -0800
commit214f53de1c6500aa8dd46e9604c90178807fda1a (patch)
treefab56b9447dc618ec0730703f131a23a669af11a
parenta8e31958d7e1b0ef10ea8035abf1e3bf07170eb8 (diff)
downloadwix-214f53de1c6500aa8dd46e9604c90178807fda1a.tar.gz
wix-214f53de1c6500aa8dd46e9604c90178807fda1a.tar.bz2
wix-214f53de1c6500aa8dd46e9604c90178807fda1a.zip
Fix overridable actions being tagged as duplicates.
-rw-r--r--src/WixToolset.Core.TestPackage/WixRunnerResult.cs24
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs2
-rw-r--r--src/WixToolset.Core/Link/ResolveReferencesCommand.cs20
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/LinkerFixture.cs54
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/OverridableActions/Package.en-us.wxl11
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/OverridableActions/Package.wxs49
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/OverridableActions/PackageComponents.wxs10
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/OverridableActions/data/test.txt1
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj4
9 files changed, 165 insertions, 10 deletions
diff --git a/src/WixToolset.Core.TestPackage/WixRunnerResult.cs b/src/WixToolset.Core.TestPackage/WixRunnerResult.cs
index 8fc7e14f..f4870ae3 100644
--- a/src/WixToolset.Core.TestPackage/WixRunnerResult.cs
+++ b/src/WixToolset.Core.TestPackage/WixRunnerResult.cs
@@ -1,9 +1,9 @@
1// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. 1// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2 2
3namespace WixToolset.Core.TestPackage 3namespace WixToolset.Core.TestPackage
4{ 4{
5 using System; 5 using System;
6 using System.Linq; 6 using System.Collections.Generic;
7 using WixToolset.Data; 7 using WixToolset.Data;
8 using Xunit; 8 using Xunit;
9 9
@@ -15,8 +15,26 @@ namespace WixToolset.Core.TestPackage
15 15
16 public WixRunnerResult AssertSuccess() 16 public WixRunnerResult AssertSuccess()
17 { 17 {
18 Assert.True(0 == this.ExitCode, $"\r\n\r\nWixRunner failed with exit code: {this.ExitCode}\r\n Output: {String.Join("\r\n ", this.Messages.Select(m => m.ToString()).ToArray())}\r\n"); 18 Assert.True(0 == this.ExitCode, $"\r\n\r\nWixRunner failed with exit code: {this.ExitCode}\r\n Output: {String.Join("\r\n ", FormatMessages(this.Messages))}\r\n");
19 return this; 19 return this;
20 } 20 }
21
22 private static IEnumerable<string> FormatMessages(IEnumerable<Message> messages)
23 {
24 foreach (var message in messages)
25 {
26 var filename = message.SourceLineNumbers?.FileName ?? "TEST";
27 var line = message.SourceLineNumbers?.LineNumber ?? -1;
28 var type = message.Level.ToString().ToLowerInvariant();
29 var output = message.Level >= MessageLevel.Warning ? Console.Out : Console.Error;
30
31 if (line > 0)
32 {
33 filename = String.Concat(filename, "(", line, ")");
34 }
35
36 yield return String.Format("{0} : {1} {2}{3:0000}: {4}", filename, type, "TEST", message.Id, message.ToString());
37 }
38 }
21 } 39 }
22} 40}
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs
index 0a356ba9..20df1fe8 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/SequenceActionsCommand.cs
@@ -92,7 +92,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
92 } 92 }
93 } 93 }
94 94
95 if (overridableActionRows.TryGetValue(actionRow.Id.Id, out var collidingActionRow)) 95 if (requiredActionRows.TryGetValue(actionRow.Id.Id, out var collidingActionRow))
96 { 96 {
97 this.Messaging.Write(ErrorMessages.ActionCollision(actionRow.SourceLineNumbers, actionRow.SequenceTable.ToString(), actionRow.Action)); 97 this.Messaging.Write(ErrorMessages.ActionCollision(actionRow.SourceLineNumbers, actionRow.SequenceTable.ToString(), actionRow.Action));
98 if (null != collidingActionRow.SourceLineNumbers) 98 if (null != collidingActionRow.SourceLineNumbers)
diff --git a/src/WixToolset.Core/Link/ResolveReferencesCommand.cs b/src/WixToolset.Core/Link/ResolveReferencesCommand.cs
index 07eabbd6..ed11095f 100644
--- a/src/WixToolset.Core/Link/ResolveReferencesCommand.cs
+++ b/src/WixToolset.Core/Link/ResolveReferencesCommand.cs
@@ -66,7 +66,7 @@ namespace WixToolset.Core.Link
66 { 66 {
67 // If we're building a Merge Module, ignore all references to the Media table 67 // If we're building a Merge Module, ignore all references to the Media table
68 // because Merge Modules don't have Media tables. 68 // because Merge Modules don't have Media tables.
69 if (this.BuildingMergeModule && wixSimpleReferenceRow.Table== "Media") 69 if (this.BuildingMergeModule && wixSimpleReferenceRow.Table == "Media")
70 { 70 {
71 continue; 71 continue;
72 } 72 }
@@ -77,7 +77,7 @@ namespace WixToolset.Core.Link
77 } 77 }
78 else // see if the symbol (and any of its duplicates) are appropriately accessible. 78 else // see if the symbol (and any of its duplicates) are appropriately accessible.
79 { 79 {
80 IList<Symbol> accessible = DetermineAccessibleSymbols(section, symbol); 80 IList<Symbol> accessible = this.DetermineAccessibleSymbols(section, symbol);
81 if (!accessible.Any()) 81 if (!accessible.Any())
82 { 82 {
83 this.Messaging.Write(ErrorMessages.UnresolvedReference(wixSimpleReferenceRow.SourceLineNumbers, wixSimpleReferenceRow.SymbolicName, symbol.Access)); 83 this.Messaging.Write(ErrorMessages.UnresolvedReference(wixSimpleReferenceRow.SourceLineNumbers, wixSimpleReferenceRow.SymbolicName, symbol.Access));
@@ -89,7 +89,7 @@ namespace WixToolset.Core.Link
89 89
90 if (null != accessibleSymbol.Section) 90 if (null != accessibleSymbol.Section)
91 { 91 {
92 RecursivelyResolveReferences(accessibleSymbol.Section); 92 this.RecursivelyResolveReferences(accessibleSymbol.Section);
93 } 93 }
94 } 94 }
95 else // display errors for the duplicate symbols. 95 else // display errors for the duplicate symbols.
@@ -125,14 +125,22 @@ namespace WixToolset.Core.Link
125 { 125 {
126 List<Symbol> symbols = new List<Symbol>(); 126 List<Symbol> symbols = new List<Symbol>();
127 127
128 if (AccessibleSymbol(referencingSection, symbol)) 128 if (this.AccessibleSymbol(referencingSection, symbol))
129 { 129 {
130 symbols.Add(symbol); 130 symbols.Add(symbol);
131 } 131 }
132 132
133 foreach (Symbol dupe in symbol.PossiblyConflictingSymbols) 133 foreach (Symbol dupe in symbol.PossiblyConflictingSymbols)
134 { 134 {
135 if (AccessibleSymbol(referencingSection, dupe)) 135 // don't count overridable WixActionTuples
136 WixActionTuple symbolAction = symbol.Row as WixActionTuple;
137 WixActionTuple dupeAction = dupe.Row as WixActionTuple;
138 if (symbolAction?.Overridable != dupeAction?.Overridable)
139 {
140 continue;
141 }
142
143 if (this.AccessibleSymbol(referencingSection, dupe))
136 { 144 {
137 symbols.Add(dupe); 145 symbols.Add(dupe);
138 } 146 }
@@ -140,7 +148,7 @@ namespace WixToolset.Core.Link
140 148
141 foreach (Symbol dupe in symbol.RedundantSymbols) 149 foreach (Symbol dupe in symbol.RedundantSymbols)
142 { 150 {
143 if (AccessibleSymbol(referencingSection, dupe)) 151 if (this.AccessibleSymbol(referencingSection, dupe))
144 { 152 {
145 symbols.Add(dupe); 153 symbols.Add(dupe);
146 } 154 }
diff --git a/src/test/WixToolsetTest.CoreIntegration/LinkerFixture.cs b/src/test/WixToolsetTest.CoreIntegration/LinkerFixture.cs
new file mode 100644
index 00000000..fcbff1aa
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/LinkerFixture.cs
@@ -0,0 +1,54 @@
1
2// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4namespace WixToolsetTest.CoreIntegration
5{
6 using System.IO;
7 using System.Linq;
8 using WixBuildTools.TestSupport;
9 using WixToolset.Core.TestPackage;
10 using WixToolset.Data;
11 using WixToolset.Data.Tuples;
12 using WixToolset.Data.WindowsInstaller;
13 using Xunit;
14
15 public class LinkerFixture
16 {
17 [Fact]
18 public void CanBuildWithOverridableActions()
19 {
20 var folder = TestData.Get(@"TestData\OverridableActions");
21
22 using (var fs = new DisposableFileSystem())
23 {
24 var baseFolder = fs.GetFolder();
25 var intermediateFolder = Path.Combine(baseFolder, "obj");
26
27 var result = WixRunner.Execute(new[]
28 {
29 "build",
30 Path.Combine(folder, "Package.wxs"),
31 Path.Combine(folder, "PackageComponents.wxs"),
32 "-loc", Path.Combine(folder, "Package.en-us.wxl"),
33 "-bindpath", Path.Combine(folder, "data"),
34 "-intermediateFolder", intermediateFolder,
35 "-o", Path.Combine(baseFolder, @"bin\test.msi")
36 });
37
38 result.AssertSuccess();
39
40 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.msi")));
41 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\test.wixpdb")));
42 Assert.True(File.Exists(Path.Combine(baseFolder, @"bin\MsiPackage\test.txt")));
43
44 var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"test.wir"));
45 var section = intermediate.Sections.Single();
46
47 var actions = section.Tuples.OfType<WixActionTuple>().Where(wat => wat.Action.StartsWith("Set")).ToList();
48 Assert.Equal(2, actions.Count);
49 //Assert.Equal(Path.Combine(folder, @"data\test.txt"), wixFile[WixFileTupleFields.Source].AsPath().Path);
50 //Assert.Equal(@"test.txt", wixFile[WixFileTupleFields.Source].PreviousValue.AsPath().Path);
51 }
52 }
53 }
54}
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/OverridableActions/Package.en-us.wxl b/src/test/WixToolsetTest.CoreIntegration/TestData/OverridableActions/Package.en-us.wxl
new file mode 100644
index 00000000..38c12ac1
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/OverridableActions/Package.en-us.wxl
@@ -0,0 +1,11 @@
1<?xml version="1.0" encoding="utf-8"?>
2
3<!--
4This file contains the declaration of all the localizable strings.
5-->
6<WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US">
7
8 <String Id="DowngradeError">A newer version of [ProductName] is already installed.</String>
9 <String Id="FeatureTitle">MsiPackage</String>
10
11</WixLocalization>
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/OverridableActions/Package.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/OverridableActions/Package.wxs
new file mode 100644
index 00000000..d8743747
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/OverridableActions/Package.wxs
@@ -0,0 +1,49 @@
1<?xml version="1.0" encoding="utf-8"?>
2
3<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
4 <Product Id="*" Name="MsiPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a">
5 <Package InstallerVersion="200" Compressed="no" InstallScope="perMachine" />
6
7 <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
8 <MediaTemplate />
9
10 <Feature Id="ProductFeature" Title="!(loc.FeatureTitle)">
11 <ComponentGroupRef Id="ProductComponents" />
12 <ComponentGroupRef Id="Foo1" />
13 <ComponentGroupRef Id="Foo2" />
14 </Feature>
15
16 <!--<CustomActionRef Id="SetFoo" />-->
17
18 </Product>
19
20 <Fragment Id="SetFoo">
21 <CustomAction Id="SetFoo" Property="FOO" Value="BOB" />
22 <CustomAction Id="SetBar" Property="BAR" Value="BOB" />
23 </Fragment>
24
25 <Fragment Id="Foo1">
26 <ComponentGroup Id="Foo1" />
27
28 <InstallExecuteSequence>
29 <Custom Action="SetFoo" Before="SetBar" />
30 <Custom Action="SetBar" Overridable="yes" Before="AppSearch" />
31 </InstallExecuteSequence>
32 </Fragment>
33
34 <Fragment Id="Foo2">
35 <ComponentGroup Id="Foo2" />
36
37 <InstallExecuteSequence>
38 <Custom Action="SetBar" Before="AppSearch" />
39 </InstallExecuteSequence>
40 </Fragment>
41
42 <Fragment Id="Directories">
43 <Directory Id="TARGETDIR" Name="SourceDir">
44 <Directory Id="ProgramFilesFolder">
45 <Directory Id="INSTALLFOLDER" Name="MsiPackage" />
46 </Directory>
47 </Directory>
48 </Fragment>
49</Wix>
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/OverridableActions/PackageComponents.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/OverridableActions/PackageComponents.wxs
new file mode 100644
index 00000000..e26c4509
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/OverridableActions/PackageComponents.wxs
@@ -0,0 +1,10 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 <Fragment>
4 <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
5 <Component>
6 <File Source="test.txt" />
7 </Component>
8 </ComponentGroup>
9 </Fragment>
10</Wix>
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/OverridableActions/data/test.txt b/src/test/WixToolsetTest.CoreIntegration/TestData/OverridableActions/data/test.txt
new file mode 100644
index 00000000..cd0db0e1
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/OverridableActions/data/test.txt
@@ -0,0 +1 @@
This is test.txt. \ No newline at end of file
diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
index 7365f140..2b202350 100644
--- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
+++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
@@ -77,6 +77,10 @@
77 <Content Include="TestData\Variables\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> 77 <Content Include="TestData\Variables\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
78 <Content Include="TestData\Variables\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> 78 <Content Include="TestData\Variables\Package.wxs" CopyToOutputDirectory="PreserveNewest" />
79 <Content Include="TestData\Variables\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" /> 79 <Content Include="TestData\Variables\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" />
80 <Content Include="TestData\OverridableActions\data\test.txt" CopyToOutputDirectory="PreserveNewest" />
81 <Content Include="TestData\OverridableActions\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
82 <Content Include="TestData\OverridableActions\Package.wxs" CopyToOutputDirectory="PreserveNewest" />
83 <Content Include="TestData\OverridableActions\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" />
80 </ItemGroup> 84 </ItemGroup>
81 85
82 <ItemGroup> 86 <ItemGroup>