diff options
Diffstat (limited to 'src/api')
4 files changed, 110 insertions, 1 deletions
diff --git a/src/api/wix/WixToolset.Extensibility/BaseOptimizerExtension.cs b/src/api/wix/WixToolset.Extensibility/BaseOptimizerExtension.cs new file mode 100644 index 00000000..5bb89272 --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/BaseOptimizerExtension.cs | |||
| @@ -0,0 +1,26 @@ | |||
| 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 | ||
| 4 | { | ||
| 5 | using WixToolset.Extensibility.Data; | ||
| 6 | |||
| 7 | /// <summary> | ||
| 8 | /// Base class for creating an optimizer extension. | ||
| 9 | /// </summary> | ||
| 10 | public abstract class BaseOptimizerExtension : IOptimizerExtension | ||
| 11 | { | ||
| 12 | /// <summary> | ||
| 13 | /// Called after all files have been compiled, before built-in optimizations, and before all sections are linked into a single section. | ||
| 14 | /// </summary> | ||
| 15 | public virtual void PreOptimize(IOptimizeContext context) | ||
| 16 | { | ||
| 17 | } | ||
| 18 | |||
| 19 | /// <summary> | ||
| 20 | /// Called after all files have been compiled, after built-in optimizations, and before all sections are linked into a single section. | ||
| 21 | /// </summary> | ||
| 22 | public virtual void PostOptimize(IOptimizeContext context) | ||
| 23 | { | ||
| 24 | } | ||
| 25 | } | ||
| 26 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/Data/ICompileContext.cs b/src/api/wix/WixToolset.Extensibility/Data/ICompileContext.cs index 7006fde8..cfccd0a9 100644 --- a/src/api/wix/WixToolset.Extensibility/Data/ICompileContext.cs +++ b/src/api/wix/WixToolset.Extensibility/Data/ICompileContext.cs | |||
| @@ -55,7 +55,7 @@ namespace WixToolset.Extensibility.Data | |||
| 55 | XDocument Source { get; set; } | 55 | XDocument Source { get; set; } |
| 56 | 56 | ||
| 57 | /// <summary> | 57 | /// <summary> |
| 58 | /// Cancellation token to abort cancellation. | 58 | /// Cancellation token. |
| 59 | /// </summary> | 59 | /// </summary> |
| 60 | CancellationToken CancellationToken { get; set; } | 60 | CancellationToken CancellationToken { get; set; } |
| 61 | } | 61 | } |
diff --git a/src/api/wix/WixToolset.Extensibility/Data/IOptimizeContext.cs b/src/api/wix/WixToolset.Extensibility/Data/IOptimizeContext.cs new file mode 100644 index 00000000..5684ebcd --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/Data/IOptimizeContext.cs | |||
| @@ -0,0 +1,61 @@ | |||
| 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.Data | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.Collections.Generic; | ||
| 7 | using System.Threading; | ||
| 8 | using WixToolset.Data; | ||
| 9 | |||
| 10 | /// <summary> | ||
| 11 | /// Context provided to the optimizer. | ||
| 12 | /// </summary> | ||
| 13 | public interface IOptimizeContext | ||
| 14 | { | ||
| 15 | /// <summary> | ||
| 16 | /// Service provider made available to the optimizer and its extensions. | ||
| 17 | /// </summary> | ||
| 18 | IServiceProvider ServiceProvider { get; } | ||
| 19 | |||
| 20 | /// <summary> | ||
| 21 | /// Set of extensions provided to the optimizer. | ||
| 22 | /// </summary> | ||
| 23 | IReadOnlyCollection<IOptimizerExtension> Extensions { get; set; } | ||
| 24 | |||
| 25 | /// <summary> | ||
| 26 | /// Intermediate folder. | ||
| 27 | /// </summary> | ||
| 28 | string IntermediateFolder { get; set; } | ||
| 29 | |||
| 30 | /// <summary> | ||
| 31 | /// Collection of bindpaths used to bind files. | ||
| 32 | /// </summary> | ||
| 33 | IReadOnlyCollection<IBindPath> BindPaths { get; set; } | ||
| 34 | |||
| 35 | /// <summary> | ||
| 36 | /// Bind variables used during optimization. | ||
| 37 | /// </summary> | ||
| 38 | IDictionary<string, string> BindVariables { get; set; } | ||
| 39 | |||
| 40 | /// <summary> | ||
| 41 | /// Gets or sets the platform which the optimizer will use when defaulting 64-bit symbol properties. | ||
| 42 | /// </summary> | ||
| 43 | /// <value>The platform which the optimizer will use when defaulting 64-bit symbol properties.</value> | ||
| 44 | Platform Platform { get; set; } | ||
| 45 | |||
| 46 | /// <summary> | ||
| 47 | /// Collection of intermediates to optimize. | ||
| 48 | /// </summary> | ||
| 49 | IReadOnlyCollection<Intermediate> Intermediates { get; set; } | ||
| 50 | |||
| 51 | /// <summary> | ||
| 52 | /// Collection of localization files to use in the optimizer. | ||
| 53 | /// </summary> | ||
| 54 | IReadOnlyCollection<Localization> Localizations { get; set; } | ||
| 55 | |||
| 56 | /// <summary> | ||
| 57 | /// Cancellation token. | ||
| 58 | /// </summary> | ||
| 59 | CancellationToken CancellationToken { get; set; } | ||
| 60 | } | ||
| 61 | } | ||
diff --git a/src/api/wix/WixToolset.Extensibility/IOptimizerExtension.cs b/src/api/wix/WixToolset.Extensibility/IOptimizerExtension.cs new file mode 100644 index 00000000..589e7ecc --- /dev/null +++ b/src/api/wix/WixToolset.Extensibility/IOptimizerExtension.cs | |||
| @@ -0,0 +1,22 @@ | |||
| 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 | ||
| 4 | { | ||
| 5 | using WixToolset.Extensibility.Data; | ||
| 6 | |||
| 7 | /// <summary> | ||
| 8 | /// Interface that all optimizer extensions implement. | ||
| 9 | /// </summary> | ||
| 10 | public interface IOptimizerExtension | ||
| 11 | { | ||
| 12 | /// <summary> | ||
| 13 | /// Called after all files have been compiled, before built-in optimizations, and before all sections are linked into a single section. | ||
| 14 | /// </summary> | ||
| 15 | void PreOptimize(IOptimizeContext context); | ||
| 16 | |||
| 17 | /// <summary> | ||
| 18 | /// Called after all files have been compiled, after built-in optimizations, and before all sections are linked into a single section. | ||
| 19 | /// </summary> | ||
| 20 | void PostOptimize(IOptimizeContext context); | ||
| 21 | } | ||
| 22 | } | ||
