@joebigelow / wix-1 / commits / 0106f999

WIXFEAT:6209 - Move BA entry point to its own element.

Sean Hall committed Dec 8, 2020 at 15:09 UTC 0106f99945266b2391b18a8389d056375cfff0b0
9 files changed +101 -59
src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs
+4 -4
@@ -101,10 +101,10 @@ namespace WixToolset.Core.Burn
101
102 bundleSymbol.Attributes |= WixBundleAttributes.PerMachine; // default to per-machine but the first-per user package wil flip the bundle per-user.
103
104 - // Ensure there is one and only one row in the WixBootstrapperApplication table.
104 + // Ensure there is one and only one row in the WixBootstrapperApplicationDll table.
105 // The compiler and linker behavior should have colluded to get
106 // this behavior.
107 - var bundleApplicationSymbol = this.GetSingleSymbol<WixBootstrapperApplicationSymbol>();
107 + var bundleApplicationDllSymbol = this.GetSingleSymbol<WixBootstrapperApplicationDllSymbol>();
108
109 // Ensure there is one and only one row in the WixChain table.
110 // The compiler and linker behavior should have colluded to get
@@ -440,7 +440,7 @@ namespace WixToolset.Core.Burn
440 IEnumerable<WixBundlePayloadSymbol> uxPayloads;
441 IEnumerable<WixBundleContainerSymbol> containers;
442 {
443 - var command = new CreateNonUXContainers(this.BackendHelper, section, bundleApplicationSymbol, payloadSymbols, this.IntermediateFolder, layoutDirectory, this.DefaultCompressionLevel);
443 + var command = new CreateNonUXContainers(this.BackendHelper, section, bundleApplicationDllSymbol, payloadSymbols, this.IntermediateFolder, layoutDirectory, this.DefaultCompressionLevel);
444 command.Execute();
445
446 fileTransfers.AddRange(command.FileTransfers);
@@ -475,7 +475,7 @@ namespace WixToolset.Core.Burn
475 }
476
477 {
478 - var command = new CreateBundleExeCommand(this.Messaging, this.BackendHelper, this.IntermediateFolder, this.OutputPath, bundleApplicationSymbol, bundleSymbol, uxContainer, containers);
478 + var command = new CreateBundleExeCommand(this.Messaging, this.BackendHelper, this.IntermediateFolder, this.OutputPath, bundleApplicationDllSymbol, bundleSymbol, uxContainer, containers);
479 command.Execute();
480
481 fileTransfers.Add(command.Transfer);
src/WixToolset.Core.Burn/Bind/GenerateManifestDataFromIRCommand.cs
+1
@@ -61,6 +61,7 @@ namespace WixToolset.Core.Burn.Bind
61 case SymbolDefinitionType.ProvidesDependency:
62 case SymbolDefinitionType.WixApprovedExeForElevation:
63 case SymbolDefinitionType.WixBootstrapperApplication:
64 + case SymbolDefinitionType.WixBootstrapperApplicationDll:
65 case SymbolDefinitionType.WixBundle:
66 case SymbolDefinitionType.WixBundleCatalog:
67 case SymbolDefinitionType.WixBundleContainer:
src/WixToolset.Core.Burn/Bundles/CreateBundleExeCommand.cs
+5 -5
@@ -17,13 +17,13 @@ namespace WixToolset.Core.Burn.Bundles
17
18 internal class CreateBundleExeCommand
19 {
20 - public CreateBundleExeCommand(IMessaging messaging, IBackendHelper backendHelper, string intermediateFolder, string outputPath, WixBootstrapperApplicationSymbol bootstrapperApplicationSymbol, WixBundleSymbol bundleSymbol, WixBundleContainerSymbol uxContainer, IEnumerable<WixBundleContainerSymbol> containers)
20 + public CreateBundleExeCommand(IMessaging messaging, IBackendHelper backendHelper, string intermediateFolder, string outputPath, WixBootstrapperApplicationDllSymbol bootstrapperApplicationDllSymbol, WixBundleSymbol bundleSymbol, WixBundleContainerSymbol uxContainer, IEnumerable<WixBundleContainerSymbol> containers)
21 {
22 this.Messaging = messaging;
23 this.BackendHelper = backendHelper;
24 this.IntermediateFolder = intermediateFolder;
25 this.OutputPath = outputPath;
26 - this.BootstrapperApplicationSymbol = bootstrapperApplicationSymbol;
26 + this.BootstrapperApplicationDllSymbol = bootstrapperApplicationDllSymbol;
27 this.BundleSymbol = bundleSymbol;
28 this.UXContainer = uxContainer;
29 this.Containers = containers;
@@ -39,7 +39,7 @@ namespace WixToolset.Core.Burn.Bundles
39
40 private string OutputPath { get; }
41
42 - private WixBootstrapperApplicationSymbol BootstrapperApplicationSymbol { get; }
42 + private WixBootstrapperApplicationDllSymbol BootstrapperApplicationDllSymbol { get; }
43
44 private WixBundleSymbol BundleSymbol { get; }
45
@@ -72,7 +72,7 @@ namespace WixToolset.Core.Burn.Bundles
72
73 var windowsAssemblyVersion = GetWindowsAssemblyVersion(this.BundleSymbol);
74
75 - var applicationManifestData = GenerateApplicationManifest(this.BundleSymbol, this.BootstrapperApplicationSymbol, this.OutputPath, windowsAssemblyVersion);
75 + var applicationManifestData = GenerateApplicationManifest(this.BundleSymbol, this.BootstrapperApplicationDllSymbol, this.OutputPath, windowsAssemblyVersion);
76
77 UpdateBurnResources(bundleTempPath, this.OutputPath, this.BundleSymbol, windowsAssemblyVersion, applicationManifestData);
78
@@ -101,7 +101,7 @@ namespace WixToolset.Core.Burn.Bundles
101 }
102 }
103
104 - private static byte[] GenerateApplicationManifest(WixBundleSymbol bundleSymbol, WixBootstrapperApplicationSymbol bootstrapperApplicationSymbol, string outputPath, Version windowsAssemblyVersion)
104 + private static byte[] GenerateApplicationManifest(WixBundleSymbol bundleSymbol, WixBootstrapperApplicationDllSymbol bootstrapperApplicationSymbol, string outputPath, Version windowsAssemblyVersion)
105 {
106 const string asmv1Namespace = "urn:schemas-microsoft-com:asm.v1";
107 const string asmv3Namespace = "urn:schemas-microsoft-com:asm.v3";
src/WixToolset.Core.Burn/Bundles/CreateNonUXContainers.cs
+5 -5
@@ -14,11 +14,11 @@ namespace WixToolset.Core.Burn.Bundles
14
15 internal class CreateNonUXContainers
16 {
17 - public CreateNonUXContainers(IBackendHelper backendHelper, IntermediateSection section, WixBootstrapperApplicationSymbol bootstrapperApplicationSymbol, Dictionary<string, WixBundlePayloadSymbol> payloadSymbols, string intermediateFolder, string layoutFolder, CompressionLevel? defaultCompressionLevel)
17 + public CreateNonUXContainers(IBackendHelper backendHelper, IntermediateSection section, WixBootstrapperApplicationDllSymbol bootstrapperApplicationDllSymbol, Dictionary<string, WixBundlePayloadSymbol> payloadSymbols, string intermediateFolder, string layoutFolder, CompressionLevel? defaultCompressionLevel)
18 {
19 this.BackendHelper = backendHelper;
20 this.Section = section;
21 - this.BootstrapperApplicationSymbol = bootstrapperApplicationSymbol;
21 + this.BootstrapperApplicationDllSymbol = bootstrapperApplicationDllSymbol;
22 this.PayloadSymbols = payloadSymbols;
23 this.IntermediateFolder = intermediateFolder;
24 this.LayoutFolder = layoutFolder;
@@ -39,7 +39,7 @@ namespace WixToolset.Core.Burn.Bundles
39
40 private IntermediateSection Section { get; }
41
42 - private WixBootstrapperApplicationSymbol BootstrapperApplicationSymbol { get; }
42 + private WixBootstrapperApplicationDllSymbol BootstrapperApplicationDllSymbol { get; }
43
44 private Dictionary<string, WixBundlePayloadSymbol> PayloadSymbols { get; }
45
@@ -81,9 +81,9 @@ namespace WixToolset.Core.Burn.Bundles
81 container.WorkingPath = Path.Combine(this.IntermediateFolder, container.Name);
82 container.AttachedContainerIndex = 0;
83
84 - // Gather the list of UX payloads but ensure the BootstrapperApplication Payload is the first
84 + // Gather the list of UX payloads but ensure the BootstrapperApplicationDll Payload is the first
85 // in the list since that is the Payload that Burn attempts to load.
86 - var baPayloadId = this.BootstrapperApplicationSymbol.Id.Id;
86 + var baPayloadId = this.BootstrapperApplicationDllSymbol.Id.Id;
87
88 foreach (var uxPayload in containerPayloads)
89 {
src/WixToolset.Core/Compiler_Bundle.cs
+69 -32
@@ -647,18 +647,73 @@ namespace WixToolset.Core
647 private void ParseBootstrapperApplicationElement(XElement node)
648 {
649 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
650 + Identifier id = null;
651 Identifier previousId = null;
652 var previousType = ComplexReferenceChildType.Unknown;
652 - var dpiAwareness = WixBootstrapperApplicationDpiAwarenessType.PerMonitorV2;
653
654 - // The BootstrapperApplication element acts like a Payload element so delegate to the "Payload" attribute parsing code to parse and create a Payload entry.
655 - var hasSourceFile = this.ParsePayloadElementContent(node, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, previousType, previousId, false, out var id);
656 - if (hasSourceFile)
654 + foreach (var attrib in node.Attributes())
655 {
658 - previousId = id;
659 - previousType = ComplexReferenceChildType.Payload;
656 + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
657 + {
658 + switch (attrib.Name.LocalName)
659 + {
660 + case "Id":
661 + id = this.Core.GetAttributeIdentifier(sourceLineNumbers, attrib);
662 + break;
663 + default:
664 + this.Core.UnexpectedAttribute(node, attrib);
665 + break;
666 + }
667 + }
668 }
669
670 + foreach (var child in node.Elements())
671 + {
672 + if (CompilerCore.WixNamespace == child.Name.Namespace)
673 + {
674 + switch (child.Name.LocalName)
675 + {
676 + case "BootstrapperApplicationDll":
677 + previousId = this.ParseBootstrapperApplicationDllElement(child, previousType, previousId);
678 + previousType = ComplexReferenceChildType.Payload;
679 + break;
680 + case "Payload":
681 + previousId = this.ParsePayloadElement(child, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, previousType, previousId);
682 + previousType = ComplexReferenceChildType.Payload;
683 + break;
684 + case "PayloadGroupRef":
685 + previousId = this.ParsePayloadGroupRefElement(child, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, previousType, previousId);
686 + previousType = ComplexReferenceChildType.PayloadGroup;
687 + break;
688 + default:
689 + this.Core.UnexpectedElement(node, child);
690 + break;
691 + }
692 + }
693 + else
694 + {
695 + this.Core.ParseExtensionElement(node, child);
696 + }
697 + }
698 +
699 + if (id != null)
700 + {
701 + this.Core.AddSymbol(new WixBootstrapperApplicationSymbol(sourceLineNumbers, id));
702 + }
703 + }
704 +
705 + /// <summary>
706 + /// Parse the BoostrapperApplication element.
707 + /// </summary>
708 + /// <param name="node">Element to parse</param>
709 + private Identifier ParseBootstrapperApplicationDllElement(XElement node, ComplexReferenceChildType previousType, Identifier previousId)
710 + {
711 + var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
712 + var dpiAwareness = WixBootstrapperApplicationDpiAwarenessType.PerMonitorV2;
713 +
714 + // The BootstrapperApplicationDll element acts like a Payload element so delegate to the "Payload" attribute parsing code to parse and create a Payload entry.
715 + this.ParsePayloadElementContent(node, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, previousType, previousId, true, out var id);
716 +
717 foreach (var attrib in node.Attributes())
718 {
719 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
@@ -699,17 +754,9 @@ namespace WixToolset.Core
754 {
755 switch (child.Name.LocalName)
756 {
702 - case "Payload":
703 - previousId = this.ParsePayloadElement(child, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, previousType, previousId);
704 - previousType = ComplexReferenceChildType.Payload;
705 - break;
706 - case "PayloadGroupRef":
707 - previousId = this.ParsePayloadGroupRefElement(child, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, previousType, previousId);
708 - previousType = ComplexReferenceChildType.PayloadGroup;
709 - break;
710 - default:
711 - this.Core.UnexpectedElement(node, child);
712 - break;
757 + default:
758 + this.Core.UnexpectedElement(node, child);
759 + break;
760 }
761 }
762 else
@@ -718,15 +765,6 @@ namespace WixToolset.Core
765 }
766 }
767
721 - if (null == previousId)
722 - {
723 - // We need *either* <Payload> or <PayloadGroupRef> or even just @SourceFile on the BA...
724 - // but we just say there's a missing <Payload>.
725 - // TODO: Is there a better message for this?
726 - this.Core.Write(ErrorMessages.ExpectedElement(sourceLineNumbers, node.Name.LocalName, "Payload"));
727 - }
728 -
729 - // Add the application as an attached container and if a SourceFile was provided add the Id as the BA.
768 if (!this.Core.EncounteredError)
769 {
770 this.Core.AddSymbol(new WixBundleContainerSymbol(sourceLineNumbers, Compiler.BurnUXContainerId)
@@ -735,14 +773,13 @@ namespace WixToolset.Core
773 Type = ContainerType.Attached
774 });
775
738 - if (hasSourceFile)
776 + this.Core.AddSymbol(new WixBootstrapperApplicationDllSymbol(sourceLineNumbers, id)
777 {
740 - this.Core.AddSymbol(new WixBootstrapperApplicationSymbol(sourceLineNumbers, id)
741 - {
742 - DpiAwareness = dpiAwareness,
743 - });
744 - }
778 + DpiAwareness = dpiAwareness,
779 + });
780 }
781 +
782 + return id;
783 }
784
785 /// <summary>
src/test/Example.Extension/Data/example.wxs
+3 -2
@@ -1,4 +1,3 @@
1 -<?xml version='1.0'?>
1 <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
2 <Fragment>
3 <Property Id="PropertyFromExampleWir" Value="FromWir" />
@@ -6,7 +5,9 @@
5 <Binary Id="BinFromWir" SourceFile="example.txt" />
6 </Fragment>
7 <Fragment>
9 - <BootstrapperApplication Id="fakeba" SourceFile="example.txt" />
8 + <BootstrapperApplication Id="fakeba">
9 + <BootstrapperApplicationDll SourceFile="example.txt" />
10 + </BootstrapperApplication>
11 </Fragment>
12 <Fragment>
13 <BundleExtension Id="ExampleBundleExtension" SourceFile="example.txt" />
src/test/WixToolsetTest.CoreIntegration/TestData/BundleWithPackageGroupRef/Bundle.wxs
+3 -2
@@ -1,7 +1,8 @@
1 -<?xml version="1.0" encoding="utf-8"?>
1 <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
2 <Bundle Name="BurnBundle" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="B94478B1-E1F3-4700-9CE8-6AA090854AEC">
4 - <BootstrapperApplication SourceFile="fakeba.dll" />
3 + <BootstrapperApplication>
4 + <BootstrapperApplicationDll SourceFile="fakeba.dll" />
5 + </BootstrapperApplication>
6 <Chain>
7 <PackageGroupRef Id="BundlePackages" />
8 </Chain>
src/test/WixToolsetTest.CoreIntegration/TestData/SimpleBundle/Bundle.wxs
+8 -7
@@ -1,11 +1,12 @@
1 -<?xml version="1.0" encoding="utf-8"?>
1 <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
2 <Bundle Name="!(loc.BundleName)" Version="!(bind.packageVersion.test.msi)" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a">
4 - <BootstrapperApplication SourceFile="fakeba.dll" />
5 - <Chain>
6 - <MsiPackage SourceFile="test.msi">
7 - <MsiProperty Name="TEST" Value="1" />
8 - </MsiPackage>
9 - </Chain>
3 + <BootstrapperApplication>
4 + <BootstrapperApplicationDll SourceFile="fakeba.dll" />
5 + </BootstrapperApplication>
6 + <Chain>
7 + <MsiPackage SourceFile="test.msi">
8 + <MsiProperty Name="TEST" Value="1" />
9 + </MsiPackage>
10 + </Chain>
11 </Bundle>
12 </Wix>
src/test/WixToolsetTest.CoreIntegration/TestData/SimpleBundle/MultiFileBootstrapperApplication.wxs
+3 -2
@@ -1,6 +1,7 @@
1 -<?xml version="1.0" encoding="utf-8"?>
1 <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
2 <Fragment>
4 - <BootstrapperApplication Id="fakeba" SourceFile="fakeba.dll" />
3 + <BootstrapperApplication Id="fakeba">
4 + <BootstrapperApplicationDll SourceFile="fakeba.dll" />
5 + </BootstrapperApplication>
6 </Fragment>
7 </Wix>