aboutsummaryrefslogtreecommitdiff
path: root/src/ext/Bal/wixext
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2021-07-01 09:30:10 -0500
committerSean Hall <r.sean.hall@gmail.com>2021-07-02 12:50:09 -0500
commit9bdf3730cd43e1af8a4ea9be6cf2fba77fcff2d2 (patch)
treeea2a05de5a8a1dfcb2af8e9e3805fe015729f66a /src/ext/Bal/wixext
parent8cbfc326cccf8d9b3b63cb6f752fc770f7dee0fc (diff)
downloadwix-9bdf3730cd43e1af8a4ea9be6cf2fba77fcff2d2.tar.gz
wix-9bdf3730cd43e1af8a4ea9be6cf2fba77fcff2d2.tar.bz2
wix-9bdf3730cd43e1af8a4ea9be6cf2fba77fcff2d2.zip
Add bundle option for command line variables to always be uppercase.
Fixes #3777
Diffstat (limited to 'src/ext/Bal/wixext')
-rw-r--r--src/ext/Bal/wixext/BalBurnBackendExtension.cs21
-rw-r--r--src/ext/Bal/wixext/BalErrors.cs6
2 files changed, 27 insertions, 0 deletions
diff --git a/src/ext/Bal/wixext/BalBurnBackendExtension.cs b/src/ext/Bal/wixext/BalBurnBackendExtension.cs
index c6a1e0c1..854b8b35 100644
--- a/src/ext/Bal/wixext/BalBurnBackendExtension.cs
+++ b/src/ext/Bal/wixext/BalBurnBackendExtension.cs
@@ -31,6 +31,8 @@ namespace WixToolset.Bal
31 { 31 {
32 base.SymbolsFinalized(section); 32 base.SymbolsFinalized(section);
33 33
34 this.VerifyOverridableVariables(section);
35
34 var baSymbol = section.Symbols.OfType<WixBootstrapperApplicationDllSymbol>().SingleOrDefault(); 36 var baSymbol = section.Symbols.OfType<WixBootstrapperApplicationDllSymbol>().SingleOrDefault();
35 var baId = baSymbol?.Id?.Id; 37 var baId = baSymbol?.Id?.Id;
36 if (null == baId) 38 if (null == baId)
@@ -118,6 +120,25 @@ namespace WixToolset.Bal
118 } 120 }
119 } 121 }
120 122
123 private void VerifyOverridableVariables(IntermediateSection section)
124 {
125 var bundleSymbol = section.Symbols.OfType<WixBundleSymbol>().Single();
126 if (bundleSymbol.CommandLineVariables != WixBundleCommandLineVariables.UpperCase)
127 {
128 return;
129 }
130
131 var overridableVariableSymbols = section.Symbols.OfType<WixStdbaOverridableVariableSymbol>().ToList();
132 foreach (var overridableVariableSymbol in overridableVariableSymbols)
133 {
134 var upperName = overridableVariableSymbol.Name.ToUpperInvariant();
135 if (upperName != overridableVariableSymbol.Name)
136 {
137 this.Messaging.Write(BalErrors.NonUpperCaseOverridableVariable(overridableVariableSymbol.SourceLineNumbers, overridableVariableSymbol.Name, upperName));
138 }
139 }
140 }
141
121 private void VerifyPrereqPackages(IntermediateSection section, bool isDNC) 142 private void VerifyPrereqPackages(IntermediateSection section, bool isDNC)
122 { 143 {
123 var prereqInfoSymbols = section.Symbols.OfType<WixMbaPrereqInformationSymbol>().ToList(); 144 var prereqInfoSymbols = section.Symbols.OfType<WixMbaPrereqInformationSymbol>().ToList();
diff --git a/src/ext/Bal/wixext/BalErrors.cs b/src/ext/Bal/wixext/BalErrors.cs
index bc0186c1..e9f68b24 100644
--- a/src/ext/Bal/wixext/BalErrors.cs
+++ b/src/ext/Bal/wixext/BalErrors.cs
@@ -38,6 +38,11 @@ namespace WixToolset.Bal
38 return Message(sourceLineNumbers, Ids.MultiplePrereqLicenses, "There may only be one package in the bundle that has either the PrereqLicenseFile attribute or the PrereqLicenseUrl attribute."); 38 return Message(sourceLineNumbers, Ids.MultiplePrereqLicenses, "There may only be one package in the bundle that has either the PrereqLicenseFile attribute or the PrereqLicenseUrl attribute.");
39 } 39 }
40 40
41 public static Message NonUpperCaseOverridableVariable(SourceLineNumber sourceLineNumbers, string name, string expectedName)
42 {
43 return Message(sourceLineNumbers, Ids.NonUpperCaseOverridableVariable, "Overridable variable '{0}' must be '{1}' with Bundle/@CommandLineVariables value 'upperCase'.", name, expectedName);
44 }
45
41 private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args) 46 private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args)
42 { 47 {
43 return new Message(sourceLineNumber, MessageLevel.Error, (int)id, format, args); 48 return new Message(sourceLineNumber, MessageLevel.Error, (int)id, format, args);
@@ -56,6 +61,7 @@ namespace WixToolset.Bal
56 MultipleBAFunctions = 6804, 61 MultipleBAFunctions = 6804,
57 BAFunctionsPayloadRequiredInUXContainer = 6805, 62 BAFunctionsPayloadRequiredInUXContainer = 6805,
58 MissingDNCPrereq = 6806, 63 MissingDNCPrereq = 6806,
64 NonUpperCaseOverridableVariable = 6807,
59 } 65 }
60 } 66 }
61} 67}