diff options
Diffstat (limited to 'src')
17 files changed, 62 insertions, 34 deletions
diff --git a/src/WixToolset.Extensibility/BaseExtensionFactory.cs b/src/WixToolset.Extensibility/BaseExtensionFactory.cs index 2e7fdbb8..d0686b46 100644 --- a/src/WixToolset.Extensibility/BaseExtensionFactory.cs +++ b/src/WixToolset.Extensibility/BaseExtensionFactory.cs | |||
| @@ -7,6 +7,8 @@ namespace WixToolset.Extensibility | |||
| 7 | 7 | ||
| 8 | /// <summary> | 8 | /// <summary> |
| 9 | /// Base class for extension factories. | 9 | /// Base class for extension factories. |
| 10 | /// | ||
| 11 | /// Implementations may request an IWixToolsetCoreServiceProvider at instantiation by having a single parameter constructor for it. | ||
| 10 | /// </summary> | 12 | /// </summary> |
| 11 | public abstract class BaseExtensionFactory : IExtensionFactory | 13 | public abstract class BaseExtensionFactory : IExtensionFactory |
| 12 | { | 14 | { |
diff --git a/src/WixToolset.Extensibility/Data/IBindContext.cs b/src/WixToolset.Extensibility/Data/IBindContext.cs index b6e51d6d..87e61d53 100644 --- a/src/WixToolset.Extensibility/Data/IBindContext.cs +++ b/src/WixToolset.Extensibility/Data/IBindContext.cs | |||
| @@ -5,10 +5,11 @@ namespace WixToolset.Extensibility.Data | |||
| 5 | using System; | 5 | using System; |
| 6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
| 7 | using WixToolset.Data; | 7 | using WixToolset.Data; |
| 8 | using WixToolset.Extensibility.Services; | ||
| 8 | 9 | ||
| 9 | public interface IBindContext | 10 | public interface IBindContext |
| 10 | { | 11 | { |
| 11 | IServiceProvider ServiceProvider { get; } | 12 | IWixToolsetServiceProvider ServiceProvider { get; } |
| 12 | 13 | ||
| 13 | string BurnStubPath { get; set; } | 14 | string BurnStubPath { get; set; } |
| 14 | 15 | ||
diff --git a/src/WixToolset.Extensibility/Data/ICommandLineContext.cs b/src/WixToolset.Extensibility/Data/ICommandLineContext.cs index 1b2db4a4..41c913fe 100644 --- a/src/WixToolset.Extensibility/Data/ICommandLineContext.cs +++ b/src/WixToolset.Extensibility/Data/ICommandLineContext.cs | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | // 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. | 1 | // 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. |
| 2 | 2 | ||
| 3 | namespace WixToolset.Extensibility.Data | 3 | namespace WixToolset.Extensibility.Data |
| 4 | { | 4 | { |
| @@ -7,7 +7,7 @@ namespace WixToolset.Extensibility.Data | |||
| 7 | 7 | ||
| 8 | public interface ICommandLineContext | 8 | public interface ICommandLineContext |
| 9 | { | 9 | { |
| 10 | IServiceProvider ServiceProvider { get; } | 10 | IWixToolsetServiceProvider ServiceProvider { get; } |
| 11 | 11 | ||
| 12 | IExtensionManager ExtensionManager { get; set; } | 12 | IExtensionManager ExtensionManager { get; set; } |
| 13 | 13 | ||
diff --git a/src/WixToolset.Extensibility/Data/ICompileContext.cs b/src/WixToolset.Extensibility/Data/ICompileContext.cs index 50ad10b9..ef57f6d0 100644 --- a/src/WixToolset.Extensibility/Data/ICompileContext.cs +++ b/src/WixToolset.Extensibility/Data/ICompileContext.cs | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | // 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. | 1 | // 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. |
| 2 | 2 | ||
| 3 | namespace WixToolset.Extensibility.Data | 3 | namespace WixToolset.Extensibility.Data |
| 4 | { | 4 | { |
| @@ -6,10 +6,11 @@ namespace WixToolset.Extensibility.Data | |||
| 6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
| 7 | using System.Xml.Linq; | 7 | using System.Xml.Linq; |
| 8 | using WixToolset.Data; | 8 | using WixToolset.Data; |
| 9 | using WixToolset.Extensibility.Services; | ||
| 9 | 10 | ||
| 10 | public interface ICompileContext | 11 | public interface ICompileContext |
| 11 | { | 12 | { |
| 12 | IServiceProvider ServiceProvider { get; } | 13 | IWixToolsetServiceProvider ServiceProvider { get; } |
| 13 | 14 | ||
| 14 | string CompilationId { get; set; } | 15 | string CompilationId { get; set; } |
| 15 | 16 | ||
diff --git a/src/WixToolset.Extensibility/Data/IDecompileContext.cs b/src/WixToolset.Extensibility/Data/IDecompileContext.cs index f61fd84a..29d6fb3b 100644 --- a/src/WixToolset.Extensibility/Data/IDecompileContext.cs +++ b/src/WixToolset.Extensibility/Data/IDecompileContext.cs | |||
| @@ -5,10 +5,11 @@ namespace WixToolset.Extensibility.Data | |||
| 5 | using System; | 5 | using System; |
| 6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
| 7 | using WixToolset.Data; | 7 | using WixToolset.Data; |
| 8 | using WixToolset.Extensibility.Services; | ||
| 8 | 9 | ||
| 9 | public interface IDecompileContext | 10 | public interface IDecompileContext |
| 10 | { | 11 | { |
| 11 | IServiceProvider ServiceProvider { get; } | 12 | IWixToolsetServiceProvider ServiceProvider { get; } |
| 12 | 13 | ||
| 13 | string DecompilePath { get; set; } | 14 | string DecompilePath { get; set; } |
| 14 | 15 | ||
diff --git a/src/WixToolset.Extensibility/Data/IFileSystemContext.cs b/src/WixToolset.Extensibility/Data/IFileSystemContext.cs index 86fc106c..f27e16d5 100644 --- a/src/WixToolset.Extensibility/Data/IFileSystemContext.cs +++ b/src/WixToolset.Extensibility/Data/IFileSystemContext.cs | |||
| @@ -1,13 +1,14 @@ | |||
| 1 | // 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. | 1 | // 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. |
| 2 | 2 | ||
| 3 | namespace WixToolset.Extensibility.Data | 3 | namespace WixToolset.Extensibility.Data |
| 4 | { | 4 | { |
| 5 | using System; | 5 | using System; |
| 6 | using WixToolset.Data; | 6 | using WixToolset.Data; |
| 7 | using WixToolset.Extensibility.Services; | ||
| 7 | 8 | ||
| 8 | public interface IFileSystemContext | 9 | public interface IFileSystemContext |
| 9 | { | 10 | { |
| 10 | IServiceProvider ServiceProvider { get; } | 11 | IWixToolsetServiceProvider ServiceProvider { get; } |
| 11 | 12 | ||
| 12 | string CabCachePath { get; set; } | 13 | string CabCachePath { get; set; } |
| 13 | 14 | ||
diff --git a/src/WixToolset.Extensibility/Data/IInscribeContext.cs b/src/WixToolset.Extensibility/Data/IInscribeContext.cs index 4f13ba10..816a0c80 100644 --- a/src/WixToolset.Extensibility/Data/IInscribeContext.cs +++ b/src/WixToolset.Extensibility/Data/IInscribeContext.cs | |||
| @@ -1,12 +1,13 @@ | |||
| 1 | // 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. | 1 | // 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. |
| 2 | 2 | ||
| 3 | namespace WixToolset.Extensibility.Data | 3 | namespace WixToolset.Extensibility.Data |
| 4 | { | 4 | { |
| 5 | using System; | 5 | using System; |
| 6 | using WixToolset.Extensibility.Services; | ||
| 6 | 7 | ||
| 7 | public interface IInscribeContext | 8 | public interface IInscribeContext |
| 8 | { | 9 | { |
| 9 | IServiceProvider ServiceProvider { get; } | 10 | IWixToolsetServiceProvider ServiceProvider { get; } |
| 10 | 11 | ||
| 11 | string InputFilePath { get; set; } | 12 | string InputFilePath { get; set; } |
| 12 | 13 | ||
diff --git a/src/WixToolset.Extensibility/Data/ILayoutContext.cs b/src/WixToolset.Extensibility/Data/ILayoutContext.cs index 5c0a46c7..721c5094 100644 --- a/src/WixToolset.Extensibility/Data/ILayoutContext.cs +++ b/src/WixToolset.Extensibility/Data/ILayoutContext.cs | |||
| @@ -1,13 +1,14 @@ | |||
| 1 | // 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. | 1 | // 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. |
| 2 | 2 | ||
| 3 | namespace WixToolset.Extensibility.Data | 3 | namespace WixToolset.Extensibility.Data |
| 4 | { | 4 | { |
| 5 | using System; | 5 | using System; |
| 6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
| 7 | using WixToolset.Extensibility.Services; | ||
| 7 | 8 | ||
| 8 | public interface ILayoutContext | 9 | public interface ILayoutContext |
| 9 | { | 10 | { |
| 10 | IServiceProvider ServiceProvider { get; } | 11 | IWixToolsetServiceProvider ServiceProvider { get; } |
| 11 | 12 | ||
| 12 | IEnumerable<ILayoutExtension> Extensions { get; set; } | 13 | IEnumerable<ILayoutExtension> Extensions { get; set; } |
| 13 | 14 | ||
diff --git a/src/WixToolset.Extensibility/Data/ILibraryContext.cs b/src/WixToolset.Extensibility/Data/ILibraryContext.cs index 9b65ebfd..0371137b 100644 --- a/src/WixToolset.Extensibility/Data/ILibraryContext.cs +++ b/src/WixToolset.Extensibility/Data/ILibraryContext.cs | |||
| @@ -5,10 +5,11 @@ namespace WixToolset.Extensibility.Data | |||
| 5 | using System; | 5 | using System; |
| 6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
| 7 | using WixToolset.Data; | 7 | using WixToolset.Data; |
| 8 | using WixToolset.Extensibility.Services; | ||
| 8 | 9 | ||
| 9 | public interface ILibraryContext | 10 | public interface ILibraryContext |
| 10 | { | 11 | { |
| 11 | IServiceProvider ServiceProvider { get; } | 12 | IWixToolsetServiceProvider ServiceProvider { get; } |
| 12 | 13 | ||
| 13 | bool BindFiles { get; set; } | 14 | bool BindFiles { get; set; } |
| 14 | 15 | ||
diff --git a/src/WixToolset.Extensibility/Data/ILinkContext.cs b/src/WixToolset.Extensibility/Data/ILinkContext.cs index 8c1d6f22..4212339e 100644 --- a/src/WixToolset.Extensibility/Data/ILinkContext.cs +++ b/src/WixToolset.Extensibility/Data/ILinkContext.cs | |||
| @@ -1,14 +1,15 @@ | |||
| 1 | // 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. | 1 | // 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. |
| 2 | 2 | ||
| 3 | namespace WixToolset.Extensibility.Data | 3 | namespace WixToolset.Extensibility.Data |
| 4 | { | 4 | { |
| 5 | using System; | 5 | using System; |
| 6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
| 7 | using WixToolset.Data; | 7 | using WixToolset.Data; |
| 8 | using WixToolset.Extensibility.Services; | ||
| 8 | 9 | ||
| 9 | public interface ILinkContext | 10 | public interface ILinkContext |
| 10 | { | 11 | { |
| 11 | IServiceProvider ServiceProvider { get; } | 12 | IWixToolsetServiceProvider ServiceProvider { get; } |
| 12 | 13 | ||
| 13 | IEnumerable<ILinkerExtension> Extensions { get; set; } | 14 | IEnumerable<ILinkerExtension> Extensions { get; set; } |
| 14 | 15 | ||
diff --git a/src/WixToolset.Extensibility/Data/IPreprocessContext.cs b/src/WixToolset.Extensibility/Data/IPreprocessContext.cs index 42dfbb75..89cbdd5d 100644 --- a/src/WixToolset.Extensibility/Data/IPreprocessContext.cs +++ b/src/WixToolset.Extensibility/Data/IPreprocessContext.cs | |||
| @@ -5,10 +5,11 @@ namespace WixToolset.Extensibility.Data | |||
| 5 | using System; | 5 | using System; |
| 6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
| 7 | using WixToolset.Data; | 7 | using WixToolset.Data; |
| 8 | using WixToolset.Extensibility.Services; | ||
| 8 | 9 | ||
| 9 | public interface IPreprocessContext | 10 | public interface IPreprocessContext |
| 10 | { | 11 | { |
| 11 | IServiceProvider ServiceProvider { get; } | 12 | IWixToolsetServiceProvider ServiceProvider { get; } |
| 12 | 13 | ||
| 13 | IEnumerable<IPreprocessorExtension> Extensions { get; set; } | 14 | IEnumerable<IPreprocessorExtension> Extensions { get; set; } |
| 14 | 15 | ||
diff --git a/src/WixToolset.Extensibility/Data/IResolveContext.cs b/src/WixToolset.Extensibility/Data/IResolveContext.cs index 608ce5d5..95845317 100644 --- a/src/WixToolset.Extensibility/Data/IResolveContext.cs +++ b/src/WixToolset.Extensibility/Data/IResolveContext.cs | |||
| @@ -5,10 +5,11 @@ namespace WixToolset.Extensibility.Data | |||
| 5 | using System; | 5 | using System; |
| 6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
| 7 | using WixToolset.Data; | 7 | using WixToolset.Data; |
| 8 | using WixToolset.Extensibility.Services; | ||
| 8 | 9 | ||
| 9 | public interface IResolveContext | 10 | public interface IResolveContext |
| 10 | { | 11 | { |
| 11 | IServiceProvider ServiceProvider { get; } | 12 | IWixToolsetServiceProvider ServiceProvider { get; } |
| 12 | 13 | ||
| 13 | IEnumerable<IBindPath> BindPaths { get; set; } | 14 | IEnumerable<IBindPath> BindPaths { get; set; } |
| 14 | 15 | ||
diff --git a/src/WixToolset.Extensibility/Data/IUnbindContext.cs b/src/WixToolset.Extensibility/Data/IUnbindContext.cs index 84dc5167..bdc31240 100644 --- a/src/WixToolset.Extensibility/Data/IUnbindContext.cs +++ b/src/WixToolset.Extensibility/Data/IUnbindContext.cs | |||
| @@ -1,12 +1,13 @@ | |||
| 1 | // 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. | 1 | // 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. |
| 2 | 2 | ||
| 3 | namespace WixToolset.Extensibility.Data | 3 | namespace WixToolset.Extensibility.Data |
| 4 | { | 4 | { |
| 5 | using System; | 5 | using System; |
| 6 | using WixToolset.Extensibility.Services; | ||
| 6 | 7 | ||
| 7 | public interface IUnbindContext | 8 | public interface IUnbindContext |
| 8 | { | 9 | { |
| 9 | IServiceProvider ServiceProvider { get; } | 10 | IWixToolsetServiceProvider ServiceProvider { get; } |
| 10 | 11 | ||
| 11 | string ExportBasePath { get; set; } | 12 | string ExportBasePath { get; set; } |
| 12 | 13 | ||
diff --git a/src/WixToolset.Extensibility/IExtensionFactory.cs b/src/WixToolset.Extensibility/IExtensionFactory.cs index 234f64fa..f86fdde0 100644 --- a/src/WixToolset.Extensibility/IExtensionFactory.cs +++ b/src/WixToolset.Extensibility/IExtensionFactory.cs | |||
| @@ -1,9 +1,12 @@ | |||
| 1 | // 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. | 1 | // 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. |
| 2 | 2 | ||
| 3 | namespace WixToolset.Extensibility | 3 | namespace WixToolset.Extensibility |
| 4 | { | 4 | { |
| 5 | using System; | 5 | using System; |
| 6 | 6 | ||
| 7 | /// <summary> | ||
| 8 | /// Implementations may request an IWixToolsetCoreServiceProvider at instantiation by having a single parameter constructor for it. | ||
| 9 | /// </summary> | ||
| 7 | public interface IExtensionFactory | 10 | public interface IExtensionFactory |
| 8 | { | 11 | { |
| 9 | /// <summary> | 12 | /// <summary> |
diff --git a/src/WixToolset.Extensibility/Services/IWixToolsetServiceProvider.cs b/src/WixToolset.Extensibility/Services/IWixToolsetServiceProvider.cs new file mode 100644 index 00000000..c9ef36e1 --- /dev/null +++ b/src/WixToolset.Extensibility/Services/IWixToolsetServiceProvider.cs | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | // 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. | ||
| 2 | |||
| 3 | namespace WixToolset.Extensibility.Services | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | |||
| 7 | public interface IWixToolsetServiceProvider : IServiceProvider | ||
| 8 | { | ||
| 9 | bool TryGetService(Type serviceType, out object service); | ||
| 10 | bool TryGetService<T>(out T service) where T : class; | ||
| 11 | T GetService<T>() where T : class; | ||
| 12 | } | ||
| 13 | } | ||
diff --git a/src/WixToolset.Extensibility/Services/IWixtoolsetCoreServiceProvider.cs b/src/WixToolset.Extensibility/Services/IWixtoolsetCoreServiceProvider.cs new file mode 100644 index 00000000..cda725f7 --- /dev/null +++ b/src/WixToolset.Extensibility/Services/IWixtoolsetCoreServiceProvider.cs | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | // 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. | ||
| 2 | |||
| 3 | namespace WixToolset.Extensibility.Services | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.Collections.Generic; | ||
| 7 | |||
| 8 | public interface IWixToolsetCoreServiceProvider : IWixToolsetServiceProvider | ||
| 9 | { | ||
| 10 | void AddService(Type serviceType, Func<IWixToolsetCoreServiceProvider, Dictionary<Type, object>, object> creationFunction); | ||
| 11 | void AddService<T>(Func<IWixToolsetCoreServiceProvider, Dictionary<Type, object>, T> creationFunction) where T : class; | ||
| 12 | } | ||
| 13 | } | ||
diff --git a/src/WixToolset.Extensibility/Services/ServiceProviderExtensions.cs b/src/WixToolset.Extensibility/Services/ServiceProviderExtensions.cs deleted file mode 100644 index f4a5e8c3..00000000 --- a/src/WixToolset.Extensibility/Services/ServiceProviderExtensions.cs +++ /dev/null | |||
| @@ -1,14 +0,0 @@ | |||
| 1 | // 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. | ||
| 2 | |||
| 3 | namespace WixToolset.Extensibility.Services | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | |||
| 7 | public static class ServiceProviderExtensions | ||
| 8 | { | ||
| 9 | public static T GetService<T>(this IServiceProvider serviceProvider) where T : class | ||
| 10 | { | ||
| 11 | return (T)serviceProvider.GetService(typeof(T)); | ||
| 12 | } | ||
| 13 | } | ||
| 14 | } | ||
