diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2022-03-13 23:45:32 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2022-03-14 14:53:29 -0500 |
commit | 4cd1c4e06145434ca940ac828772dc47b9d9738e (patch) | |
tree | a754d685039173c63303dc6d0d8b1a2bf3ab506b /src/api/burn/WixToolset.Mba.Core | |
parent | 89adb2e3cc232b11b28e5bdeccb0c522c8124a29 (diff) | |
download | wix-4cd1c4e06145434ca940ac828772dc47b9d9738e.tar.gz wix-4cd1c4e06145434ca940ac828772dc47b9d9738e.tar.bz2 wix-4cd1c4e06145434ca940ac828772dc47b9d9738e.zip |
Allow the BA to override the bundle relation type during plan.
Diffstat (limited to 'src/api/burn/WixToolset.Mba.Core')
4 files changed, 121 insertions, 1 deletions
diff --git a/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs b/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs index 1df992be..fd36cf26 100644 --- a/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs +++ b/src/api/burn/WixToolset.Mba.Core/BootstrapperApplication.cs | |||
@@ -89,6 +89,9 @@ namespace WixToolset.Mba.Core | |||
89 | public event EventHandler<PlanRelatedBundleEventArgs> PlanRelatedBundle; | 89 | public event EventHandler<PlanRelatedBundleEventArgs> PlanRelatedBundle; |
90 | 90 | ||
91 | /// <inheritdoc/> | 91 | /// <inheritdoc/> |
92 | public event EventHandler<PlanRelatedBundleTypeEventArgs> PlanRelatedBundleType; | ||
93 | |||
94 | /// <inheritdoc/> | ||
92 | public event EventHandler<PlanRollbackBoundaryEventArgs> PlanRollbackBoundary; | 95 | public event EventHandler<PlanRollbackBoundaryEventArgs> PlanRollbackBoundary; |
93 | 96 | ||
94 | /// <inheritdoc/> | 97 | /// <inheritdoc/> |
@@ -534,6 +537,19 @@ namespace WixToolset.Mba.Core | |||
534 | } | 537 | } |
535 | 538 | ||
536 | /// <summary> | 539 | /// <summary> |
540 | /// Called by the engine, raises the <see cref="PlanRelatedBundleType"/> event. | ||
541 | /// </summary> | ||
542 | /// <param name="args">Additional arguments for this event.</param> | ||
543 | protected virtual void OnPlanRelatedBundleType(PlanRelatedBundleTypeEventArgs args) | ||
544 | { | ||
545 | EventHandler<PlanRelatedBundleTypeEventArgs> handler = this.PlanRelatedBundleType; | ||
546 | if (null != handler) | ||
547 | { | ||
548 | handler(this, args); | ||
549 | } | ||
550 | } | ||
551 | |||
552 | /// <summary> | ||
537 | /// Called by the engine, raises the <see cref="PlanRollbackBoundary"/> event. | 553 | /// Called by the engine, raises the <see cref="PlanRollbackBoundary"/> event. |
538 | /// </summary> | 554 | /// </summary> |
539 | protected virtual void OnPlanRollbackBoundary(PlanRollbackBoundaryEventArgs args) | 555 | protected virtual void OnPlanRollbackBoundary(PlanRollbackBoundaryEventArgs args) |
@@ -1514,6 +1530,16 @@ namespace WixToolset.Mba.Core | |||
1514 | return args.HResult; | 1530 | return args.HResult; |
1515 | } | 1531 | } |
1516 | 1532 | ||
1533 | int IBootstrapperApplication.OnPlanRelatedBundleType(string wzBundleId, RelatedBundlePlanType recommendedType, ref RelatedBundlePlanType pRequestedType, ref bool fCancel) | ||
1534 | { | ||
1535 | PlanRelatedBundleTypeEventArgs args = new PlanRelatedBundleTypeEventArgs(wzBundleId, recommendedType, pRequestedType, fCancel); | ||
1536 | this.OnPlanRelatedBundleType(args); | ||
1537 | |||
1538 | pRequestedType = args.Type; | ||
1539 | fCancel = args.Cancel; | ||
1540 | return args.HResult; | ||
1541 | } | ||
1542 | |||
1517 | int IBootstrapperApplication.OnPlanRollbackBoundary(string wzRollbackBoundaryId, bool fRecommendedTransaction, ref bool fTransaction, ref bool fCancel) | 1543 | int IBootstrapperApplication.OnPlanRollbackBoundary(string wzRollbackBoundaryId, bool fRecommendedTransaction, ref bool fTransaction, ref bool fCancel) |
1518 | { | 1544 | { |
1519 | PlanRollbackBoundaryEventArgs args = new PlanRollbackBoundaryEventArgs(wzRollbackBoundaryId, fRecommendedTransaction, fTransaction, fCancel); | 1545 | PlanRollbackBoundaryEventArgs args = new PlanRollbackBoundaryEventArgs(wzRollbackBoundaryId, fRecommendedTransaction, fTransaction, fCancel); |
diff --git a/src/api/burn/WixToolset.Mba.Core/EventArgs.cs b/src/api/burn/WixToolset.Mba.Core/EventArgs.cs index 816757cc..d8ec7998 100644 --- a/src/api/burn/WixToolset.Mba.Core/EventArgs.cs +++ b/src/api/burn/WixToolset.Mba.Core/EventArgs.cs | |||
@@ -746,6 +746,37 @@ namespace WixToolset.Mba.Core | |||
746 | } | 746 | } |
747 | 747 | ||
748 | /// <summary> | 748 | /// <summary> |
749 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.PlanRelatedBundleType"/> | ||
750 | /// </summary> | ||
751 | [Serializable] | ||
752 | public class PlanRelatedBundleTypeEventArgs : CancellableHResultEventArgs | ||
753 | { | ||
754 | /// <summary /> | ||
755 | public PlanRelatedBundleTypeEventArgs(string bundleId, RelatedBundlePlanType recommendedType, RelatedBundlePlanType type, bool cancelRecommendation) | ||
756 | : base(cancelRecommendation) | ||
757 | { | ||
758 | this.BundleId = bundleId; | ||
759 | this.RecommendedType = recommendedType; | ||
760 | this.Type = type; | ||
761 | } | ||
762 | |||
763 | /// <summary> | ||
764 | /// Gets the identity of the bundle to plan for. | ||
765 | /// </summary> | ||
766 | public string BundleId { get; private set; } | ||
767 | |||
768 | /// <summary> | ||
769 | /// Gets the recommended plan type for the bundle. | ||
770 | /// </summary> | ||
771 | public RelatedBundlePlanType RecommendedType { get; private set; } | ||
772 | |||
773 | /// <summary> | ||
774 | /// Gets or sets the plan type for the bundle. | ||
775 | /// </summary> | ||
776 | public RelatedBundlePlanType Type { get; set; } | ||
777 | } | ||
778 | |||
779 | /// <summary> | ||
749 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.PlanPackageBegin"/> | 780 | /// Event arguments for <see cref="IDefaultBootstrapperApplication.PlanPackageBegin"/> |
750 | /// </summary> | 781 | /// </summary> |
751 | [Serializable] | 782 | [Serializable] |
diff --git a/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs b/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs index 489e3b6d..4ab0f8d9 100644 --- a/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs +++ b/src/api/burn/WixToolset.Mba.Core/IBootstrapperApplication.cs | |||
@@ -1148,6 +1148,18 @@ namespace WixToolset.Mba.Core | |||
1148 | [MarshalAs(UnmanagedType.U4)] ref RequestState pRequestedState, | 1148 | [MarshalAs(UnmanagedType.U4)] ref RequestState pRequestedState, |
1149 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | 1149 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel |
1150 | ); | 1150 | ); |
1151 | |||
1152 | /// <summary> | ||
1153 | /// See <see cref="IDefaultBootstrapperApplication.PlanRelatedBundleType"/>. | ||
1154 | /// </summary> | ||
1155 | [PreserveSig] | ||
1156 | [return: MarshalAs(UnmanagedType.I4)] | ||
1157 | int OnPlanRelatedBundleType( | ||
1158 | [MarshalAs(UnmanagedType.LPWStr)] string wzBundleId, | ||
1159 | [MarshalAs(UnmanagedType.U4)] RelatedBundlePlanType recommendedType, | ||
1160 | [MarshalAs(UnmanagedType.U4)] ref RelatedBundlePlanType pRequestedType, | ||
1161 | [MarshalAs(UnmanagedType.Bool)] ref bool fCancel | ||
1162 | ); | ||
1151 | } | 1163 | } |
1152 | 1164 | ||
1153 | /// <summary> | 1165 | /// <summary> |
@@ -1669,7 +1681,12 @@ namespace WixToolset.Mba.Core | |||
1669 | /// <summary> | 1681 | /// <summary> |
1670 | /// | 1682 | /// |
1671 | /// </summary> | 1683 | /// </summary> |
1672 | Dependent, | 1684 | DependentAddon, |
1685 | |||
1686 | /// <summary> | ||
1687 | /// | ||
1688 | /// </summary> | ||
1689 | DependentPatch, | ||
1673 | 1690 | ||
1674 | /// <summary> | 1691 | /// <summary> |
1675 | /// | 1692 | /// |
@@ -1678,6 +1695,47 @@ namespace WixToolset.Mba.Core | |||
1678 | } | 1695 | } |
1679 | 1696 | ||
1680 | /// <summary> | 1697 | /// <summary> |
1698 | /// The planned relation type for related bundles. | ||
1699 | /// </summary> | ||
1700 | public enum RelatedBundlePlanType | ||
1701 | { | ||
1702 | /// <summary> | ||
1703 | /// | ||
1704 | /// </summary> | ||
1705 | None, | ||
1706 | |||
1707 | /// <summary> | ||
1708 | /// | ||
1709 | /// </summary> | ||
1710 | Downgrade, | ||
1711 | |||
1712 | /// <summary> | ||
1713 | /// | ||
1714 | /// </summary> | ||
1715 | Upgrade, | ||
1716 | |||
1717 | /// <summary> | ||
1718 | /// | ||
1719 | /// </summary> | ||
1720 | Addon, | ||
1721 | |||
1722 | /// <summary> | ||
1723 | /// | ||
1724 | /// </summary> | ||
1725 | Patch, | ||
1726 | |||
1727 | /// <summary> | ||
1728 | /// | ||
1729 | /// </summary> | ||
1730 | DependentAddon, | ||
1731 | |||
1732 | /// <summary> | ||
1733 | /// | ||
1734 | /// </summary> | ||
1735 | DependentPatch, | ||
1736 | } | ||
1737 | |||
1738 | /// <summary> | ||
1681 | /// One or more reasons why the application is requested to be closed or is being closed. | 1739 | /// One or more reasons why the application is requested to be closed or is being closed. |
1682 | /// </summary> | 1740 | /// </summary> |
1683 | [Flags] | 1741 | [Flags] |
diff --git a/src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs b/src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs index c237cb9d..ebd1580b 100644 --- a/src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs +++ b/src/api/burn/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs | |||
@@ -334,6 +334,11 @@ namespace WixToolset.Mba.Core | |||
334 | event EventHandler<PlanRelatedBundleEventArgs> PlanRelatedBundle; | 334 | event EventHandler<PlanRelatedBundleEventArgs> PlanRelatedBundle; |
335 | 335 | ||
336 | /// <summary> | 336 | /// <summary> |
337 | /// Fired when the engine has begun planning the related bundle relation type. | ||
338 | /// </summary> | ||
339 | event EventHandler<PlanRelatedBundleTypeEventArgs> PlanRelatedBundleType; | ||
340 | |||
341 | /// <summary> | ||
337 | /// Fired when the engine has begun planning an upgrade related bundle for restoring in case of failure. | 342 | /// Fired when the engine has begun planning an upgrade related bundle for restoring in case of failure. |
338 | /// </summary> | 343 | /// </summary> |
339 | event EventHandler<PlanRestoreRelatedBundleEventArgs> PlanRestoreRelatedBundle; | 344 | event EventHandler<PlanRestoreRelatedBundleEventArgs> PlanRestoreRelatedBundle; |