From ba4bb7b2080d74918d6d856fba6f86caa410149b Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 19 Mar 2022 22:53:06 -0700 Subject: Centralize cache locations in IExtensionManager This removes the duplication of cache location definitions between IExtensionManager and extension cache command. Also, adds an extension cache test. Fixes 6536 --- .../Data/IExtensionCacheLocation.cs | 41 ++++++++++++++++++++++ .../Services/IExtensionManager.cs | 7 ++++ 2 files changed, 48 insertions(+) create mode 100644 src/api/wix/WixToolset.Extensibility/Data/IExtensionCacheLocation.cs (limited to 'src/api') diff --git a/src/api/wix/WixToolset.Extensibility/Data/IExtensionCacheLocation.cs b/src/api/wix/WixToolset.Extensibility/Data/IExtensionCacheLocation.cs new file mode 100644 index 00000000..53158875 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/IExtensionCacheLocation.cs @@ -0,0 +1,41 @@ +// 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.Data +{ + /// + /// Extension cache location scope. + /// + public enum ExtensionCacheLocationScope + { + /// + /// Project extension cache location. + /// + Project, + + /// + /// User extension cache location. + /// + User, + + /// + /// Machine extension cache location. + /// + Machine, + } + + /// + /// Location where extensions may be cached. + /// + public interface IExtensionCacheLocation + { + /// + /// Path for the extension cache location. + /// + string Path { get; } + + /// + /// Scope for the extension cache location. + /// + ExtensionCacheLocationScope Scope { get; } + } +} diff --git a/src/api/wix/WixToolset.Extensibility/Services/IExtensionManager.cs b/src/api/wix/WixToolset.Extensibility/Services/IExtensionManager.cs index 8e49c38d..fe939a59 100644 --- a/src/api/wix/WixToolset.Extensibility/Services/IExtensionManager.cs +++ b/src/api/wix/WixToolset.Extensibility/Services/IExtensionManager.cs @@ -4,6 +4,7 @@ namespace WixToolset.Extensibility.Services { using System.Collections.Generic; using System.Reflection; + using WixToolset.Extensibility.Data; /// /// Loads extensions and uses the extensions' factories to provide services. @@ -32,6 +33,12 @@ namespace WixToolset.Extensibility.Services /// void Load(string extensionReference); + /// + /// Gets extensions cache locations. + /// + /// List of cache locations where extensions may be found. + IReadOnlyCollection GetCacheLocations(); + /// /// Gets extensions of specified type from factories loaded into the extension manager. /// -- cgit v1.2.3-55-g6feb