diff options
Diffstat (limited to 'src/wixext/BalBurnBackendExtension.cs')
-rw-r--r-- | src/wixext/BalBurnBackendExtension.cs | 71 |
1 files changed, 34 insertions, 37 deletions
diff --git a/src/wixext/BalBurnBackendExtension.cs b/src/wixext/BalBurnBackendExtension.cs index 20609964..e1082889 100644 --- a/src/wixext/BalBurnBackendExtension.cs +++ b/src/wixext/BalBurnBackendExtension.cs | |||
@@ -4,10 +4,10 @@ namespace WixToolset.Bal | |||
4 | { | 4 | { |
5 | using System; | 5 | using System; |
6 | using System.Linq; | 6 | using System.Linq; |
7 | using WixToolset.Bal.Tuples; | ||
7 | using WixToolset.Data; | 8 | using WixToolset.Data; |
8 | using WixToolset.Data.Burn; | 9 | using WixToolset.Data.Burn; |
9 | using WixToolset.Data.WindowsInstaller; | 10 | using WixToolset.Data.Tuples; |
10 | using WixToolset.Data.WindowsInstaller.Rows; | ||
11 | using WixToolset.Extensibility; | 11 | using WixToolset.Extensibility; |
12 | using WixToolset.Extensibility.Data; | 12 | using WixToolset.Extensibility.Data; |
13 | 13 | ||
@@ -17,17 +17,17 @@ namespace WixToolset.Bal | |||
17 | { | 17 | { |
18 | base.PostBackendBind(result); | 18 | base.PostBackendBind(result); |
19 | 19 | ||
20 | var output = WindowsInstallerData.Load(result.Wixout, false); | 20 | if (result.Wixout == null) |
21 | |||
22 | // Only process Bundles. | ||
23 | if (OutputType.Bundle != output.Type) | ||
24 | { | 21 | { |
22 | this.Messaging.Write(new Message(null, MessageLevel.Warning, 1, "BurnBackend didn't provide Wixout so skipping BalExtension PostBind verification.")); | ||
25 | return; | 23 | return; |
26 | } | 24 | } |
27 | 25 | ||
28 | var baTable = output.Tables["WixBootstrapperApplication"]; | 26 | var intermediate = Intermediate.Load(result.Wixout); |
29 | var baRow = baTable.Rows[0]; | 27 | var section = intermediate.Sections.Single(); |
30 | var baId = (string)baRow[0]; | 28 | |
29 | var baTuple = section.Tuples.OfType<WixBootstrapperApplicationTuple>().SingleOrDefault(); | ||
30 | var baId = baTuple?.Id?.Id; | ||
31 | if (null == baId) | 31 | if (null == baId) |
32 | { | 32 | { |
33 | return; | 33 | return; |
@@ -38,60 +38,57 @@ namespace WixToolset.Bal | |||
38 | 38 | ||
39 | if (isStdBA || isMBA) | 39 | if (isStdBA || isMBA) |
40 | { | 40 | { |
41 | this.VerifyBAFunctions(output); | 41 | this.VerifyBAFunctions(section); |
42 | } | 42 | } |
43 | 43 | ||
44 | if (isMBA) | 44 | if (isMBA) |
45 | { | 45 | { |
46 | this.VerifyPrereqPackages(output); | 46 | this.VerifyPrereqPackages(section); |
47 | } | 47 | } |
48 | } | 48 | } |
49 | 49 | ||
50 | private void VerifyBAFunctions(WindowsInstallerData output) | 50 | private void VerifyBAFunctions(IntermediateSection section) |
51 | { | 51 | { |
52 | Row baFunctionsRow = null; | 52 | WixBalBAFunctionsTuple baFunctionsTuple = null; |
53 | var baFunctionsTable = output.Tables["WixBalBAFunctions"]; | 53 | foreach (var tuple in section.Tuples.OfType<WixBalBAFunctionsTuple>()) |
54 | foreach (var row in baFunctionsTable.Rows) | ||
55 | { | 54 | { |
56 | if (null == baFunctionsRow) | 55 | if (null == baFunctionsTuple) |
57 | { | 56 | { |
58 | baFunctionsRow = row; | 57 | baFunctionsTuple = tuple; |
59 | } | 58 | } |
60 | else | 59 | else |
61 | { | 60 | { |
62 | this.Messaging.Write(BalErrors.MultipleBAFunctions(row.SourceLineNumbers)); | 61 | this.Messaging.Write(BalErrors.MultipleBAFunctions(tuple.SourceLineNumbers)); |
63 | } | 62 | } |
64 | } | 63 | } |
65 | 64 | ||
66 | var payloadPropertiesTable = output.Tables["WixPayloadProperties"]; | 65 | var payloadPropertiesTuples = section.Tuples.OfType<WixBundlePayloadTuple>().ToList(); |
67 | var payloadPropertiesRows = payloadPropertiesTable.Rows.Cast<WixPayloadPropertiesRow>(); | 66 | if (null == baFunctionsTuple) |
68 | if (null == baFunctionsRow) | ||
69 | { | 67 | { |
70 | foreach (var payloadPropertiesRow in payloadPropertiesRows) | 68 | foreach (var payloadPropertiesTuple in payloadPropertiesTuples) |
71 | { | 69 | { |
72 | // TODO: Make core WiX canonicalize Name (this won't catch '.\bafunctions.dll'). | 70 | // TODO: Make core WiX canonicalize Name (this won't catch '.\bafunctions.dll'). |
73 | if (string.Equals(payloadPropertiesRow.Name, "bafunctions.dll", StringComparison.OrdinalIgnoreCase)) | 71 | if (string.Equals(payloadPropertiesTuple.Name, "bafunctions.dll", StringComparison.OrdinalIgnoreCase)) |
74 | { | 72 | { |
75 | this.Messaging.Write(BalWarnings.UnmarkedBAFunctionsDLL(payloadPropertiesRow.SourceLineNumbers)); | 73 | this.Messaging.Write(BalWarnings.UnmarkedBAFunctionsDLL(payloadPropertiesTuple.SourceLineNumbers)); |
76 | } | 74 | } |
77 | } | 75 | } |
78 | } | 76 | } |
79 | else | 77 | else |
80 | { | 78 | { |
81 | // TODO: May need to revisit this depending on the outcome of #5273. | 79 | var payloadId = baFunctionsTuple.Id; |
82 | var payloadId = (string)baFunctionsRow[0]; | 80 | var bundlePayloadTuple = payloadPropertiesTuples.Single(x => payloadId == x.Id); |
83 | var bundlePayloadRow = payloadPropertiesRows.Single(x => payloadId == x.Id); | 81 | if (BurnConstants.BurnUXContainerName != bundlePayloadTuple.ContainerRef) |
84 | if (BurnConstants.BurnUXContainerName != bundlePayloadRow.Container) | ||
85 | { | 82 | { |
86 | this.Messaging.Write(BalErrors.BAFunctionsPayloadRequiredInUXContainer(baFunctionsRow.SourceLineNumbers)); | 83 | this.Messaging.Write(BalErrors.BAFunctionsPayloadRequiredInUXContainer(baFunctionsTuple.SourceLineNumbers)); |
87 | } | 84 | } |
88 | } | 85 | } |
89 | } | 86 | } |
90 | 87 | ||
91 | private void VerifyPrereqPackages(WindowsInstallerData output) | 88 | private void VerifyPrereqPackages(IntermediateSection section) |
92 | { | 89 | { |
93 | var prereqInfoTable = output.Tables["WixMbaPrereqInformation"]; | 90 | var prereqInfoTuples = section.Tuples.OfType<WixMbaPrereqInformationTuple>().ToList(); |
94 | if (null == prereqInfoTable || prereqInfoTable.Rows.Count == 0) | 91 | if (prereqInfoTuples.Count == 0) |
95 | { | 92 | { |
96 | this.Messaging.Write(BalErrors.MissingPrereq()); | 93 | this.Messaging.Write(BalErrors.MissingPrereq()); |
97 | return; | 94 | return; |
@@ -100,24 +97,24 @@ namespace WixToolset.Bal | |||
100 | var foundLicenseFile = false; | 97 | var foundLicenseFile = false; |
101 | var foundLicenseUrl = false; | 98 | var foundLicenseUrl = false; |
102 | 99 | ||
103 | foreach (Row prereqInfoRow in prereqInfoTable.Rows) | 100 | foreach (var prereqInfoTuple in prereqInfoTuples) |
104 | { | 101 | { |
105 | if (null != prereqInfoRow[1]) | 102 | if (null != prereqInfoTuple.LicenseFile) |
106 | { | 103 | { |
107 | if (foundLicenseFile || foundLicenseUrl) | 104 | if (foundLicenseFile || foundLicenseUrl) |
108 | { | 105 | { |
109 | this.Messaging.Write(BalErrors.MultiplePrereqLicenses(prereqInfoRow.SourceLineNumbers)); | 106 | this.Messaging.Write(BalErrors.MultiplePrereqLicenses(prereqInfoTuple.SourceLineNumbers)); |
110 | return; | 107 | return; |
111 | } | 108 | } |
112 | 109 | ||
113 | foundLicenseFile = true; | 110 | foundLicenseFile = true; |
114 | } | 111 | } |
115 | 112 | ||
116 | if (null != prereqInfoRow[2]) | 113 | if (null != prereqInfoTuple.LicenseUrl) |
117 | { | 114 | { |
118 | if (foundLicenseFile || foundLicenseUrl) | 115 | if (foundLicenseFile || foundLicenseUrl) |
119 | { | 116 | { |
120 | this.Messaging.Write(BalErrors.MultiplePrereqLicenses(prereqInfoRow.SourceLineNumbers)); | 117 | this.Messaging.Write(BalErrors.MultiplePrereqLicenses(prereqInfoTuple.SourceLineNumbers)); |
121 | return; | 118 | return; |
122 | } | 119 | } |
123 | 120 | ||