From 7595e8b7bc4ee2bf4507208c9df74dc173f3dfb1 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 23 Feb 2021 07:52:31 -0800 Subject: Rename IBurnBackendExtension to IBurnBackendBinderExtension This will allow other backend extensions in the future, such as a Burn decompiler extension. --- .../BaseBurnBackendBinderExtension.cs | 94 ++++++++++++++++++++++ .../BaseBurnBackendExtension.cs | 94 ---------------------- .../IBurnBackendBinderExtension.cs | 64 +++++++++++++++ .../IBurnBackendExtension.cs | 64 --------------- 4 files changed, 158 insertions(+), 158 deletions(-) create mode 100644 src/WixToolset.Extensibility/BaseBurnBackendBinderExtension.cs delete mode 100644 src/WixToolset.Extensibility/BaseBurnBackendExtension.cs create mode 100644 src/WixToolset.Extensibility/IBurnBackendBinderExtension.cs delete mode 100644 src/WixToolset.Extensibility/IBurnBackendExtension.cs (limited to 'src') diff --git a/src/WixToolset.Extensibility/BaseBurnBackendBinderExtension.cs b/src/WixToolset.Extensibility/BaseBurnBackendBinderExtension.cs new file mode 100644 index 00000000..3afc8678 --- /dev/null +++ b/src/WixToolset.Extensibility/BaseBurnBackendBinderExtension.cs @@ -0,0 +1,94 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Extensibility +{ + using System; + using System.Collections.Generic; + using System.Linq; + using WixToolset.Data; + using WixToolset.Data.Burn; + using WixToolset.Extensibility.Data; + using WixToolset.Extensibility.Services; + + /// + /// Base class for creating a Burn backend extension. + /// + public abstract class BaseBurnBackendBinderExtension : IBurnBackendBinderExtension + { + /// + /// Context for use by the extension. + /// + protected IBindContext Context { get; private set; } + + /// + /// Messaging for use by the extension. + /// + protected IMessaging Messaging { get; private set; } + + /// + /// Backend helper for use by the extension. + /// + protected IBurnBackendHelper BackendHelper { get; private set; } + + /// + /// Optional symbol definitions. + /// + protected virtual IEnumerable SymbolDefinitions => Enumerable.Empty(); + + /// + /// See + /// + public virtual void PreBackendBind(IBindContext context) + { + this.Context = context; + this.Messaging = context.ServiceProvider.GetService(); + this.BackendHelper = context.ServiceProvider.GetService(); + } + + /// + /// See + /// + public virtual IResolveFileResult ResolveRelatedFile(string source, string relatedSource, string type, SourceLineNumber sourceLineNumbers) + { + return null; + } + + /// + /// See + /// + public virtual void SymbolsFinalized(IntermediateSection section) + { + } + + /// + /// See + /// + public virtual string ResolveUrl(string url, string fallbackUrl, string packageId, string payloadId, string fileName) + { + return null; + } + + /// + /// See + /// + public virtual bool TryProcessSymbol(IntermediateSection section, IntermediateSymbol symbol) + { + if (this.SymbolDefinitions.Any(t => t == symbol.Definition) && + symbol.Definition.HasTag(BurnConstants.BootstrapperApplicationDataSymbolDefinitionTag)) + { + this.BackendHelper.AddBootstrapperApplicationData(symbol); + return true; + } + + return false; + } + + /// + /// See + /// + /// + public virtual void PostBackendBind(IBindResult result) + { + } + } +} diff --git a/src/WixToolset.Extensibility/BaseBurnBackendExtension.cs b/src/WixToolset.Extensibility/BaseBurnBackendExtension.cs deleted file mode 100644 index 488f882a..00000000 --- a/src/WixToolset.Extensibility/BaseBurnBackendExtension.cs +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. - -namespace WixToolset.Extensibility -{ - using System; - using System.Collections.Generic; - using System.Linq; - using WixToolset.Data; - using WixToolset.Data.Burn; - using WixToolset.Extensibility.Data; - using WixToolset.Extensibility.Services; - - /// - /// Base class for creating a Burn backend extension. - /// - public abstract class BaseBurnBackendExtension : IBurnBackendExtension - { - /// - /// Context for use by the extension. - /// - protected IBindContext Context { get; private set; } - - /// - /// Messaging for use by the extension. - /// - protected IMessaging Messaging { get; private set; } - - /// - /// Backend helper for use by the extension. - /// - protected IBurnBackendHelper BackendHelper { get; private set; } - - /// - /// Optional symbol definitions. - /// - protected virtual IEnumerable SymbolDefinitions => Enumerable.Empty(); - - /// - /// See - /// - public virtual void PreBackendBind(IBindContext context) - { - this.Context = context; - this.Messaging = context.ServiceProvider.GetService(); - this.BackendHelper = context.ServiceProvider.GetService(); - } - - /// - /// See - /// - public virtual IResolveFileResult ResolveRelatedFile(string source, string relatedSource, string type, SourceLineNumber sourceLineNumbers) - { - return null; - } - - /// - /// See - /// - public virtual void SymbolsFinalized(IntermediateSection section) - { - } - - /// - /// See - /// - public virtual string ResolveUrl(string url, string fallbackUrl, string packageId, string payloadId, string fileName) - { - return null; - } - - /// - /// See - /// - public virtual bool TryProcessSymbol(IntermediateSection section, IntermediateSymbol symbol) - { - if (this.SymbolDefinitions.Any(t => t == symbol.Definition) && - symbol.Definition.HasTag(BurnConstants.BootstrapperApplicationDataSymbolDefinitionTag)) - { - this.BackendHelper.AddBootstrapperApplicationData(symbol); - return true; - } - - return false; - } - - /// - /// See - /// - /// - public virtual void PostBackendBind(IBindResult result) - { - } - } -} diff --git a/src/WixToolset.Extensibility/IBurnBackendBinderExtension.cs b/src/WixToolset.Extensibility/IBurnBackendBinderExtension.cs new file mode 100644 index 00000000..1dd4d9b1 --- /dev/null +++ b/src/WixToolset.Extensibility/IBurnBackendBinderExtension.cs @@ -0,0 +1,64 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +namespace WixToolset.Extensibility +{ + using WixToolset.Data; + using WixToolset.Extensibility.Data; + + /// + /// Interface all Burn backend extensions implement. + /// + public interface IBurnBackendBinderExtension + { + /// + /// Called before binding occurs. + /// + void PreBackendBind(IBindContext context); + + /// + /// Called to find a file related to another source in the authoring. For example, most often used + /// to find cabinets and uncompressed files for an MSI package. + /// + /// Path to the source package. + /// Expected path to the related file. + /// Type of related file, such as "File" or "Cabinet" + /// Source line number of source package. + /// IResolveFileResult if the related file was found, or null for default handling. + IResolveFileResult ResolveRelatedFile(string source, string relatedSource, string type, SourceLineNumber sourceLineNumbers); + + /// + /// Called right before the output is bound into its final format. + /// + /// The finalized intermediate section. + void SymbolsFinalized(IntermediateSection section); + + /// + /// Called to customize the DownloadUrl provided in source cde. + /// + /// The value from the source code. May not actually be a URL. + /// The default URL if the extension does not return a value. + /// Identifier of the package. + /// Identifier of the payload. + /// Filename of the payload. + /// Url to override, or null to use default value. + string ResolveUrl(string url, string fallbackUrl, string packageId, string payloadId, string fileName); + + /// + /// Called for each extension symbol that hasn't been handled yet. + /// Use IBurnBackendHelper to add data. + /// + /// The linked section. + /// The current symbol. + /// + /// True if the extension handled the symbol, false otherwise. + /// The Burn backend will warn on all unhandled symbols. + /// + bool TryProcessSymbol(IntermediateSection section, IntermediateSymbol symbol); + + /// + /// Called after output is bound into its final format. + /// + /// + void PostBackendBind(IBindResult result); + } +} diff --git a/src/WixToolset.Extensibility/IBurnBackendExtension.cs b/src/WixToolset.Extensibility/IBurnBackendExtension.cs deleted file mode 100644 index 07f5cd1b..00000000 --- a/src/WixToolset.Extensibility/IBurnBackendExtension.cs +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. - -namespace WixToolset.Extensibility -{ - using WixToolset.Data; - using WixToolset.Extensibility.Data; - - /// - /// Interface all Burn backend extensions implement. - /// - public interface IBurnBackendExtension - { - /// - /// Called before binding occurs. - /// - void PreBackendBind(IBindContext context); - - /// - /// Called to find a file related to another source in the authoring. For example, most often used - /// to find cabinets and uncompressed files for an MSI package. - /// - /// Path to the source package. - /// Expected path to the related file. - /// Type of related file, such as "File" or "Cabinet" - /// Source line number of source package. - /// IResolveFileResult if the related file was found, or null for default handling. - IResolveFileResult ResolveRelatedFile(string source, string relatedSource, string type, SourceLineNumber sourceLineNumbers); - - /// - /// Called right before the output is bound into its final format. - /// - /// The finalized intermediate section. - void SymbolsFinalized(IntermediateSection section); - - /// - /// Called to customize the DownloadUrl provided in source cde. - /// - /// The value from the source code. May not actually be a URL. - /// The default URL if the extension does not return a value. - /// Identifier of the package. - /// Identifier of the payload. - /// Filename of the payload. - /// Url to override, or null to use default value. - string ResolveUrl(string url, string fallbackUrl, string packageId, string payloadId, string fileName); - - /// - /// Called for each extension symbol that hasn't been handled yet. - /// Use IBurnBackendHelper to add data. - /// - /// The linked section. - /// The current symbol. - /// - /// True if the extension handled the symbol, false otherwise. - /// The Burn backend will warn on all unhandled symbols. - /// - bool TryProcessSymbol(IntermediateSection section, IntermediateSymbol symbol); - - /// - /// Called after output is bound into its final format. - /// - /// - void PostBackendBind(IBindResult result); - } -} -- cgit v1.2.3-55-g6feb