From 65b36792f09658a85401cd50a0efaee0fee698d9 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sun, 12 May 2019 23:05:42 -0700 Subject: Add the missing BaseLibrarianExtension --- .../BaseLibrarianExtension.cs | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 src/WixToolset.Extensibility/BaseLibrarianExtension.cs diff --git a/src/WixToolset.Extensibility/BaseLibrarianExtension.cs b/src/WixToolset.Extensibility/BaseLibrarianExtension.cs new file mode 100644 index 00000000..ffcb6684 --- /dev/null +++ b/src/WixToolset.Extensibility/BaseLibrarianExtension.cs @@ -0,0 +1,71 @@ +// 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.Collections.Generic; + using WixToolset.Data; + using WixToolset.Extensibility.Data; + using WixToolset.Extensibility.Services; + + /// + /// Base class for creating a librarian extension. + /// + public abstract class BaseLibrarianExtension : ILibrarianExtension + { + /// + /// Context for use by the extension. + /// + protected ILibraryContext Context { get; private set; } + + /// + /// Messaging for use by the extension. + /// + protected IMessaging Messaging { get; private set; } + + /// + /// Called at the beginning of combining. + /// + /// Librarian context. + public virtual void PreCombine(ILibraryContext context) + { + this.Context = context; + + this.Messaging = context.ServiceProvider.GetService(); + } + + /// + /// Resolves a path to a file path on disk. + /// + /// Source line number for the path to resolve. + /// Tuple related to the path to resolve. + /// Path to resolve. + /// Optional resolved file result. + public virtual IResolveFileResult ResolveFile(SourceLineNumber sourceLineNumber, IntermediateTupleDefinition tupleDefinition, string path) + { + return null; + } + + /// + /// Called at the end of combining. + /// + /// Combined library intermediate. + public virtual void PostCombine(Intermediate library) + { + } + + /// + /// Creates an IResolveFileResult. + /// + /// Optional resolved path to file. + /// Optional collection of paths checked for the file. + /// Resolved file result. + protected IResolveFileResult CreateResolveFileResult(string path = null, IEnumerable checkedPaths = null) + { + var result = this.Context.ServiceProvider.GetService(); + result.Path = path; + result.CheckedPaths = checkedPaths; + + return result; + } + } +} -- cgit v1.2.3-55-g6feb