From a4be3486b60d232b546f438bc4bd7a4a80cf330c Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 28 Feb 2019 16:56:01 -0800 Subject: Expose WixVariableResolver via WixToolsetServiceProvider --- src/WixToolset.Core/CommandLine/BuildCommand.cs | 2 +- src/WixToolset.Core/Compiler.cs | 3 ++- src/WixToolset.Core/ILocalizer.cs | 4 ++-- src/WixToolset.Core/Librarian.cs | 2 +- src/WixToolset.Core/WixToolsetServiceProvider.cs | 2 +- src/WixToolset.Core/WixVariableResolver.cs | 7 +++---- 6 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/WixToolset.Core') 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 context.IntermediateFolder = intermediateFolder; context.IntermediateRepresentation = output; context.Localizations = localizations; - context.VariableResolver = new WixVariableResolver(this.Messaging); + context.VariableResolver = this.ServiceProvider.GetService(); var resolver = this.ServiceProvider.GetService(); 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 private string activeName; private string activeLanguage; + // TODO: Implement this differently to not require the VariableResolver. private WixVariableResolver componentIdPlaceholdersResolver; /// @@ -131,7 +132,7 @@ namespace WixToolset.Core this.Core = new CompilerCore(target, this.Messaging, parseHelper, extensionsByNamespace); this.Core.ShowPedanticMessages = this.ShowPedanticMessages; - this.componentIdPlaceholdersResolver = new WixVariableResolver(this.Messaging); + this.componentIdPlaceholdersResolver = new WixVariableResolver(this.ServiceProvider); // parse the document 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 @@ -// 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. +// 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.Core { @@ -6,7 +6,7 @@ namespace WixToolset.Core using WixToolset.Data; /// - /// Parses localization files and localizes database values. + /// Parses localization source files. /// public interface ILocalizer { 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 // Resolve paths to files that are to be embedded in the library. if (context.BindFiles) { - var variableResolver = new WixVariableResolver(this.Messaging); + var variableResolver = this.ServiceProvider.GetService(); var fileResolver = new FileResolver(context.BindPaths, context.Extensions); 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 this.AddService((provider, singletons) => new Linker(provider)); this.AddService((provider, singletons) => new Resolver(provider)); - // Internal implementations. this.AddService((provider, singletons) => new Localizer(provider)); + this.AddService((provider, singletons) => new WixVariableResolver(provider)); } private Dictionary, 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 /// /// Instantiate a new WixVariableResolver. /// - public WixVariableResolver(IMessaging messaging) + internal WixVariableResolver(IServiceProvider serviceProvider) { + this.Messaging = serviceProvider.GetService(); + this.locVariables = new Dictionary(); this.wixVariables = new Dictionary(); this.localizedControls = new Dictionary(); this.Codepage = -1; - this.Messaging = messaging; } private IMessaging Messaging { get; } @@ -88,8 +89,6 @@ namespace WixToolset.Core /// The value to resolve. /// true to only resolve localization variables; false otherwise. /// true if unknown variables should throw errors. - /// true if the resolved value was the default. - /// true if the value has variables that cannot yet be resolved. /// The resolved value. internal VariableResolution ResolveVariables(SourceLineNumber sourceLineNumbers, string value, bool localizationOnly, bool errorOnUnknown) { -- cgit v1.2.3-55-g6feb