From b036b878a6b477158a22e508ee3a9e8f569f5bf4 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Thu, 11 Mar 2021 19:57:12 -0600 Subject: Integrate ForwardCompatible and RelatedBundle changes in Burn headers. --- src/WixToolset.Mba.Core/BootstrapperApplication.cs | 34 ++++++-- src/WixToolset.Mba.Core/EventArgs.cs | 97 ++++++++++++++++------ .../IBootstrapperApplication.cs | 33 +++++++- .../IDefaultBootstrapperApplication.cs | 5 ++ 4 files changed, 134 insertions(+), 35 deletions(-) (limited to 'src/WixToolset.Mba.Core') diff --git a/src/WixToolset.Mba.Core/BootstrapperApplication.cs b/src/WixToolset.Mba.Core/BootstrapperApplication.cs index 1812c80b..b6c0dd0d 100644 --- a/src/WixToolset.Mba.Core/BootstrapperApplication.cs +++ b/src/WixToolset.Mba.Core/BootstrapperApplication.cs @@ -226,6 +226,9 @@ namespace WixToolset.Mba.Core /// public event EventHandler SystemRestorePointComplete; + /// + public event EventHandler PlanForwardCompatibleBundle; + /// /// Entry point that is called when the bootstrapper application is ready to run. /// @@ -1083,6 +1086,18 @@ namespace WixToolset.Mba.Core } } + /// + /// Called by the engine, raises the event. + /// + protected virtual void OnPlanForwardCompatibleBundle(PlanForwardCompatibleBundleEventArgs args) + { + EventHandler handler = this.PlanForwardCompatibleBundle; + if (null != handler) + { + handler(this, args); + } + } + #region IBootstrapperApplication Members int IBootstrapperApplication.OnStartup() @@ -1120,13 +1135,12 @@ namespace WixToolset.Mba.Core return args.HResult; } - int IBootstrapperApplication.OnDetectForwardCompatibleBundle(string wzBundleId, RelationType relationType, string wzBundleTag, bool fPerMachine, string wzVersion, ref bool fCancel, ref bool fIgnoreBundle) + int IBootstrapperApplication.OnDetectForwardCompatibleBundle(string wzBundleId, RelationType relationType, string wzBundleTag, bool fPerMachine, string wzVersion, bool fMissingFromCache, ref bool fCancel) { - DetectForwardCompatibleBundleEventArgs args = new DetectForwardCompatibleBundleEventArgs(wzBundleId, relationType, wzBundleTag, fPerMachine, wzVersion, fCancel, fIgnoreBundle); + DetectForwardCompatibleBundleEventArgs args = new DetectForwardCompatibleBundleEventArgs(wzBundleId, relationType, wzBundleTag, fPerMachine, wzVersion, fMissingFromCache, fCancel); this.OnDetectForwardCompatibleBundle(args); fCancel = args.Cancel; - fIgnoreBundle = args.IgnoreBundle; return args.HResult; } @@ -1159,9 +1173,9 @@ namespace WixToolset.Mba.Core return args.HResult; } - int IBootstrapperApplication.OnDetectRelatedBundle(string wzProductCode, RelationType relationType, string wzBundleTag, bool fPerMachine, string wzVersion, RelatedOperation operation, ref bool fCancel) + int IBootstrapperApplication.OnDetectRelatedBundle(string wzProductCode, RelationType relationType, string wzBundleTag, bool fPerMachine, string wzVersion, RelatedOperation operation, bool fMissingFromCache, ref bool fCancel) { - DetectRelatedBundleEventArgs args = new DetectRelatedBundleEventArgs(wzProductCode, relationType, wzBundleTag, fPerMachine, wzVersion, operation, fCancel); + DetectRelatedBundleEventArgs args = new DetectRelatedBundleEventArgs(wzProductCode, relationType, wzBundleTag, fPerMachine, wzVersion, operation, fMissingFromCache, fCancel); this.OnDetectRelatedBundle(args); fCancel = args.Cancel; @@ -1656,6 +1670,16 @@ namespace WixToolset.Mba.Core return args.HResult; } + int IBootstrapperApplication.OnPlanForwardCompatibleBundle(string wzBundleId, RelationType relationType, string wzBundleTag, bool fPerMachine, string wzVersion, bool fRecommendedIgnoreBundle, ref bool fCancel, ref bool fIgnoreBundle) + { + PlanForwardCompatibleBundleEventArgs args = new PlanForwardCompatibleBundleEventArgs(wzBundleId, relationType, wzBundleTag, fPerMachine, wzVersion, fRecommendedIgnoreBundle, fCancel, fIgnoreBundle); + this.OnPlanForwardCompatibleBundle(args); + + fCancel = args.Cancel; + fIgnoreBundle = args.IgnoreBundle; + return args.HResult; + } + int IBootstrapperApplication.BAProc(int message, IntPtr pvArgs, IntPtr pvResults, IntPtr pvContext) { switch (message) diff --git a/src/WixToolset.Mba.Core/EventArgs.cs b/src/WixToolset.Mba.Core/EventArgs.cs index 56705769..7e7cbd11 100644 --- a/src/WixToolset.Mba.Core/EventArgs.cs +++ b/src/WixToolset.Mba.Core/EventArgs.cs @@ -226,22 +226,13 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments used when detected a forward compatible bundle. + /// Event arguments for /// [Serializable] public class DetectForwardCompatibleBundleEventArgs : CancellableHResultEventArgs { - /// - /// Creates a new instance of the class. - /// - /// The identity of the forward compatible bundle. - /// Relationship type for this forward compatible bundle. - /// The tag of the forward compatible bundle. - /// Whether the detected forward compatible bundle is per machine. - /// The version of the forward compatible bundle detected. - /// The cancel recommendation from the engine. - /// The ignore recommendation from the engine. - public DetectForwardCompatibleBundleEventArgs(string bundleId, RelationType relationType, string bundleTag, bool perMachine, string version, bool cancelRecommendation, bool ignoreBundleRecommendation) + /// + public DetectForwardCompatibleBundleEventArgs(string bundleId, RelationType relationType, string bundleTag, bool perMachine, string version, bool missingFromCache, bool cancelRecommendation) : base(cancelRecommendation) { this.BundleId = bundleId; @@ -249,7 +240,7 @@ namespace WixToolset.Mba.Core this.BundleTag = bundleTag; this.PerMachine = perMachine; this.Version = version; - this.IgnoreBundle = ignoreBundleRecommendation; + this.MissingFromCache = missingFromCache; } /// @@ -278,9 +269,9 @@ namespace WixToolset.Mba.Core public string Version { get; private set; } /// - /// Instructs the engine whether to use the forward compatible bundle. + /// Whether the forward compatible bundle is missing from the package cache. /// - public bool IgnoreBundle { get; set; } + public bool MissingFromCache { get; set; } } /// @@ -408,22 +399,13 @@ namespace WixToolset.Mba.Core } /// - /// Additional arguments used when a related bundle has been detected for a bundle. + /// Event arguments for /// [Serializable] public class DetectRelatedBundleEventArgs : CancellableHResultEventArgs { - /// - /// Creates a new instance of the class. - /// - /// The identity of the related package bundle. - /// Relationship type for this related bundle. - /// The tag of the related package bundle. - /// Whether the detected bundle is per machine. - /// The version of the related bundle detected. - /// The operation that will be taken on the detected bundle. - /// The recommendation from the engine. - public DetectRelatedBundleEventArgs(string productCode, RelationType relationType, string bundleTag, bool perMachine, string version, RelatedOperation operation, bool cancelRecommendation) + /// + public DetectRelatedBundleEventArgs(string productCode, RelationType relationType, string bundleTag, bool perMachine, string version, RelatedOperation operation, bool missingFromCache, bool cancelRecommendation) : base(cancelRecommendation) { this.ProductCode = productCode; @@ -432,6 +414,7 @@ namespace WixToolset.Mba.Core this.PerMachine = perMachine; this.Version = version; this.Operation = operation; + this.MissingFromCache = missingFromCache; } /// @@ -463,6 +446,11 @@ namespace WixToolset.Mba.Core /// Gets the operation that will be taken on the detected bundle. /// public RelatedOperation Operation { get; private set; } + + /// + /// Whether the related bundle is missing from the package cache. + /// + public bool MissingFromCache { get; set; } } /// @@ -1009,6 +997,61 @@ namespace WixToolset.Mba.Core } } + /// + /// Event arguments for + /// + [Serializable] + public class PlanForwardCompatibleBundleEventArgs : CancellableHResultEventArgs + { + /// + public PlanForwardCompatibleBundleEventArgs(string bundleId, RelationType relationType, string bundleTag, bool perMachine, string version, bool recommendedIgnoreBundle, bool cancelRecommendation, bool ignoreBundle) + : base(cancelRecommendation) + { + this.BundleId = bundleId; + this.RelationType = relationType; + this.BundleTag = bundleTag; + this.PerMachine = perMachine; + this.Version = version; + this.RecommendedIgnoreBundle = recommendedIgnoreBundle; + this.IgnoreBundle = ignoreBundle; + } + + /// + /// Gets the identity of the forward compatible bundle detected. + /// + public string BundleId { get; private set; } + + /// + /// Gets the relationship type of the forward compatible bundle. + /// + public RelationType RelationType { get; private set; } + + /// + /// Gets the tag of the forward compatible bundle. + /// + public string BundleTag { get; private set; } + + /// + /// Gets whether the forward compatible bundle is per machine. + /// + public bool PerMachine { get; private set; } + + /// + /// Gets the version of the forward compatible bundle. + /// + public string Version { get; private set; } + + /// + /// Gets the recommendation of whether the engine should use the forward compatible bundle. + /// + public bool RecommendedIgnoreBundle { get; set; } + + /// + /// Gets or sets whether the engine will use the forward compatible bundle. + /// + public bool IgnoreBundle { get; set; } + } + /// /// Additional arguments used when the engine has begun installing the bundle. /// diff --git a/src/WixToolset.Mba.Core/IBootstrapperApplication.cs b/src/WixToolset.Mba.Core/IBootstrapperApplication.cs index 4812c038..14cb8fd5 100644 --- a/src/WixToolset.Mba.Core/IBootstrapperApplication.cs +++ b/src/WixToolset.Mba.Core/IBootstrapperApplication.cs @@ -64,8 +64,8 @@ namespace WixToolset.Mba.Core /// /// /// + /// /// - /// /// [PreserveSig] [return: MarshalAs(UnmanagedType.I4)] @@ -75,8 +75,8 @@ namespace WixToolset.Mba.Core [MarshalAs(UnmanagedType.LPWStr)] string wzBundleTag, [MarshalAs(UnmanagedType.Bool)] bool fPerMachine, [MarshalAs(UnmanagedType.LPWStr)] string wzVersion, - [MarshalAs(UnmanagedType.Bool)] ref bool fCancel, - [MarshalAs(UnmanagedType.Bool)] ref bool fIgnoreBundle + [MarshalAs(UnmanagedType.Bool)] bool fMissingFromCache, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel ); /// @@ -143,6 +143,7 @@ namespace WixToolset.Mba.Core /// /// /// + /// /// /// [PreserveSig] @@ -154,6 +155,7 @@ namespace WixToolset.Mba.Core [MarshalAs(UnmanagedType.Bool)] bool fPerMachine, [MarshalAs(UnmanagedType.LPWStr)] string wzVersion, [MarshalAs(UnmanagedType.U4)] RelatedOperation operation, + [MarshalAs(UnmanagedType.Bool)] bool fMissingFromCache, [MarshalAs(UnmanagedType.Bool)] ref bool fCancel ); @@ -1000,6 +1002,31 @@ namespace WixToolset.Mba.Core int hrStatus ); + /// + /// See . + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + [PreserveSig] + [return: MarshalAs(UnmanagedType.I4)] + int OnPlanForwardCompatibleBundle( + [MarshalAs(UnmanagedType.LPWStr)] string wzBundleId, + [MarshalAs(UnmanagedType.U4)] RelationType relationType, + [MarshalAs(UnmanagedType.LPWStr)] string wzBundleTag, + [MarshalAs(UnmanagedType.Bool)] bool fPerMachine, + [MarshalAs(UnmanagedType.LPWStr)] string wzVersion, + [MarshalAs(UnmanagedType.Bool)] bool fRecommendedIgnoreBundle, + [MarshalAs(UnmanagedType.Bool)] ref bool fCancel, + [MarshalAs(UnmanagedType.Bool)] ref bool fIgnoreBundle + ); + /// /// Low level method that is called directly from the engine. /// diff --git a/src/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs b/src/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs index 5803a26a..269d4955 100644 --- a/src/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs +++ b/src/WixToolset.Mba.Core/IDefaultBootstrapperApplication.cs @@ -229,6 +229,11 @@ namespace WixToolset.Mba.Core /// event EventHandler PlanComplete; + /// + /// Fired when the engine is about to plan a forward compatible bundle. + /// + event EventHandler PlanForwardCompatibleBundle; + /// /// Fired when the engine has completed planning a package. /// -- cgit v1.2.3-55-g6feb