diff options
| author | Rob Mensching <rob@firegiant.com> | 2019-02-28 16:56:01 -0800 |
|---|---|---|
| committer | Rob Mensching <rob@robmensching.com> | 2019-03-01 07:57:55 -0800 |
| commit | a4be3486b60d232b546f438bc4bd7a4a80cf330c (patch) | |
| tree | ee9dcba4476e4a4bee2a24e397612f816883cecf | |
| parent | a4cd45daef6b6705c0fcf2296e2a78427f702b30 (diff) | |
| download | wix-a4be3486b60d232b546f438bc4bd7a4a80cf330c.tar.gz wix-a4be3486b60d232b546f438bc4bd7a4a80cf330c.tar.bz2 wix-a4be3486b60d232b546f438bc4bd7a4a80cf330c.zip | |
Expose WixVariableResolver via WixToolsetServiceProvider
| -rw-r--r-- | src/WixToolset.Core/CommandLine/BuildCommand.cs | 2 | ||||
| -rw-r--r-- | src/WixToolset.Core/Compiler.cs | 3 | ||||
| -rw-r--r-- | src/WixToolset.Core/ILocalizer.cs | 4 | ||||
| -rw-r--r-- | src/WixToolset.Core/Librarian.cs | 2 | ||||
| -rw-r--r-- | src/WixToolset.Core/WixToolsetServiceProvider.cs | 2 | ||||
| -rw-r--r-- | src/WixToolset.Core/WixVariableResolver.cs | 7 |
6 files changed, 10 insertions, 10 deletions
diff --git a/src/WixToolset.Core/CommandLine/BuildCommand.cs b/src/WixToolset.Core/CommandLine/BuildCommand.cs index f754c876..6b5d01a0 100644 --- a/src/WixToolset.Core/CommandLine/BuildCommand.cs +++ b/src/WixToolset.Core/CommandLine/BuildCommand.cs | |||
| @@ -275,7 +275,7 @@ namespace WixToolset.Core.CommandLine | |||
| 275 | context.IntermediateFolder = intermediateFolder; | 275 | context.IntermediateFolder = intermediateFolder; |
| 276 | context.IntermediateRepresentation = output; | 276 | context.IntermediateRepresentation = output; |
| 277 | context.Localizations = localizations; | 277 | context.Localizations = localizations; |
| 278 | context.VariableResolver = new WixVariableResolver(this.Messaging); | 278 | context.VariableResolver = this.ServiceProvider.GetService<IVariableResolver>(); |
| 279 | 279 | ||
| 280 | var resolver = this.ServiceProvider.GetService<IResolver>(); | 280 | var resolver = this.ServiceProvider.GetService<IResolver>(); |
| 281 | resolveResult = resolver.Resolve(context); | 281 | resolveResult = resolver.Resolve(context); |
diff --git a/src/WixToolset.Core/Compiler.cs b/src/WixToolset.Core/Compiler.cs index 06a7dd10..da42506a 100644 --- a/src/WixToolset.Core/Compiler.cs +++ b/src/WixToolset.Core/Compiler.cs | |||
| @@ -45,6 +45,7 @@ namespace WixToolset.Core | |||
| 45 | private string activeName; | 45 | private string activeName; |
| 46 | private string activeLanguage; | 46 | private string activeLanguage; |
| 47 | 47 | ||
| 48 | // TODO: Implement this differently to not require the VariableResolver. | ||
| 48 | private WixVariableResolver componentIdPlaceholdersResolver; | 49 | private WixVariableResolver componentIdPlaceholdersResolver; |
| 49 | 50 | ||
| 50 | /// <summary> | 51 | /// <summary> |
| @@ -131,7 +132,7 @@ namespace WixToolset.Core | |||
| 131 | 132 | ||
| 132 | this.Core = new CompilerCore(target, this.Messaging, parseHelper, extensionsByNamespace); | 133 | this.Core = new CompilerCore(target, this.Messaging, parseHelper, extensionsByNamespace); |
| 133 | this.Core.ShowPedanticMessages = this.ShowPedanticMessages; | 134 | this.Core.ShowPedanticMessages = this.ShowPedanticMessages; |
| 134 | this.componentIdPlaceholdersResolver = new WixVariableResolver(this.Messaging); | 135 | this.componentIdPlaceholdersResolver = new WixVariableResolver(this.ServiceProvider); |
| 135 | 136 | ||
| 136 | // parse the document | 137 | // parse the document |
| 137 | var source = this.Context.Source; | 138 | var source = this.Context.Source; |
diff --git a/src/WixToolset.Core/ILocalizer.cs b/src/WixToolset.Core/ILocalizer.cs index f15d9ba7..ba39dd5c 100644 --- a/src/WixToolset.Core/ILocalizer.cs +++ b/src/WixToolset.Core/ILocalizer.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.Core | 3 | namespace WixToolset.Core |
| 4 | { | 4 | { |
| @@ -6,7 +6,7 @@ namespace WixToolset.Core | |||
| 6 | using WixToolset.Data; | 6 | using WixToolset.Data; |
| 7 | 7 | ||
| 8 | /// <summary> | 8 | /// <summary> |
| 9 | /// Parses localization files and localizes database values. | 9 | /// Parses localization source files. |
| 10 | /// </summary> | 10 | /// </summary> |
| 11 | public interface ILocalizer | 11 | public interface ILocalizer |
| 12 | { | 12 | { |
diff --git a/src/WixToolset.Core/Librarian.cs b/src/WixToolset.Core/Librarian.cs index 5db4b219..a3bdc170 100644 --- a/src/WixToolset.Core/Librarian.cs +++ b/src/WixToolset.Core/Librarian.cs | |||
| @@ -106,7 +106,7 @@ namespace WixToolset.Core | |||
| 106 | // Resolve paths to files that are to be embedded in the library. | 106 | // Resolve paths to files that are to be embedded in the library. |
| 107 | if (context.BindFiles) | 107 | if (context.BindFiles) |
| 108 | { | 108 | { |
| 109 | var variableResolver = new WixVariableResolver(this.Messaging); | 109 | var variableResolver = this.ServiceProvider.GetService<IVariableResolver>(); |
| 110 | 110 | ||
| 111 | var fileResolver = new FileResolver(context.BindPaths, context.Extensions); | 111 | var fileResolver = new FileResolver(context.BindPaths, context.Extensions); |
| 112 | 112 | ||
diff --git a/src/WixToolset.Core/WixToolsetServiceProvider.cs b/src/WixToolset.Core/WixToolsetServiceProvider.cs index 74c886d6..5c7b318e 100644 --- a/src/WixToolset.Core/WixToolsetServiceProvider.cs +++ b/src/WixToolset.Core/WixToolsetServiceProvider.cs | |||
| @@ -49,8 +49,8 @@ namespace WixToolset.Core | |||
| 49 | this.AddService<ILinker>((provider, singletons) => new Linker(provider)); | 49 | this.AddService<ILinker>((provider, singletons) => new Linker(provider)); |
| 50 | this.AddService<IResolver>((provider, singletons) => new Resolver(provider)); | 50 | this.AddService<IResolver>((provider, singletons) => new Resolver(provider)); |
| 51 | 51 | ||
| 52 | // Internal implementations. | ||
| 53 | this.AddService<ILocalizer>((provider, singletons) => new Localizer(provider)); | 52 | this.AddService<ILocalizer>((provider, singletons) => new Localizer(provider)); |
| 53 | this.AddService<IVariableResolver>((provider, singletons) => new WixVariableResolver(provider)); | ||
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | private Dictionary<Type, Func<IServiceProvider, Dictionary<Type, object>, object>> CreationFunctions { get; } | 56 | private Dictionary<Type, Func<IServiceProvider, Dictionary<Type, object>, object>> CreationFunctions { get; } |
diff --git a/src/WixToolset.Core/WixVariableResolver.cs b/src/WixToolset.Core/WixVariableResolver.cs index 75851a56..9d604065 100644 --- a/src/WixToolset.Core/WixVariableResolver.cs +++ b/src/WixToolset.Core/WixVariableResolver.cs | |||
| @@ -21,13 +21,14 @@ namespace WixToolset.Core | |||
| 21 | /// <summary> | 21 | /// <summary> |
| 22 | /// Instantiate a new WixVariableResolver. | 22 | /// Instantiate a new WixVariableResolver. |
| 23 | /// </summary> | 23 | /// </summary> |
| 24 | public WixVariableResolver(IMessaging messaging) | 24 | internal WixVariableResolver(IServiceProvider serviceProvider) |
| 25 | { | 25 | { |
| 26 | this.Messaging = serviceProvider.GetService<IMessaging>(); | ||
| 27 | |||
| 26 | this.locVariables = new Dictionary<string, BindVariable>(); | 28 | this.locVariables = new Dictionary<string, BindVariable>(); |
| 27 | this.wixVariables = new Dictionary<string, BindVariable>(); | 29 | this.wixVariables = new Dictionary<string, BindVariable>(); |
| 28 | this.localizedControls = new Dictionary<string, LocalizedControl>(); | 30 | this.localizedControls = new Dictionary<string, LocalizedControl>(); |
| 29 | this.Codepage = -1; | 31 | this.Codepage = -1; |
| 30 | this.Messaging = messaging; | ||
| 31 | } | 32 | } |
| 32 | 33 | ||
| 33 | private IMessaging Messaging { get; } | 34 | private IMessaging Messaging { get; } |
| @@ -88,8 +89,6 @@ namespace WixToolset.Core | |||
| 88 | /// <param name="value">The value to resolve.</param> | 89 | /// <param name="value">The value to resolve.</param> |
| 89 | /// <param name="localizationOnly">true to only resolve localization variables; false otherwise.</param> | 90 | /// <param name="localizationOnly">true to only resolve localization variables; false otherwise.</param> |
| 90 | /// <param name="errorOnUnknown">true if unknown variables should throw errors.</param> | 91 | /// <param name="errorOnUnknown">true if unknown variables should throw errors.</param> |
| 91 | /// <param name="isDefault">true if the resolved value was the default.</param> | ||
| 92 | /// <param name="delayedResolve">true if the value has variables that cannot yet be resolved.</param> | ||
| 93 | /// <returns>The resolved value.</returns> | 92 | /// <returns>The resolved value.</returns> |
| 94 | internal VariableResolution ResolveVariables(SourceLineNumber sourceLineNumbers, string value, bool localizationOnly, bool errorOnUnknown) | 93 | internal VariableResolution ResolveVariables(SourceLineNumber sourceLineNumbers, string value, bool localizationOnly, bool errorOnUnknown) |
| 95 | { | 94 | { |
