aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core/Compiler_Bundle.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.Core/Compiler_Bundle.cs')
-rw-r--r--src/WixToolset.Core/Compiler_Bundle.cs139
1 files changed, 61 insertions, 78 deletions
diff --git a/src/WixToolset.Core/Compiler_Bundle.cs b/src/WixToolset.Core/Compiler_Bundle.cs
index 0ed49fbc..3be7d0c5 100644
--- a/src/WixToolset.Core/Compiler_Bundle.cs
+++ b/src/WixToolset.Core/Compiler_Bundle.cs
@@ -9,6 +9,7 @@ namespace WixToolset.Core
9 using System.IO; 9 using System.IO;
10 using System.Xml.Linq; 10 using System.Xml.Linq;
11 using WixToolset.Data; 11 using WixToolset.Data;
12 using WixToolset.Data.Burn;
12 using WixToolset.Data.Tuples; 13 using WixToolset.Data.Tuples;
13 using WixToolset.Extensibility; 14 using WixToolset.Extensibility;
14 15
@@ -17,15 +18,9 @@ namespace WixToolset.Core
17 /// </summary> 18 /// </summary>
18 internal partial class Compiler : ICompiler 19 internal partial class Compiler : ICompiler
19 { 20 {
20 public static readonly Identifier BurnUXContainerId = new Identifier(AccessModifier.Private, "WixUXContainer"); 21 private static readonly Identifier BurnUXContainerId = new Identifier(AccessModifier.Private, BurnConstants.BurnUXContainerName);
21 public static readonly Identifier BurnDefaultAttachedContainerId = new Identifier(AccessModifier.Private, "WixAttachedContainer"); 22 private static readonly Identifier BurnDefaultAttachedContainerId = new Identifier(AccessModifier.Private, BurnConstants.BurnDefaultAttachedContainerName);
22 public static readonly Identifier BundleLayoutOnlyPayloads = new Identifier(AccessModifier.Private, "BundleLayoutOnlyPayloads"); 23 private static readonly Identifier BundleLayoutOnlyPayloads = new Identifier(AccessModifier.Private, BurnConstants.BundleLayoutOnlyPayloadsName);
23
24 // The following constants must stay in sync with src\burn\engine\core.h
25 private const string BURN_BUNDLE_NAME = "WixBundleName";
26 private const string BURN_BUNDLE_ORIGINAL_SOURCE = "WixBundleOriginalSource";
27 private const string BURN_BUNDLE_ORIGINAL_SOURCE_FOLDER = "WixBundleOriginalSourceFolder";
28 private const string BURN_BUNDLE_LAST_USED_SOURCE = "WixBundleLastUsedSource";
29 24
30 /// <summary> 25 /// <summary>
31 /// Parses an ApprovedExeForElevation element. 26 /// Parses an ApprovedExeForElevation element.
@@ -78,11 +73,11 @@ namespace WixToolset.Core
78 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Key")); 73 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Key"));
79 } 74 }
80 75
81 var attributes = BundleApprovedExeForElevationAttributes.None; 76 var attributes = WixApprovedExeForElevationAttributes.None;
82 77
83 if (win64 == YesNoType.Yes) 78 if (win64 == YesNoType.Yes)
84 { 79 {
85 attributes |= BundleApprovedExeForElevationAttributes.Win64; 80 attributes |= WixApprovedExeForElevationAttributes.Win64;
86 } 81 }
87 82
88 this.Core.ParseForExtensionElements(node); 83 this.Core.ParseForExtensionElements(node);
@@ -92,7 +87,7 @@ namespace WixToolset.Core
92 var tuple = new WixApprovedExeForElevationTuple(sourceLineNumbers, id) 87 var tuple = new WixApprovedExeForElevationTuple(sourceLineNumbers, id)
93 { 88 {
94 Key = key, 89 Key = key,
95 Value = valueName, 90 ValueName = valueName,
96 Attributes = attributes 91 Attributes = attributes
97 }; 92 };
98 93
@@ -110,8 +105,7 @@ namespace WixToolset.Core
110 string copyright = null; 105 string copyright = null;
111 string aboutUrl = null; 106 string aboutUrl = null;
112 var compressed = YesNoDefaultType.Default; 107 var compressed = YesNoDefaultType.Default;
113 var disableModify = -1; 108 WixBundleAttributes attributes = 0;
114 var disableRemove = YesNoType.NotSet;
115 string helpTelephone = null; 109 string helpTelephone = null;
116 string helpUrl = null; 110 string helpUrl = null;
117 string manufacturer = null; 111 string manufacturer = null;
@@ -152,13 +146,12 @@ namespace WixToolset.Core
152 switch (value) 146 switch (value)
153 { 147 {
154 case "button": 148 case "button":
155 disableModify = 2; 149 attributes |= WixBundleAttributes.SingleChangeUninstallButton;
156 break; 150 break;
157 case "yes": 151 case "yes":
158 disableModify = 1; 152 attributes |= WixBundleAttributes.DisableModify;
159 break; 153 break;
160 case "no": 154 case "no":
161 disableModify = 0;
162 break; 155 break;
163 default: 156 default:
164 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, value, "button", "yes", "no")); 157 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName, value, "button", "yes", "no"));
@@ -166,10 +159,10 @@ namespace WixToolset.Core
166 } 159 }
167 break; 160 break;
168 case "DisableRemove": 161 case "DisableRemove":
169 disableRemove = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 162 if (YesNoType.Yes == this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
170 break; 163 {
171 case "DisableRepair": 164 attributes |= WixBundleAttributes.DisableRemove;
172 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName)); 165 }
173 break; 166 break;
174 case "HelpTelephone": 167 case "HelpTelephone":
175 helpTelephone = this.Core.GetAttributeValue(sourceLineNumbers, attrib); 168 helpTelephone = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
@@ -239,13 +232,13 @@ namespace WixToolset.Core
239 232
240 if (String.IsNullOrEmpty(name)) 233 if (String.IsNullOrEmpty(name))
241 { 234 {
242 logVariablePrefixAndExtension = String.Concat("WixBundleLog:Setup.log"); 235 logVariablePrefixAndExtension = String.Concat("WixBundleLog:Setup:.log");
243 } 236 }
244 else 237 else
245 { 238 {
246 // Ensure only allowable path characters are in "name" (and change spaces to underscores). 239 // Ensure only allowable path characters are in "name" (and change spaces to underscores).
247 fileSystemSafeBundleName = CompilerCore.MakeValidLongFileName(name.Replace(' ', '_'), "_"); 240 fileSystemSafeBundleName = CompilerCore.MakeValidLongFileName(name.Replace(' ', '_'), "_");
248 logVariablePrefixAndExtension = String.Concat("WixBundleLog:", fileSystemSafeBundleName, ".log"); 241 logVariablePrefixAndExtension = String.Concat("WixBundleLog:", fileSystemSafeBundleName, ":.log");
249 } 242 }
250 243
251 this.activeName = String.IsNullOrEmpty(name) ? Common.GenerateGuid() : name; 244 this.activeName = String.IsNullOrEmpty(name) ? Common.GenerateGuid() : name;
@@ -351,6 +344,37 @@ namespace WixToolset.Core
351 344
352 if (!this.Core.EncounteredError) 345 if (!this.Core.EncounteredError)
353 { 346 {
347 var tuple = new WixBundleTuple(sourceLineNumbers)
348 {
349 UpgradeCode = upgradeCode,
350 Version = version,
351 Copyright = copyright,
352 Name = name,
353 Manufacturer = manufacturer,
354 Attributes = attributes,
355 AboutUrl = aboutUrl,
356 HelpUrl = helpUrl,
357 HelpTelephone = helpTelephone,
358 UpdateUrl = updateUrl,
359 Compressed = YesNoDefaultType.Yes == compressed ? true : YesNoDefaultType.No == compressed ? (bool?)false : null,
360 IconSourceFile = iconSourceFile,
361 SplashScreenSourceFile = splashScreenSourceFile,
362 Condition = condition,
363 Tag = tag,
364 Platform = this.CurrentPlatform,
365 ParentName = parentName,
366 };
367
368 if (!String.IsNullOrEmpty(logVariablePrefixAndExtension))
369 {
370 var split = logVariablePrefixAndExtension.Split(':');
371 tuple.LogPathVariable = split[0];
372 tuple.LogPrefix = split[1];
373 tuple.LogExtension = split[2];
374 }
375
376 this.Core.AddTuple(tuple);;
377
354 if (null != upgradeCode) 378 if (null != upgradeCode)
355 { 379 {
356 this.Core.AddTuple(new WixRelatedBundleTuple(sourceLineNumbers) 380 this.Core.AddTuple(new WixRelatedBundleTuple(sourceLineNumbers)
@@ -360,64 +384,32 @@ namespace WixToolset.Core
360 }); 384 });
361 } 385 }
362 386
363 this.Core.AddTuple(new WixBundleContainerTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, Compiler.BurnDefaultAttachedContainerId)) 387 this.Core.AddTuple(new WixBundleContainerTuple(sourceLineNumbers, Compiler.BurnDefaultAttachedContainerId)
364 { 388 {
365 Name = "bundle-attached.cab", 389 Name = "bundle-attached.cab",
366 Type = ContainerType.Attached 390 Type = ContainerType.Attached
367 }); 391 });
368 392
369 var bundleTuple = this.Core.CreateTuple(sourceLineNumbers, TupleDefinitionType.WixBundle);
370 bundleTuple.Set(0, version);
371 bundleTuple.Set(1, copyright);
372 bundleTuple.Set(2, name);
373 bundleTuple.Set(3, aboutUrl);
374 if (-1 != disableModify)
375 {
376 bundleTuple.Set(4, disableModify);
377 }
378 if (YesNoType.NotSet != disableRemove)
379 {
380 bundleTuple.Set(5, (YesNoType.Yes == disableRemove) ? 1 : 0);
381 }
382 // row.Set(6] - (deprecated) "disable repair"
383 bundleTuple.Set(7, helpTelephone);
384 bundleTuple.Set(8, helpUrl);
385 bundleTuple.Set(9, manufacturer);
386 bundleTuple.Set(10, updateUrl);
387 if (YesNoDefaultType.Default != compressed)
388 {
389 bundleTuple.Set(11, (YesNoDefaultType.Yes == compressed) ? 1 : 0);
390 }
391
392 bundleTuple.Set(12, logVariablePrefixAndExtension);
393 bundleTuple.Set(13, iconSourceFile);
394 bundleTuple.Set(14, splashScreenSourceFile);
395 bundleTuple.Set(15, condition);
396 bundleTuple.Set(16, tag);
397 bundleTuple.Set(17, this.CurrentPlatform.ToString());
398 bundleTuple.Set(18, parentName);
399 bundleTuple.Set(19, upgradeCode);
400
401 // Ensure that the bundle stores the well-known persisted values. 393 // Ensure that the bundle stores the well-known persisted values.
402 this.Core.AddTuple(new WixBundleVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, Compiler.BURN_BUNDLE_NAME)) 394 this.Core.AddTuple(new WixBundleVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, BurnConstants.BURN_BUNDLE_NAME))
403 { 395 {
404 Hidden = false, 396 Hidden = false,
405 Persisted = true 397 Persisted = true
406 }); 398 });
407 399
408 this.Core.AddTuple(new WixBundleVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, Compiler.BURN_BUNDLE_ORIGINAL_SOURCE)) 400 this.Core.AddTuple(new WixBundleVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, BurnConstants.BURN_BUNDLE_ORIGINAL_SOURCE))
409 { 401 {
410 Hidden = false, 402 Hidden = false,
411 Persisted = true 403 Persisted = true
412 }); 404 });
413 405
414 this.Core.AddTuple(new WixBundleVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, Compiler.BURN_BUNDLE_ORIGINAL_SOURCE_FOLDER)) 406 this.Core.AddTuple(new WixBundleVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, BurnConstants.BURN_BUNDLE_ORIGINAL_SOURCE_FOLDER))
415 { 407 {
416 Hidden = false, 408 Hidden = false,
417 Persisted = true 409 Persisted = true
418 }); 410 });
419 411
420 this.Core.AddTuple(new WixBundleVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, Compiler.BURN_BUNDLE_LAST_USED_SOURCE)) 412 this.Core.AddTuple(new WixBundleVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, BurnConstants.BURN_BUNDLE_LAST_USED_SOURCE))
421 { 413 {
422 Hidden = false, 414 Hidden = false,
423 Persisted = true 415 Persisted = true
@@ -473,7 +465,7 @@ namespace WixToolset.Core
473 465
474 this.Core.ParseForExtensionElements(node); 466 this.Core.ParseForExtensionElements(node);
475 467
476 return YesNoType.Yes == disableLog ? null : String.Concat(variable, ":", logPrefix, logExtension); 468 return YesNoType.Yes == disableLog ? null : String.Join(":", variable, logPrefix, logExtension);
477 } 469 }
478 470
479 /// <summary> 471 /// <summary>
@@ -1126,9 +1118,9 @@ namespace WixToolset.Core
1126 tuple = new WixBundlePayloadTuple(sourceLineNumbers, id) 1118 tuple = new WixBundlePayloadTuple(sourceLineNumbers, id)
1127 { 1119 {
1128 Name = String.IsNullOrEmpty(name) ? Path.GetFileName(sourceFile) : name, 1120 Name = String.IsNullOrEmpty(name) ? Path.GetFileName(sourceFile) : name,
1129 SourceFile = sourceFile, 1121 SourceFile = new IntermediateFieldPathValue { Path = sourceFile },
1130 DownloadUrl = downloadUrl, 1122 DownloadUrl = downloadUrl,
1131 Compressed = compressed, 1123 Compressed = (compressed == YesNoDefaultType.Yes) ? true : (compressed == YesNoDefaultType.No) ? (bool?)false : null,
1132 UnresolvedSourceFile = sourceFile, // duplicate of sourceFile but in a string column so it won't get resolved to a full path during binding. 1124 UnresolvedSourceFile = sourceFile, // duplicate of sourceFile but in a string column so it won't get resolved to a full path during binding.
1133 DisplayName = displayName, 1125 DisplayName = displayName,
1134 Description = description, 1126 Description = description,
@@ -1665,14 +1657,12 @@ namespace WixToolset.Core
1665 var vital = YesNoType.Yes; 1657 var vital = YesNoType.Yes;
1666 string installCommand = null; 1658 string installCommand = null;
1667 string repairCommand = null; 1659 string repairCommand = null;
1668 var repairable = YesNoType.NotSet;
1669 string uninstallCommand = null; 1660 string uninstallCommand = null;
1670 var perMachine = YesNoDefaultType.NotSet; 1661 var perMachine = YesNoDefaultType.NotSet;
1671 string detectCondition = null; 1662 string detectCondition = null;
1672 string protocol = null; 1663 string protocol = null;
1673 var installSize = CompilerConstants.IntegerNotSet; 1664 var installSize = CompilerConstants.IntegerNotSet;
1674 string msuKB = null; 1665 string msuKB = null;
1675 var suppressLooseFilePayloadGeneration = YesNoType.NotSet;
1676 var enableSignatureVerification = YesNoType.No; 1666 var enableSignatureVerification = YesNoType.No;
1677 var compressed = YesNoDefaultType.Default; 1667 var compressed = YesNoDefaultType.Default;
1678 var displayInternalUI = YesNoType.NotSet; 1668 var displayInternalUI = YesNoType.NotSet;
@@ -1779,7 +1769,6 @@ namespace WixToolset.Core
1779 break; 1769 break;
1780 case "RepairCommand": 1770 case "RepairCommand":
1781 repairCommand = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty); 1771 repairCommand = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty);
1782 repairable = YesNoType.Yes;
1783 allowed = (packageType == WixBundlePackageType.Exe); 1772 allowed = (packageType == WixBundlePackageType.Exe);
1784 break; 1773 break;
1785 case "UninstallCommand": 1774 case "UninstallCommand":
@@ -1808,11 +1797,6 @@ namespace WixToolset.Core
1808 case "Compressed": 1797 case "Compressed":
1809 compressed = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib); 1798 compressed = this.Core.GetAttributeYesNoDefaultValue(sourceLineNumbers, attrib);
1810 break; 1799 break;
1811 case "SuppressLooseFilePayloadGeneration":
1812 this.Core.Write(WarningMessages.DeprecatedAttribute(sourceLineNumbers, node.Name.LocalName, attrib.Name.LocalName));
1813 suppressLooseFilePayloadGeneration = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
1814 allowed = (packageType == WixBundlePackageType.Msi);
1815 break;
1816 case "EnableSignatureVerification": 1800 case "EnableSignatureVerification":
1817 enableSignatureVerification = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 1801 enableSignatureVerification = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
1818 break; 1802 break;
@@ -2076,7 +2060,7 @@ namespace WixToolset.Core
2076 case WixBundlePackageType.Exe: 2060 case WixBundlePackageType.Exe:
2077 this.Core.AddTuple(new WixBundleExePackageTuple(sourceLineNumbers, id) 2061 this.Core.AddTuple(new WixBundleExePackageTuple(sourceLineNumbers, id)
2078 { 2062 {
2079 Attributes = (YesNoType.Yes == repairable) ? WixBundleExePackageAttributes.Repairable : 0, 2063 Attributes = WixBundleExePackageAttributes.None,
2080 DetectCondition = detectCondition, 2064 DetectCondition = detectCondition,
2081 InstallCommand = installCommand, 2065 InstallCommand = installCommand,
2082 RepairCommand = repairCommand, 2066 RepairCommand = repairCommand,
@@ -2090,7 +2074,6 @@ namespace WixToolset.Core
2090 msiAttributes |= (YesNoType.Yes == displayInternalUI) ? WixBundleMsiPackageAttributes.DisplayInternalUI : 0; 2074 msiAttributes |= (YesNoType.Yes == displayInternalUI) ? WixBundleMsiPackageAttributes.DisplayInternalUI : 0;
2091 msiAttributes |= (YesNoType.Yes == enableFeatureSelection) ? WixBundleMsiPackageAttributes.EnableFeatureSelection : 0; 2075 msiAttributes |= (YesNoType.Yes == enableFeatureSelection) ? WixBundleMsiPackageAttributes.EnableFeatureSelection : 0;
2092 msiAttributes |= (YesNoType.Yes == forcePerMachine) ? WixBundleMsiPackageAttributes.ForcePerMachine : 0; 2076 msiAttributes |= (YesNoType.Yes == forcePerMachine) ? WixBundleMsiPackageAttributes.ForcePerMachine : 0;
2093 msiAttributes |= (YesNoType.Yes == suppressLooseFilePayloadGeneration) ? WixBundleMsiPackageAttributes.SuppressLooseFilePayloadGeneration : 0;
2094 2077
2095 this.Core.AddTuple(new WixBundleMsiPackageTuple(sourceLineNumbers, id) 2078 this.Core.AddTuple(new WixBundleMsiPackageTuple(sourceLineNumbers, id)
2096 { 2079 {
@@ -2458,9 +2441,9 @@ namespace WixToolset.Core
2458 2441
2459 if (!this.Core.EncounteredError) 2442 if (!this.Core.EncounteredError)
2460 { 2443 {
2461 var tuple = new WixBundleMsiPropertyTuple(sourceLineNumbers) 2444 var tuple = new WixBundleMsiPropertyTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, packageId, name))
2462 { 2445 {
2463 WixBundlePackageRef = packageId, 2446 PackageRef = packageId,
2464 Name = name, 2447 Name = name,
2465 Value = value 2448 Value = value
2466 }; 2449 };
@@ -2514,10 +2497,10 @@ namespace WixToolset.Core
2514 2497
2515 if (!this.Core.EncounteredError) 2498 if (!this.Core.EncounteredError)
2516 { 2499 {
2517 this.Core.AddTuple(new WixBundleSlipstreamMspTuple(sourceLineNumbers) 2500 this.Core.AddTuple(new WixBundleSlipstreamMspTuple(sourceLineNumbers, new Identifier(AccessModifier.Private, packageId, id))
2518 { 2501 {
2519 WixBundlePackageRef = packageId, 2502 TargetPackageRef = packageId,
2520 MspWixBundlePackageRef = id 2503 MspPackageRef = id
2521 }); 2504 });
2522 } 2505 }
2523 } 2506 }