diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2021-02-28 21:05:49 -0600 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2021-03-02 15:50:47 -0600 |
commit | 8b3488c8c77959f425d0e5f70d27c5b2b1c86125 (patch) | |
tree | 827dfa7caba09d7fa032c317505a590bb834c4e6 /src/WixToolset.Core | |
parent | a6013a643208a8d1fc2d1136ef8d3a6c3e909522 (diff) | |
download | wix-8b3488c8c77959f425d0e5f70d27c5b2b1c86125.tar.gz wix-8b3488c8c77959f425d0e5f70d27c5b2b1c86125.tar.bz2 wix-8b3488c8c77959f425d0e5f70d27c5b2b1c86125.zip |
Use new PackagePayload symbols for the package's payload.
#4183
Diffstat (limited to 'src/WixToolset.Core')
-rw-r--r-- | src/WixToolset.Core/Compile/CompilerPayload.cs | 93 | ||||
-rw-r--r-- | src/WixToolset.Core/Compiler_Bundle.cs | 268 | ||||
-rw-r--r-- | src/WixToolset.Core/Linker.cs | 2 |
3 files changed, 256 insertions, 107 deletions
diff --git a/src/WixToolset.Core/Compile/CompilerPayload.cs b/src/WixToolset.Core/Compile/CompilerPayload.cs index 4eda56f8..7a5fd1b2 100644 --- a/src/WixToolset.Core/Compile/CompilerPayload.cs +++ b/src/WixToolset.Core/Compile/CompilerPayload.cs | |||
@@ -23,6 +23,8 @@ namespace WixToolset.Core | |||
23 | 23 | ||
24 | public Identifier Id { get; set; } | 24 | public Identifier Id { get; set; } |
25 | 25 | ||
26 | public bool IsRemoteAllowed { get; set; } | ||
27 | |||
26 | public bool IsRequired { get; set; } = true; | 28 | public bool IsRequired { get; set; } = true; |
27 | 29 | ||
28 | public string Name { get; set; } | 30 | public string Name { get; set; } |
@@ -48,26 +50,17 @@ namespace WixToolset.Core | |||
48 | 50 | ||
49 | private SourceLineNumber SourceLineNumbers { get; } | 51 | private SourceLineNumber SourceLineNumbers { get; } |
50 | 52 | ||
51 | private void CalculateAndVerifyFields(CompilerPayload remotePayload = null) | 53 | private void CalculateAndVerifyFields() |
52 | { | 54 | { |
55 | var isRemote = this.IsRemoteAllowed && !String.IsNullOrEmpty(this.Hash); | ||
56 | |||
53 | if (String.IsNullOrEmpty(this.SourceFile)) | 57 | if (String.IsNullOrEmpty(this.SourceFile)) |
54 | { | 58 | { |
55 | if (String.IsNullOrEmpty(this.Name)) | 59 | if (!String.IsNullOrEmpty(this.Name) && !isRemote) |
56 | { | ||
57 | if (this.IsRequired) | ||
58 | { | ||
59 | this.Core.Write(ErrorMessages.ExpectedAttributesWithOtherAttribute(this.SourceLineNumbers, this.Element.Name.LocalName, "Name", "SourceFile")); | ||
60 | } | ||
61 | } | ||
62 | else if (remotePayload == null) | ||
63 | { | 60 | { |
64 | this.SourceFile = Path.Combine("SourceDir", this.Name); | 61 | this.SourceFile = Path.Combine("SourceDir", this.Name); |
65 | } | 62 | } |
66 | } | 63 | } |
67 | else if (remotePayload != null) | ||
68 | { | ||
69 | this.Core.Write(ErrorMessages.UnexpectedElementWithAttribute(this.SourceLineNumbers, this.Element.Name.LocalName, "RemotePayload", "SourceFile")); | ||
70 | } | ||
71 | else if (this.SourceFile.EndsWith(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal)) | 64 | else if (this.SourceFile.EndsWith(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal)) |
72 | { | 65 | { |
73 | if (String.IsNullOrEmpty(this.Name)) | 66 | if (String.IsNullOrEmpty(this.Name)) |
@@ -80,24 +73,67 @@ namespace WixToolset.Core | |||
80 | } | 73 | } |
81 | } | 74 | } |
82 | 75 | ||
83 | if (remotePayload != null) | 76 | if (String.IsNullOrEmpty(this.SourceFile) && !isRemote) |
84 | { | 77 | { |
85 | if (this.DownloadUrl == null) | 78 | if (this.IsRequired) |
86 | { | 79 | { |
87 | this.Core.Write(ErrorMessages.ExpectedAttributeWithElement(this.SourceLineNumbers, this.Element.Name.LocalName, "DownloadUrl", "RemotePayload")); | 80 | if (!this.IsRemoteAllowed) |
81 | { | ||
82 | this.Core.Write(ErrorMessages.ExpectedAttributes(this.SourceLineNumbers, this.Element.Name.LocalName, "Name", "SourceFile")); | ||
83 | } | ||
84 | else | ||
85 | { | ||
86 | this.Core.Write(ErrorMessages.ExpectedAttributes(this.SourceLineNumbers, this.Element.Name.LocalName, "SourceFile", "Hash")); | ||
87 | } | ||
88 | } | 88 | } |
89 | } | ||
90 | else if (this.IsRemoteAllowed) | ||
91 | { | ||
92 | var isLocal = !String.IsNullOrEmpty(this.SourceFile); | ||
89 | 93 | ||
90 | if (YesNoDefaultType.No != this.Compressed) | 94 | if (isLocal) |
95 | { | ||
96 | if (isRemote) | ||
97 | { | ||
98 | this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(this.SourceLineNumbers, this.Element.Name.LocalName, "Hash", "SourceFile")); | ||
99 | } | ||
100 | } | ||
101 | else | ||
91 | { | 102 | { |
103 | if (String.IsNullOrEmpty(this.DownloadUrl)) | ||
104 | { | ||
105 | this.Core.Write(ErrorMessages.ExpectedAttribute(this.SourceLineNumbers, this.Element.Name.LocalName, "DownloadUrl", "Hash")); | ||
106 | } | ||
107 | |||
108 | if (String.IsNullOrEmpty(this.Name)) | ||
109 | { | ||
110 | this.Core.Write(ErrorMessages.ExpectedAttribute(this.SourceLineNumbers, this.Element.Name.LocalName, "Name", "Hash")); | ||
111 | } | ||
112 | |||
113 | if (YesNoDefaultType.Yes == this.Compressed) | ||
114 | { | ||
115 | this.Core.Write(WarningMessages.RemotePayloadsMustNotAlsoBeCompressed(this.SourceLineNumbers, this.Element.Name.LocalName)); | ||
116 | } | ||
117 | |||
92 | this.Compressed = YesNoDefaultType.No; | 118 | this.Compressed = YesNoDefaultType.No; |
93 | this.Core.Write(WarningMessages.RemotePayloadsMustNotAlsoBeCompressed(this.SourceLineNumbers, this.Element.Name.LocalName)); | ||
94 | } | 119 | } |
95 | 120 | ||
96 | this.Description = remotePayload.Description; | 121 | VerifyValidValue("Description", !String.IsNullOrEmpty(this.Description)); |
97 | this.DisplayName = remotePayload.DisplayName; | 122 | VerifyValidValue("ProductName", !String.IsNullOrEmpty(this.ProductName)); |
98 | this.Hash = remotePayload.Hash; | 123 | VerifyValidValue("Size", this.Size.HasValue); |
99 | this.Size = remotePayload.Size; | 124 | VerifyValidValue("Version", !String.IsNullOrEmpty(this.Version)); |
100 | this.Version = remotePayload.Version; | 125 | |
126 | void VerifyValidValue(string attributeName, bool isSpecified) | ||
127 | { | ||
128 | if (isLocal && isSpecified) | ||
129 | { | ||
130 | this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(this.SourceLineNumbers, this.Element.Name.LocalName, attributeName, "SourceFile")); | ||
131 | } | ||
132 | else if (!isLocal && !isSpecified) | ||
133 | { | ||
134 | this.Core.Write(ErrorMessages.ExpectedAttribute(this.SourceLineNumbers, this.Element.Name.LocalName, attributeName, "Hash")); | ||
135 | } | ||
136 | } | ||
101 | } | 137 | } |
102 | } | 138 | } |
103 | 139 | ||
@@ -143,9 +179,9 @@ namespace WixToolset.Core | |||
143 | return symbol; | 179 | return symbol; |
144 | } | 180 | } |
145 | 181 | ||
146 | public void FinishCompilingPackage(CompilerPayload remotePayload) | 182 | public void FinishCompilingPackage() |
147 | { | 183 | { |
148 | this.CalculateAndVerifyFields(remotePayload); | 184 | this.CalculateAndVerifyFields(); |
149 | this.GenerateIdFromFilename(); | 185 | this.GenerateIdFromFilename(); |
150 | 186 | ||
151 | if (this.Id == null) | 187 | if (this.Id == null) |
@@ -155,6 +191,13 @@ namespace WixToolset.Core | |||
155 | } | 191 | } |
156 | } | 192 | } |
157 | 193 | ||
194 | public void FinishCompilingPackagePayload() | ||
195 | { | ||
196 | this.CalculateAndVerifyFields(); | ||
197 | this.GenerateIdFromFilename(); | ||
198 | this.GenerateIdFromPrefix("ppy"); | ||
199 | } | ||
200 | |||
158 | public void FinishCompilingPayload() | 201 | public void FinishCompilingPayload() |
159 | { | 202 | { |
160 | this.CalculateAndVerifyFields(); | 203 | this.CalculateAndVerifyFields(); |
diff --git a/src/WixToolset.Core/Compiler_Bundle.cs b/src/WixToolset.Core/Compiler_Bundle.cs index 64fe2acc..60db75d6 100644 --- a/src/WixToolset.Core/Compiler_Bundle.cs +++ b/src/WixToolset.Core/Compiler_Bundle.cs | |||
@@ -1451,71 +1451,6 @@ namespace WixToolset.Core | |||
1451 | return compilerPayload.Id; | 1451 | return compilerPayload.Id; |
1452 | } | 1452 | } |
1453 | 1453 | ||
1454 | private CompilerPayload ParseRemotePayloadElement(XElement node) | ||
1455 | { | ||
1456 | var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); | ||
1457 | var remotePayload = new CompilerPayload(this.Core, sourceLineNumbers, node); | ||
1458 | |||
1459 | foreach (var attrib in node.Attributes()) | ||
1460 | { | ||
1461 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) | ||
1462 | { | ||
1463 | switch (attrib.Name.LocalName) | ||
1464 | { | ||
1465 | case "Description": | ||
1466 | remotePayload.ParseDescription(attrib); | ||
1467 | break; | ||
1468 | case "Hash": | ||
1469 | remotePayload.ParseHash(attrib); | ||
1470 | break; | ||
1471 | case "ProductName": | ||
1472 | remotePayload.ParseProductName(attrib); | ||
1473 | break; | ||
1474 | case "Size": | ||
1475 | remotePayload.ParseSize(attrib); | ||
1476 | break; | ||
1477 | case "Version": | ||
1478 | remotePayload.ParseVersion(attrib); | ||
1479 | break; | ||
1480 | default: | ||
1481 | this.Core.UnexpectedAttribute(node, attrib); | ||
1482 | break; | ||
1483 | } | ||
1484 | } | ||
1485 | else | ||
1486 | { | ||
1487 | this.Core.ParseExtensionAttribute(node, attrib); | ||
1488 | } | ||
1489 | } | ||
1490 | |||
1491 | if (String.IsNullOrEmpty(remotePayload.ProductName)) | ||
1492 | { | ||
1493 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "ProductName")); | ||
1494 | } | ||
1495 | |||
1496 | if (String.IsNullOrEmpty(remotePayload.Description)) | ||
1497 | { | ||
1498 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Description")); | ||
1499 | } | ||
1500 | |||
1501 | if (String.IsNullOrEmpty(remotePayload.Hash)) | ||
1502 | { | ||
1503 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Hash")); | ||
1504 | } | ||
1505 | |||
1506 | if (0 == remotePayload.Size) | ||
1507 | { | ||
1508 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Size")); | ||
1509 | } | ||
1510 | |||
1511 | if (String.IsNullOrEmpty(remotePayload.Version)) | ||
1512 | { | ||
1513 | this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Version")); | ||
1514 | } | ||
1515 | |||
1516 | return remotePayload; | ||
1517 | } | ||
1518 | |||
1519 | /// <summary> | 1454 | /// <summary> |
1520 | /// Parse PayloadGroup element. | 1455 | /// Parse PayloadGroup element. |
1521 | /// </summary> | 1456 | /// </summary> |
@@ -1561,8 +1496,21 @@ namespace WixToolset.Core | |||
1561 | { | 1496 | { |
1562 | if (CompilerCore.WixNamespace == child.Name.Namespace) | 1497 | if (CompilerCore.WixNamespace == child.Name.Namespace) |
1563 | { | 1498 | { |
1499 | WixBundlePackageType? packageType = null; | ||
1564 | switch (child.Name.LocalName) | 1500 | switch (child.Name.LocalName) |
1565 | { | 1501 | { |
1502 | case "ExePackagePayload": | ||
1503 | packageType = WixBundlePackageType.Exe; | ||
1504 | break; | ||
1505 | case "MsiPackagePayload": | ||
1506 | packageType = WixBundlePackageType.Msi; | ||
1507 | break; | ||
1508 | case "MspPackagePayload": | ||
1509 | packageType = WixBundlePackageType.Msp; | ||
1510 | break; | ||
1511 | case "MsuPackagePayload": | ||
1512 | packageType = WixBundlePackageType.Msu; | ||
1513 | break; | ||
1566 | case "Payload": | 1514 | case "Payload": |
1567 | previousId = this.ParsePayloadElement(child, ComplexReferenceParentType.PayloadGroup, id, previousType, previousId); | 1515 | previousId = this.ParsePayloadElement(child, ComplexReferenceParentType.PayloadGroup, id, previousType, previousId); |
1568 | previousType = ComplexReferenceChildType.Payload; | 1516 | previousType = ComplexReferenceChildType.Payload; |
@@ -1575,6 +1523,19 @@ namespace WixToolset.Core | |||
1575 | this.Core.UnexpectedElement(node, child); | 1523 | this.Core.UnexpectedElement(node, child); |
1576 | break; | 1524 | break; |
1577 | } | 1525 | } |
1526 | |||
1527 | if (packageType.HasValue) | ||
1528 | { | ||
1529 | var compilerPayload = this.ParsePackagePayloadElement(null, child, packageType.Value, null); | ||
1530 | var payloadSymbol = compilerPayload.CreatePayloadSymbol(ComplexReferenceParentType.PayloadGroup, id?.Id, previousType, previousId?.Id); | ||
1531 | if (payloadSymbol != null) | ||
1532 | { | ||
1533 | previousId = payloadSymbol.Id; | ||
1534 | previousType = ComplexReferenceChildType.Payload; | ||
1535 | |||
1536 | this.CreatePackagePayloadSymbol(payloadSymbol.SourceLineNumbers, packageType.Value, payloadSymbol.Id, ComplexReferenceParentType.PayloadGroup, id); | ||
1537 | } | ||
1538 | } | ||
1578 | } | 1539 | } |
1579 | else | 1540 | else |
1580 | { | 1541 | { |
@@ -1984,7 +1945,7 @@ namespace WixToolset.Core | |||
1984 | Debug.Assert(ComplexReferenceParentType.PackageGroup == parentType); | 1945 | Debug.Assert(ComplexReferenceParentType.PackageGroup == parentType); |
1985 | Debug.Assert(ComplexReferenceChildType.Unknown == previousType || ComplexReferenceChildType.PackageGroup == previousType || ComplexReferenceChildType.Package == previousType); | 1946 | Debug.Assert(ComplexReferenceChildType.Unknown == previousType || ComplexReferenceChildType.PackageGroup == previousType || ComplexReferenceChildType.Package == previousType); |
1986 | 1947 | ||
1987 | var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);; | 1948 | var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); |
1988 | var compilerPayload = new CompilerPayload(this.Core, sourceLineNumbers, node) | 1949 | var compilerPayload = new CompilerPayload(this.Core, sourceLineNumbers, node) |
1989 | { | 1950 | { |
1990 | IsRequired = false, | 1951 | IsRequired = false, |
@@ -2008,8 +1969,9 @@ namespace WixToolset.Core | |||
2008 | string msuKB = null; | 1969 | string msuKB = null; |
2009 | var enableFeatureSelection = YesNoType.NotSet; | 1970 | var enableFeatureSelection = YesNoType.NotSet; |
2010 | var forcePerMachine = YesNoType.NotSet; | 1971 | var forcePerMachine = YesNoType.NotSet; |
2011 | CompilerPayload remotePayload = null; | 1972 | CompilerPayload childPackageCompilerPayload = null; |
2012 | var slipstream = YesNoType.NotSet; | 1973 | var slipstream = YesNoType.NotSet; |
1974 | var hasPayloadInfo = false; | ||
2013 | 1975 | ||
2014 | var expectedNetFx4Args = new string[] { "/q", "/norestart", "/chainingpackage" }; | 1976 | var expectedNetFx4Args = new string[] { "/q", "/norestart", "/chainingpackage" }; |
2015 | 1977 | ||
@@ -2029,12 +1991,15 @@ namespace WixToolset.Core | |||
2029 | break; | 1991 | break; |
2030 | case "Name": | 1992 | case "Name": |
2031 | compilerPayload.ParseName(attrib); | 1993 | compilerPayload.ParseName(attrib); |
1994 | hasPayloadInfo = true; | ||
2032 | break; | 1995 | break; |
2033 | case "SourceFile": | 1996 | case "SourceFile": |
2034 | compilerPayload.ParseSourceFile(attrib); | 1997 | compilerPayload.ParseSourceFile(attrib); |
1998 | hasPayloadInfo = true; | ||
2035 | break; | 1999 | break; |
2036 | case "DownloadUrl": | 2000 | case "DownloadUrl": |
2037 | compilerPayload.ParseDownloadUrl(attrib); | 2001 | compilerPayload.ParseDownloadUrl(attrib); |
2002 | hasPayloadInfo = true; | ||
2038 | break; | 2003 | break; |
2039 | case "After": | 2004 | case "After": |
2040 | after = this.Core.GetAttributeValue(sourceLineNumbers, attrib); | 2005 | after = this.Core.GetAttributeValue(sourceLineNumbers, attrib); |
@@ -2128,6 +2093,7 @@ namespace WixToolset.Core | |||
2128 | break; | 2093 | break; |
2129 | case "Compressed": | 2094 | case "Compressed": |
2130 | compilerPayload.ParseCompressed(attrib); | 2095 | compilerPayload.ParseCompressed(attrib); |
2096 | hasPayloadInfo = true; | ||
2131 | break; | 2097 | break; |
2132 | case "Slipstream": | 2098 | case "Slipstream": |
2133 | slipstream = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); | 2099 | slipstream = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); |
@@ -2150,26 +2116,30 @@ namespace WixToolset.Core | |||
2150 | } | 2116 | } |
2151 | } | 2117 | } |
2152 | 2118 | ||
2153 | // We need to handle RemotePayload up front because it effects value of sourceFile which is used in Id generation. Id is needed by other child elements. | 2119 | // We need to handle the package payload up front because it affects Id generation. Id is needed by other child elements. |
2154 | foreach (var child in node.Elements(CompilerCore.WixNamespace + "RemotePayload")) | 2120 | var packagePayloadElementName = packageType + "PackagePayload"; |
2121 | foreach (var child in node.Elements(CompilerCore.WixNamespace + packagePayloadElementName)) | ||
2155 | { | 2122 | { |
2156 | var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); | 2123 | var childSourceLineNumbers = Preprocessor.GetSourceLineNumbers(child); |
2157 | 2124 | ||
2158 | if (CompilerCore.WixNamespace == node.Name.Namespace && node.Name.LocalName != "ExePackage" && node.Name.LocalName != "MsuPackage") | 2125 | if (childPackageCompilerPayload != null) |
2159 | { | 2126 | { |
2160 | this.Core.Write(ErrorMessages.RemotePayloadUnsupported(childSourceLineNumbers)); | 2127 | this.Core.Write(ErrorMessages.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, child.Name.LocalName)); |
2161 | continue; | ||
2162 | } | 2128 | } |
2163 | 2129 | else if (hasPayloadInfo) | |
2164 | if (null != remotePayload) | ||
2165 | { | 2130 | { |
2166 | this.Core.Write(ErrorMessages.TooManyChildren(childSourceLineNumbers, node.Name.LocalName, child.Name.LocalName)); | 2131 | this.Core.Write(ErrorMessages.UnexpectedElementWithAttribute(sourceLineNumbers, node.Name.LocalName, child.Name.LocalName, "SourceFile", "Name", "DownloadUrl", "Compressed")); |
2167 | } | 2132 | } |
2168 | 2133 | ||
2169 | remotePayload = this.ParseRemotePayloadElement(child); | 2134 | childPackageCompilerPayload = this.ParsePackagePayloadElement(childSourceLineNumbers, child, packageType, compilerPayload.Id); |
2135 | } | ||
2136 | |||
2137 | if (compilerPayload.Id == null && childPackageCompilerPayload != null) | ||
2138 | { | ||
2139 | compilerPayload.Id = childPackageCompilerPayload.Id; | ||
2170 | } | 2140 | } |
2171 | 2141 | ||
2172 | compilerPayload.FinishCompilingPackage(remotePayload); | 2142 | compilerPayload.FinishCompilingPackage(); |
2173 | var id = compilerPayload.Id; | 2143 | var id = compilerPayload.Id; |
2174 | 2144 | ||
2175 | if (null == logPathVariable) | 2145 | if (null == logPathVariable) |
@@ -2279,7 +2249,11 @@ namespace WixToolset.Core | |||
2279 | this.ParseCommandLineElement(child, id.Id); | 2249 | this.ParseCommandLineElement(child, id.Id); |
2280 | } | 2250 | } |
2281 | break; | 2251 | break; |
2282 | case "RemotePayload": | 2252 | case "ExePackagePayload": |
2253 | case "MsiPackagePayload": | ||
2254 | case "MspPackagePayload": | ||
2255 | case "MsuPackagePayload": | ||
2256 | allowed = packagePayloadElementName == child.Name.LocalName; | ||
2283 | // Handled previously | 2257 | // Handled previously |
2284 | break; | 2258 | break; |
2285 | default: | 2259 | default: |
@@ -2301,8 +2275,13 @@ namespace WixToolset.Core | |||
2301 | 2275 | ||
2302 | if (!this.Core.EncounteredError) | 2276 | if (!this.Core.EncounteredError) |
2303 | { | 2277 | { |
2304 | // We create the package contents as a payload with this package as the parent | 2278 | var packageCompilerPayload = childPackageCompilerPayload ?? (hasPayloadInfo ? compilerPayload : null); |
2305 | compilerPayload.CreatePayloadSymbol(ComplexReferenceParentType.Package, id.Id); | 2279 | if (packageCompilerPayload != null) |
2280 | { | ||
2281 | var payload = packageCompilerPayload.CreatePayloadSymbol(ComplexReferenceParentType.Package, id.Id); | ||
2282 | |||
2283 | this.CreatePackagePayloadSymbol(sourceLineNumbers, packageType, payload.Id, ComplexReferenceParentType.Package, id); | ||
2284 | } | ||
2306 | 2285 | ||
2307 | this.Core.AddSymbol(new WixChainItemSymbol(sourceLineNumbers, id)); | 2286 | this.Core.AddSymbol(new WixChainItemSymbol(sourceLineNumbers, id)); |
2308 | 2287 | ||
@@ -2313,7 +2292,6 @@ namespace WixToolset.Core | |||
2313 | var chainPackageSymbol = this.Core.AddSymbol(new WixBundlePackageSymbol(sourceLineNumbers, id) | 2292 | var chainPackageSymbol = this.Core.AddSymbol(new WixBundlePackageSymbol(sourceLineNumbers, id) |
2314 | { | 2293 | { |
2315 | Type = packageType, | 2294 | Type = packageType, |
2316 | PayloadRef = id.Id, | ||
2317 | Attributes = attributes, | 2295 | Attributes = attributes, |
2318 | InstallCondition = installCondition, | 2296 | InstallCondition = installCondition, |
2319 | CacheId = cacheId, | 2297 | CacheId = cacheId, |
@@ -2391,6 +2369,134 @@ namespace WixToolset.Core | |||
2391 | return id.Id; | 2369 | return id.Id; |
2392 | } | 2370 | } |
2393 | 2371 | ||
2372 | private void CreatePackagePayloadSymbol(SourceLineNumber sourceLineNumbers, WixBundlePackageType packageType, Identifier payloadId, ComplexReferenceParentType parentType, Identifier parentId) | ||
2373 | { | ||
2374 | switch (packageType) | ||
2375 | { | ||
2376 | case WixBundlePackageType.Exe: | ||
2377 | this.Core.AddSymbol(new WixBundleExePackagePayloadSymbol(sourceLineNumbers, payloadId)); | ||
2378 | break; | ||
2379 | |||
2380 | case WixBundlePackageType.Msi: | ||
2381 | this.Core.AddSymbol(new WixBundleMsiPackagePayloadSymbol(sourceLineNumbers, payloadId)); | ||
2382 | break; | ||
2383 | |||
2384 | case WixBundlePackageType.Msp: | ||
2385 | this.Core.AddSymbol(new WixBundleMspPackagePayloadSymbol(sourceLineNumbers, payloadId)); | ||
2386 | break; | ||
2387 | |||
2388 | case WixBundlePackageType.Msu: | ||
2389 | this.Core.AddSymbol(new WixBundleMsuPackagePayloadSymbol(sourceLineNumbers, payloadId)); | ||
2390 | break; | ||
2391 | } | ||
2392 | |||
2393 | this.Core.CreateGroupAndOrderingRows(sourceLineNumbers, parentType, parentId?.Id, ComplexReferenceChildType.PackagePayload, payloadId?.Id, ComplexReferenceChildType.Unknown, null); | ||
2394 | } | ||
2395 | |||
2396 | private CompilerPayload ParsePackagePayloadElement(SourceLineNumber sourceLineNumbers, XElement node, WixBundlePackageType packageType, Identifier defaultId) | ||
2397 | { | ||
2398 | sourceLineNumbers = sourceLineNumbers ?? Preprocessor.GetSourceLineNumbers(node); | ||
2399 | var compilerPayload = new CompilerPayload(this.Core, sourceLineNumbers, node) | ||
2400 | { | ||
2401 | Id = defaultId, | ||
2402 | IsRemoteAllowed = packageType == WixBundlePackageType.Exe || packageType == WixBundlePackageType.Msu, | ||
2403 | }; | ||
2404 | |||
2405 | // This list lets us evaluate extension attributes *after* all core attributes | ||
2406 | // have been parsed and dealt with, regardless of authoring order. | ||
2407 | var extensionAttributes = new List<XAttribute>(); | ||
2408 | |||
2409 | foreach (var attrib in node.Attributes()) | ||
2410 | { | ||
2411 | if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace) | ||
2412 | { | ||
2413 | var allowed = true; | ||
2414 | switch (attrib.Name.LocalName) | ||
2415 | { | ||
2416 | case "Id": | ||
2417 | compilerPayload.ParseId(attrib); | ||
2418 | break; | ||
2419 | case "Compressed": | ||
2420 | compilerPayload.ParseCompressed(attrib); | ||
2421 | break; | ||
2422 | case "Name": | ||
2423 | compilerPayload.ParseName(attrib); | ||
2424 | break; | ||
2425 | case "SourceFile": | ||
2426 | compilerPayload.ParseSourceFile(attrib); | ||
2427 | break; | ||
2428 | case "DownloadUrl": | ||
2429 | compilerPayload.ParseDownloadUrl(attrib); | ||
2430 | break; | ||
2431 | case "Description": | ||
2432 | allowed = compilerPayload.IsRemoteAllowed; | ||
2433 | if (allowed) | ||
2434 | { | ||
2435 | compilerPayload.ParseDescription(attrib); | ||
2436 | } | ||
2437 | break; | ||
2438 | case "Hash": | ||
2439 | allowed = compilerPayload.IsRemoteAllowed; | ||
2440 | if (allowed) | ||
2441 | { | ||
2442 | compilerPayload.ParseHash(attrib); | ||
2443 | } | ||
2444 | break; | ||
2445 | case "ProductName": | ||
2446 | allowed = compilerPayload.IsRemoteAllowed; | ||
2447 | if (allowed) | ||
2448 | { | ||
2449 | compilerPayload.ParseProductName(attrib); | ||
2450 | } | ||
2451 | break; | ||
2452 | case "Size": | ||
2453 | allowed = compilerPayload.IsRemoteAllowed; | ||
2454 | if (allowed) | ||
2455 | { | ||
2456 | compilerPayload.ParseSize(attrib); | ||
2457 | } | ||
2458 | break; | ||
2459 | case "Version": | ||
2460 | allowed = compilerPayload.IsRemoteAllowed; | ||
2461 | if (allowed) | ||
2462 | { | ||
2463 | compilerPayload.ParseVersion(attrib); | ||
2464 | } | ||
2465 | break; | ||
2466 | default: | ||
2467 | allowed = false; | ||
2468 | break; | ||
2469 | } | ||
2470 | |||
2471 | if (!allowed) | ||
2472 | { | ||
2473 | this.Core.UnexpectedAttribute(node, attrib); | ||
2474 | } | ||
2475 | } | ||
2476 | else | ||
2477 | { | ||
2478 | this.Core.ParseExtensionAttribute(node, attrib); | ||
2479 | } | ||
2480 | } | ||
2481 | |||
2482 | compilerPayload.FinishCompilingPackagePayload(); | ||
2483 | |||
2484 | // Now that the PayloadId is known, we can parse the extension attributes. | ||
2485 | var context = new Dictionary<string, string> | ||
2486 | { | ||
2487 | ["Id"] = compilerPayload.Id.Id, | ||
2488 | }; | ||
2489 | |||
2490 | foreach (var extensionAttribute in extensionAttributes) | ||
2491 | { | ||
2492 | this.Core.ParseExtensionAttribute(node, extensionAttribute, context); | ||
2493 | } | ||
2494 | |||
2495 | this.Core.ParseForExtensionElements(node); | ||
2496 | |||
2497 | return compilerPayload; | ||
2498 | } | ||
2499 | |||
2394 | /// <summary> | 2500 | /// <summary> |
2395 | /// Parse CommandLine element. | 2501 | /// Parse CommandLine element. |
2396 | /// </summary> | 2502 | /// </summary> |
diff --git a/src/WixToolset.Core/Linker.cs b/src/WixToolset.Core/Linker.cs index e0af89ba..41e0db7d 100644 --- a/src/WixToolset.Core/Linker.cs +++ b/src/WixToolset.Core/Linker.cs | |||
@@ -1242,7 +1242,7 @@ namespace WixToolset.Core | |||
1242 | var groups = new WixGroupingOrdering(entrySection, this.Messaging); | 1242 | var groups = new WixGroupingOrdering(entrySection, this.Messaging); |
1243 | 1243 | ||
1244 | // Create UX payloads and Package payloads | 1244 | // Create UX payloads and Package payloads |
1245 | groups.UseTypes(new[] { ComplexReferenceParentType.Container, ComplexReferenceParentType.Layout, ComplexReferenceParentType.PackageGroup, ComplexReferenceParentType.PayloadGroup, ComplexReferenceParentType.Package }, new[] { ComplexReferenceChildType.PackageGroup, ComplexReferenceChildType.Package, ComplexReferenceChildType.PayloadGroup, ComplexReferenceChildType.Payload }); | 1245 | groups.UseTypes(new[] { ComplexReferenceParentType.Container, ComplexReferenceParentType.Layout, ComplexReferenceParentType.PackageGroup, ComplexReferenceParentType.PayloadGroup, ComplexReferenceParentType.Package }, new[] { ComplexReferenceChildType.PackageGroup, ComplexReferenceChildType.Package, ComplexReferenceChildType.PackagePayload, ComplexReferenceChildType.PayloadGroup, ComplexReferenceChildType.Payload }); |
1246 | groups.FlattenAndRewriteGroups(ComplexReferenceParentType.Package, false); | 1246 | groups.FlattenAndRewriteGroups(ComplexReferenceParentType.Package, false); |
1247 | groups.FlattenAndRewriteGroups(ComplexReferenceParentType.Container, false); | 1247 | groups.FlattenAndRewriteGroups(ComplexReferenceParentType.Container, false); |
1248 | groups.FlattenAndRewriteGroups(ComplexReferenceParentType.Layout, false); | 1248 | groups.FlattenAndRewriteGroups(ComplexReferenceParentType.Layout, false); |