diff options
author | Bevan Weiss <bevan.weiss@gmail.com> | 2024-06-18 19:03:40 +1000 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2025-02-11 23:14:49 -0800 |
commit | 7b1bb025dea1d1e9e144cce0dcbba2d86f053b8f (patch) | |
tree | c2fc969615d858ee40f54cfba406648e9c2743c3 /src/ext/Util/wixext/UtilCompiler.cs | |
parent | 040e50ec2859c1de70cd8e9f957474321774f293 (diff) | |
download | wix-7b1bb025dea1d1e9e144cce0dcbba2d86f053b8f.tar.gz wix-7b1bb025dea1d1e9e144cce0dcbba2d86f053b8f.tar.bz2 wix-7b1bb025dea1d1e9e144cce0dcbba2d86f053b8f.zip |
CreateGroups additions
Signed-off-by: Bevan Weiss <bevan.weiss@gmail.com>
Diffstat (limited to 'src/ext/Util/wixext/UtilCompiler.cs')
-rw-r--r-- | src/ext/Util/wixext/UtilCompiler.cs | 141 |
1 files changed, 133 insertions, 8 deletions
diff --git a/src/ext/Util/wixext/UtilCompiler.cs b/src/ext/Util/wixext/UtilCompiler.cs index 3bcd2c0b..aff7dd0d 100644 --- a/src/ext/Util/wixext/UtilCompiler.cs +++ b/src/ext/Util/wixext/UtilCompiler.cs | |||
@@ -139,6 +139,9 @@ namespace WixToolset.Util | |||
139 | case "TouchFile": | 139 | case "TouchFile": |
140 | this.ParseTouchFileElement(intermediate, section, element, componentId, componentWin64); | 140 | this.ParseTouchFileElement(intermediate, section, element, componentId, componentWin64); |
141 | break; | 141 | break; |
142 | case "Group": | ||
143 | this.ParseGroupElement(intermediate, section, element, componentId); | ||
144 | break; | ||
142 | case "User": | 145 | case "User": |
143 | this.ParseUserElement(intermediate, section, element, componentId); | 146 | this.ParseUserElement(intermediate, section, element, componentId); |
144 | break; | 147 | break; |
@@ -1357,6 +1360,8 @@ namespace WixToolset.Util | |||
1357 | Identifier id = null; | 1360 | Identifier id = null; |
1358 | string domain = null; | 1361 | string domain = null; |
1359 | string name = null; | 1362 | string name = null; |
1363 | string comment = null; | ||
1364 | Group6Symbol.SymbolAttributes attributes = Group6Symbol.SymbolAttributes.None; | ||
1360 | 1365 | ||
1361 | foreach (var attrib in element.Attributes()) | 1366 | foreach (var attrib in element.Attributes()) |
1362 | { | 1367 | { |
@@ -1373,6 +1378,75 @@ namespace WixToolset.Util | |||
1373 | case "Domain": | 1378 | case "Domain": |
1374 | domain = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | 1379 | domain = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); |
1375 | break; | 1380 | break; |
1381 | case "Comment": | ||
1382 | if (null == componentId) | ||
1383 | { | ||
1384 | this.Messaging.Write(UtilErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName)); | ||
1385 | } | ||
1386 | |||
1387 | comment = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | ||
1388 | break; | ||
1389 | case "CreateGroup": | ||
1390 | if (null == componentId) | ||
1391 | { | ||
1392 | this.Messaging.Write(UtilErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName)); | ||
1393 | } | ||
1394 | |||
1395 | if (YesNoType.No == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | ||
1396 | { | ||
1397 | attributes |= Group6Symbol.SymbolAttributes.DontCreateGroup; | ||
1398 | } | ||
1399 | break; | ||
1400 | case "FailIfExists": | ||
1401 | if (null == componentId) | ||
1402 | { | ||
1403 | this.Messaging.Write(UtilErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName)); | ||
1404 | } | ||
1405 | |||
1406 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | ||
1407 | { | ||
1408 | attributes |= Group6Symbol.SymbolAttributes.FailIfExists; | ||
1409 | } | ||
1410 | break; | ||
1411 | case "UpdateIfExists": | ||
1412 | if (null == componentId) | ||
1413 | { | ||
1414 | this.Messaging.Write(UtilErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName)); | ||
1415 | } | ||
1416 | |||
1417 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | ||
1418 | { | ||
1419 | attributes |= Group6Symbol.SymbolAttributes.UpdateIfExists; | ||
1420 | } | ||
1421 | break; | ||
1422 | case "RemoveComment": | ||
1423 | if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | ||
1424 | { | ||
1425 | attributes |= Group6Symbol.SymbolAttributes.RemoveComment; | ||
1426 | } | ||
1427 | break; | ||
1428 | case "RemoveOnUninstall": | ||
1429 | if (null == componentId) | ||
1430 | { | ||
1431 | this.Messaging.Write(UtilErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName)); | ||
1432 | } | ||
1433 | |||
1434 | if (YesNoType.No == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | ||
1435 | { | ||
1436 | attributes |= Group6Symbol.SymbolAttributes.DontRemoveOnUninstall; | ||
1437 | } | ||
1438 | break; | ||
1439 | case "Vital": | ||
1440 | if (null == componentId) | ||
1441 | { | ||
1442 | this.Messaging.Write(UtilErrors.IllegalAttributeWithoutComponent(sourceLineNumbers, element.Name.LocalName, attrib.Name.LocalName)); | ||
1443 | } | ||
1444 | |||
1445 | if (YesNoType.No == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib)) | ||
1446 | { | ||
1447 | attributes |= Group6Symbol.SymbolAttributes.NonVital; | ||
1448 | } | ||
1449 | break; | ||
1376 | default: | 1450 | default: |
1377 | this.ParseHelper.UnexpectedAttribute(element, attrib); | 1451 | this.ParseHelper.UnexpectedAttribute(element, attrib); |
1378 | break; | 1452 | break; |
@@ -1389,7 +1463,40 @@ namespace WixToolset.Util | |||
1389 | id = this.ParseHelper.CreateIdentifier("ugr", componentId, domain, name); | 1463 | id = this.ParseHelper.CreateIdentifier("ugr", componentId, domain, name); |
1390 | } | 1464 | } |
1391 | 1465 | ||
1392 | this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); | 1466 | if (null == name) |
1467 | { | ||
1468 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Name")); | ||
1469 | } | ||
1470 | |||
1471 | if (null != comment && (Group6Symbol.SymbolAttributes.RemoveComment & attributes) != 0) | ||
1472 | { | ||
1473 | this.Messaging.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, element.Name.LocalName, "Comment", "RemoveComment")); | ||
1474 | } | ||
1475 | |||
1476 | if (null != componentId) | ||
1477 | { | ||
1478 | this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "Wix4ConfigureGroups", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM64); | ||
1479 | } | ||
1480 | |||
1481 | foreach (var child in element.Elements()) | ||
1482 | { | ||
1483 | if (this.Namespace == child.Name.Namespace) | ||
1484 | { | ||
1485 | switch (child.Name.LocalName) | ||
1486 | { | ||
1487 | case "GroupRef": | ||
1488 | this.ParseGroupRefElement(intermediate, section, child, id.Id, groupType:true); | ||
1489 | break; | ||
1490 | default: | ||
1491 | //this.ParseHelper.UnexpectedElement(element, child); | ||
1492 | break; | ||
1493 | } | ||
1494 | } | ||
1495 | else | ||
1496 | { | ||
1497 | this.ParseHelper.ParseExtensionElement(this.Context.Extensions, intermediate, section, element, child); | ||
1498 | } | ||
1499 | } | ||
1393 | 1500 | ||
1394 | if (!this.Messaging.EncounteredError) | 1501 | if (!this.Messaging.EncounteredError) |
1395 | { | 1502 | { |
@@ -1399,6 +1506,12 @@ namespace WixToolset.Util | |||
1399 | Name = name, | 1506 | Name = name, |
1400 | Domain = domain, | 1507 | Domain = domain, |
1401 | }); | 1508 | }); |
1509 | section.AddSymbol(new Group6Symbol(sourceLineNumbers, id) | ||
1510 | { | ||
1511 | GroupRef = id.Id, | ||
1512 | Comment = comment, | ||
1513 | Attributes = attributes, | ||
1514 | }); | ||
1402 | } | 1515 | } |
1403 | } | 1516 | } |
1404 | 1517 | ||
@@ -1406,8 +1519,9 @@ namespace WixToolset.Util | |||
1406 | /// Parses a GroupRef element | 1519 | /// Parses a GroupRef element |
1407 | /// </summary> | 1520 | /// </summary> |
1408 | /// <param name="element">Element to parse.</param> | 1521 | /// <param name="element">Element to parse.</param> |
1409 | /// <param name="userId">Required user id to be joined to the group.</param> | 1522 | /// <param name="childId">Required child id to be joined to the group.</param> |
1410 | private void ParseGroupRefElement(Intermediate intermediate, IntermediateSection section, XElement element, string userId) | 1523 | /// <param name="groupType">whether the child is a group (true) or a user (false)</param> |
1524 | private void ParseGroupRefElement(Intermediate intermediate, IntermediateSection section, XElement element, string childId, bool groupType=false) | ||
1411 | { | 1525 | { |
1412 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); | 1526 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); |
1413 | string groupId = null; | 1527 | string groupId = null; |
@@ -1437,11 +1551,22 @@ namespace WixToolset.Util | |||
1437 | 1551 | ||
1438 | if (!this.Messaging.EncounteredError) | 1552 | if (!this.Messaging.EncounteredError) |
1439 | { | 1553 | { |
1440 | section.AddSymbol(new UserGroupSymbol(sourceLineNumbers) | 1554 | if (!groupType) |
1441 | { | 1555 | { |
1442 | UserRef = userId, | 1556 | section.AddSymbol(new UserGroupSymbol(sourceLineNumbers) |
1443 | GroupRef = groupId, | 1557 | { |
1444 | }); | 1558 | UserRef = childId, |
1559 | GroupRef = groupId, | ||
1560 | }); | ||
1561 | } | ||
1562 | else | ||
1563 | { | ||
1564 | section.AddSymbol(new GroupGroupSymbol(sourceLineNumbers) | ||
1565 | { | ||
1566 | ChildGroupRef = childId, | ||
1567 | ParentGroupRef = groupId, | ||
1568 | }); | ||
1569 | } | ||
1445 | } | 1570 | } |
1446 | } | 1571 | } |
1447 | 1572 | ||
@@ -3460,7 +3585,7 @@ namespace WixToolset.Util | |||
3460 | this.Messaging.Write(UtilErrors.IllegalElementWithoutComponent(childSourceLineNumbers, child.Name.LocalName)); | 3585 | this.Messaging.Write(UtilErrors.IllegalElementWithoutComponent(childSourceLineNumbers, child.Name.LocalName)); |
3461 | } | 3586 | } |
3462 | 3587 | ||
3463 | this.ParseGroupRefElement(intermediate, section, child, id.Id); | 3588 | this.ParseGroupRefElement(intermediate, section, child, id.Id, groupType:false); |
3464 | break; | 3589 | break; |
3465 | default: | 3590 | default: |
3466 | this.ParseHelper.UnexpectedElement(element, child); | 3591 | this.ParseHelper.UnexpectedElement(element, child); |