From 5a1afc9030a1fcc101b6bb52b576fbbfa3ad33c2 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Mon, 23 Jul 2018 14:21:40 -0700 Subject: Integrate Extensibility.Data namespace change from Extensibility repo --- src/WixToolset.Core/Bind/DelayedField.cs | 2 +- src/WixToolset.Core/Bind/ExpectedExtractFile.cs | 2 +- .../Bind/ExtractEmbeddedFilesCommand.cs | 2 +- src/WixToolset.Core/Bind/FileResolver.cs | 2 +- .../Bind/ResolveDelayedFieldsCommand.cs | 2 +- src/WixToolset.Core/Bind/ResolveFieldsCommand.cs | 2 +- src/WixToolset.Core/Bind/TransferFilesCommand.cs | 2 +- src/WixToolset.Core/BindContext.cs | 4 +-- src/WixToolset.Core/Binder.cs | 3 +- src/WixToolset.Core/CommandLine/BuildCommand.cs | 3 +- .../CommandLine/CommandLineArguments.cs | 1 + .../CommandLine/CommandLineContext.cs | 3 +- .../CommandLine/CommandLineParser.cs | 32 ++++++++++++++-------- src/WixToolset.Core/CommandLine/CompileCommand.cs | 3 +- src/WixToolset.Core/CommandLine/HelpCommand.cs | 2 +- src/WixToolset.Core/CommandLine/VersionCommand.cs | 2 +- src/WixToolset.Core/CompileContext.cs | 4 +-- src/WixToolset.Core/Compiler.cs | 14 ++++++---- src/WixToolset.Core/CompilerCore.cs | 1 + .../ExtensibilityServices/ParseHelper.cs | 3 +- .../ExtensibilityServices/PreprocessHelper.cs | 25 ++++++++++------- src/WixToolset.Core/IncribeContext.cs | 4 +-- src/WixToolset.Core/Layout.cs | 15 +++++----- src/WixToolset.Core/LayoutContext.cs | 5 +--- src/WixToolset.Core/Librarian.cs | 18 +++++++----- src/WixToolset.Core/LibraryContext.cs | 1 + src/WixToolset.Core/LinkContext.cs | 4 +-- src/WixToolset.Core/Linker.cs | 29 +++++++++++--------- src/WixToolset.Core/PreprocessContext.cs | 4 +-- src/WixToolset.Core/Preprocessor.cs | 18 +++++++----- src/WixToolset.Core/ResolveContext.cs | 3 +- src/WixToolset.Core/Resolver.cs | 12 +++++--- src/WixToolset.Core/WixToolsetServiceProvider.cs | 4 +-- 33 files changed, 124 insertions(+), 107 deletions(-) (limited to 'src/WixToolset.Core') diff --git a/src/WixToolset.Core/Bind/DelayedField.cs b/src/WixToolset.Core/Bind/DelayedField.cs index 8b761b94..7d0045e6 100644 --- a/src/WixToolset.Core/Bind/DelayedField.cs +++ b/src/WixToolset.Core/Bind/DelayedField.cs @@ -3,7 +3,7 @@ namespace WixToolset.Core.Bind { using WixToolset.Data; - using WixToolset.Extensibility; + using WixToolset.Extensibility.Data; /// /// Structure used to hold a row and field that contain binder variables, which need to be resolved diff --git a/src/WixToolset.Core/Bind/ExpectedExtractFile.cs b/src/WixToolset.Core/Bind/ExpectedExtractFile.cs index fc2b43c7..afad12fc 100644 --- a/src/WixToolset.Core/Bind/ExpectedExtractFile.cs +++ b/src/WixToolset.Core/Bind/ExpectedExtractFile.cs @@ -3,7 +3,7 @@ namespace WixToolset.Core.Bind { using System; - using WixToolset.Extensibility; + using WixToolset.Extensibility.Data; internal class ExpectedExtractFile : IExpectedExtractFile { diff --git a/src/WixToolset.Core/Bind/ExtractEmbeddedFilesCommand.cs b/src/WixToolset.Core/Bind/ExtractEmbeddedFilesCommand.cs index 7e7c21b1..d82609db 100644 --- a/src/WixToolset.Core/Bind/ExtractEmbeddedFilesCommand.cs +++ b/src/WixToolset.Core/Bind/ExtractEmbeddedFilesCommand.cs @@ -7,7 +7,7 @@ namespace WixToolset.Core.Bind using System.Linq; using System.Reflection; using WixToolset.Data; - using WixToolset.Extensibility; + using WixToolset.Extensibility.Data; public class ExtractEmbeddedFilesCommand { diff --git a/src/WixToolset.Core/Bind/FileResolver.cs b/src/WixToolset.Core/Bind/FileResolver.cs index a20d3f34..86075e46 100644 --- a/src/WixToolset.Core/Bind/FileResolver.cs +++ b/src/WixToolset.Core/Bind/FileResolver.cs @@ -7,8 +7,8 @@ namespace WixToolset.Core.Bind using System.IO; using System.Linq; using WixToolset.Data; - using WixToolset.Data.Bind; using WixToolset.Extensibility; + using WixToolset.Extensibility.Data; internal class FileResolver { diff --git a/src/WixToolset.Core/Bind/ResolveDelayedFieldsCommand.cs b/src/WixToolset.Core/Bind/ResolveDelayedFieldsCommand.cs index 6f8da9ec..bec03907 100644 --- a/src/WixToolset.Core/Bind/ResolveDelayedFieldsCommand.cs +++ b/src/WixToolset.Core/Bind/ResolveDelayedFieldsCommand.cs @@ -7,7 +7,7 @@ namespace WixToolset.Core.Bind using System.Globalization; using System.Text; using WixToolset.Data; - using WixToolset.Extensibility; + using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; /// diff --git a/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs b/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs index 744f022c..0d5c3142 100644 --- a/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs +++ b/src/WixToolset.Core/Bind/ResolveFieldsCommand.cs @@ -5,8 +5,8 @@ namespace WixToolset.Core.Bind using System; using System.Collections.Generic; using WixToolset.Data; - using WixToolset.Data.Bind; using WixToolset.Extensibility; + using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; /// diff --git a/src/WixToolset.Core/Bind/TransferFilesCommand.cs b/src/WixToolset.Core/Bind/TransferFilesCommand.cs index 6230a4f5..79f0cd81 100644 --- a/src/WixToolset.Core/Bind/TransferFilesCommand.cs +++ b/src/WixToolset.Core/Bind/TransferFilesCommand.cs @@ -7,8 +7,8 @@ namespace WixToolset.Core.Bind using System.IO; using System.Security.AccessControl; using WixToolset.Data; - using WixToolset.Data.Bind; using WixToolset.Extensibility; + using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; internal class TransferFilesCommand diff --git a/src/WixToolset.Core/BindContext.cs b/src/WixToolset.Core/BindContext.cs index f423b731..12719f51 100644 --- a/src/WixToolset.Core/BindContext.cs +++ b/src/WixToolset.Core/BindContext.cs @@ -6,7 +6,7 @@ namespace WixToolset.Core using System.Collections.Generic; using WixToolset.Data; using WixToolset.Extensibility; - using WixToolset.Extensibility.Services; + using WixToolset.Extensibility.Data; public class BindContext : IBindContext { @@ -17,8 +17,6 @@ namespace WixToolset.Core public IServiceProvider ServiceProvider { get; } - public IMessaging Messaging { get; set; } - public IEnumerable BindPaths { get; set; } public int CabbingThreadCount { get; set; } diff --git a/src/WixToolset.Core/Binder.cs b/src/WixToolset.Core/Binder.cs index f112a214..23f1ba21 100644 --- a/src/WixToolset.Core/Binder.cs +++ b/src/WixToolset.Core/Binder.cs @@ -11,6 +11,7 @@ namespace WixToolset.Core using WixToolset.Data.Bind; using WixToolset.Data.Tuples; using WixToolset.Extensibility; + using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; /// @@ -56,7 +57,6 @@ namespace WixToolset.Core public BindResult Execute() { var context = this.ServiceProvider.GetService(); - context.Messaging = this.ServiceProvider.GetService(); context.CabbingThreadCount = this.CabbingThreadCount; context.CabCachePath = this.CabCachePath; context.Codepage = this.Codepage; @@ -72,7 +72,6 @@ namespace WixToolset.Core context.SuppressIces = this.SuppressIces; context.SuppressValidation = this.SuppressValidation; - // Prebind. // foreach (var extension in context.Extensions) diff --git a/src/WixToolset.Core/CommandLine/BuildCommand.cs b/src/WixToolset.Core/CommandLine/BuildCommand.cs index 7b605da1..d8327b7a 100644 --- a/src/WixToolset.Core/CommandLine/BuildCommand.cs +++ b/src/WixToolset.Core/CommandLine/BuildCommand.cs @@ -7,8 +7,7 @@ namespace WixToolset.Core.CommandLine using System.IO; using System.Linq; using WixToolset.Data; - using WixToolset.Data.Bind; - using WixToolset.Extensibility; + using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; internal class BuildCommand : ICommandLineCommand diff --git a/src/WixToolset.Core/CommandLine/CommandLineArguments.cs b/src/WixToolset.Core/CommandLine/CommandLineArguments.cs index 37adcfd3..2f8226df 100644 --- a/src/WixToolset.Core/CommandLine/CommandLineArguments.cs +++ b/src/WixToolset.Core/CommandLine/CommandLineArguments.cs @@ -7,6 +7,7 @@ namespace WixToolset.Core.CommandLine using System.IO; using System.Text; using System.Text.RegularExpressions; + using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; internal class CommandLineArguments : ICommandLineArguments diff --git a/src/WixToolset.Core/CommandLine/CommandLineContext.cs b/src/WixToolset.Core/CommandLine/CommandLineContext.cs index c589222d..ea0cf3d4 100644 --- a/src/WixToolset.Core/CommandLine/CommandLineContext.cs +++ b/src/WixToolset.Core/CommandLine/CommandLineContext.cs @@ -3,6 +3,7 @@ namespace WixToolset.Core.CommandLine { using System; + using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; internal class CommandLineContext : ICommandLineContext @@ -14,8 +15,6 @@ namespace WixToolset.Core.CommandLine public IServiceProvider ServiceProvider { get; } - public IMessaging Messaging { get; set; } - public IExtensionManager ExtensionManager { get; set; } public ICommandLineArguments Arguments { get; set; } diff --git a/src/WixToolset.Core/CommandLine/CommandLineParser.cs b/src/WixToolset.Core/CommandLine/CommandLineParser.cs index 65aea1fc..92944ab2 100644 --- a/src/WixToolset.Core/CommandLine/CommandLineParser.cs +++ b/src/WixToolset.Core/CommandLine/CommandLineParser.cs @@ -7,6 +7,7 @@ namespace WixToolset.Core.CommandLine using System.IO; using WixToolset.Data; using WixToolset.Extensibility; + using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; internal enum Commands @@ -19,27 +20,34 @@ namespace WixToolset.Core.CommandLine Bind, } - internal class CommandLineParser : ICommandLine + internal class CommandLineParser : ICommandLineParser { - private IServiceProvider ServiceProvider { get; set; } + public CommandLineParser(IServiceProvider serviceProvider) + { + this.ServiceProvider = serviceProvider; + + this.Messaging = this.ServiceProvider.GetService(); + } + + private IServiceProvider ServiceProvider { get; } private IMessaging Messaging { get; set; } + public IExtensionManager ExtensionManager { get; set; } + + public ICommandLineArguments Arguments { get; set; } + public static string ExpectedArgument { get; } = "expected argument"; public string ActiveCommand { get; private set; } - public IExtensionManager ExtensionManager { get; private set; } - - public bool ShowHelp { get; set; } + public bool ShowHelp { get; private set; } - public ICommandLineCommand ParseStandardCommandLine(ICommandLineContext context) + public ICommandLineCommand ParseStandardCommandLine() { - this.ServiceProvider = context.ServiceProvider; - - this.Messaging = context.Messaging ?? this.ServiceProvider.GetService(); - - this.ExtensionManager = context.ExtensionManager ?? this.ServiceProvider.GetService(); + var context = this.ServiceProvider.GetService(); + context.ExtensionManager = this.ExtensionManager ?? this.ServiceProvider.GetService(); + context.Arguments = this.Arguments; var next = String.Empty; @@ -277,7 +285,7 @@ namespace WixToolset.Core.CommandLine return OutputType.Unknown; } - private ICommandLine Parse(ICommandLineContext context, Func parseCommand, Func parseArgument) + private ICommandLineParser Parse(ICommandLineContext context, Func parseCommand, Func parseArgument) { var extensions = this.ExtensionManager.Create(); diff --git a/src/WixToolset.Core/CommandLine/CompileCommand.cs b/src/WixToolset.Core/CommandLine/CompileCommand.cs index 123318f5..6bd0f25a 100644 --- a/src/WixToolset.Core/CommandLine/CompileCommand.cs +++ b/src/WixToolset.Core/CommandLine/CompileCommand.cs @@ -5,8 +5,7 @@ namespace WixToolset.Core.CommandLine using System; using System.Collections.Generic; using WixToolset.Data; - using WixToolset.Extensibility; - using WixToolset.Extensibility.Services; + using WixToolset.Extensibility.Data; internal class CompileCommand : ICommandLineCommand { diff --git a/src/WixToolset.Core/CommandLine/HelpCommand.cs b/src/WixToolset.Core/CommandLine/HelpCommand.cs index 6e547d60..b1298e46 100644 --- a/src/WixToolset.Core/CommandLine/HelpCommand.cs +++ b/src/WixToolset.Core/CommandLine/HelpCommand.cs @@ -3,7 +3,7 @@ namespace WixToolset.Core.CommandLine { using System; - using WixToolset.Extensibility.Services; + using WixToolset.Extensibility.Data; internal class HelpCommand : ICommandLineCommand { diff --git a/src/WixToolset.Core/CommandLine/VersionCommand.cs b/src/WixToolset.Core/CommandLine/VersionCommand.cs index a04aac31..e67aafb8 100644 --- a/src/WixToolset.Core/CommandLine/VersionCommand.cs +++ b/src/WixToolset.Core/CommandLine/VersionCommand.cs @@ -3,7 +3,7 @@ namespace WixToolset.Core.CommandLine { using System; - using WixToolset.Extensibility.Services; + using WixToolset.Extensibility.Data; internal class VersionCommand : ICommandLineCommand { diff --git a/src/WixToolset.Core/CompileContext.cs b/src/WixToolset.Core/CompileContext.cs index fcca94d8..6f19961f 100644 --- a/src/WixToolset.Core/CompileContext.cs +++ b/src/WixToolset.Core/CompileContext.cs @@ -7,7 +7,7 @@ namespace WixToolset.Core using System.Xml.Linq; using WixToolset.Data; using WixToolset.Extensibility; - using WixToolset.Extensibility.Services; + using WixToolset.Extensibility.Data; public class CompileContext : ICompileContext { @@ -18,8 +18,6 @@ namespace WixToolset.Core public IServiceProvider ServiceProvider { get; } - public IMessaging Messaging { get; set; } - public string CompilationId { get; set; } public IEnumerable Extensions { get; set; } diff --git a/src/WixToolset.Core/Compiler.cs b/src/WixToolset.Core/Compiler.cs index cd51fed6..06f477c1 100644 --- a/src/WixToolset.Core/Compiler.cs +++ b/src/WixToolset.Core/Compiler.cs @@ -15,6 +15,7 @@ namespace WixToolset.Core using WixToolset.Data; using WixToolset.Data.Tuples; using WixToolset.Extensibility; + using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; using Wix = WixToolset.Data.Serialize; @@ -71,10 +72,14 @@ namespace WixToolset.Core public Compiler(IServiceProvider serviceProvider) { this.ServiceProvider = serviceProvider; + + this.Messaging = serviceProvider.GetService(); } private IServiceProvider ServiceProvider { get; } + public IMessaging Messaging { get; } + private ICompileContext Context { get; set; } private CompilerCore Core { get; set; } @@ -107,7 +112,6 @@ namespace WixToolset.Core public Intermediate Execute() { this.Context = this.ServiceProvider.GetService(); - this.Context.Messaging = this.ServiceProvider.GetService(); this.Context.Extensions = this.ServiceProvider.GetService().Create(); this.Context.CompilationId = this.CompliationId; this.Context.OutputPath = this.OutputPath; @@ -131,7 +135,7 @@ namespace WixToolset.Core } else { - this.Context.Messaging.Write(ErrorMessages.DuplicateExtensionXmlSchemaNamespace(extension.GetType().ToString(), extension.Namespace.NamespaceName, collidingExtension.GetType().ToString())); + this.Messaging.Write(ErrorMessages.DuplicateExtensionXmlSchemaNamespace(extension.GetType().ToString(), extension.Namespace.NamespaceName, collidingExtension.GetType().ToString())); } extension.PreCompile(this.Context); @@ -142,9 +146,9 @@ namespace WixToolset.Core { var parseHelper = this.Context.ServiceProvider.GetService(); - this.Core = new CompilerCore(target, this.Context.Messaging, parseHelper, extensionsByNamespace); + this.Core = new CompilerCore(target, this.Messaging, parseHelper, extensionsByNamespace); this.Core.ShowPedanticMessages = this.ShowPedanticMessages; - this.componentIdPlaceholdersResolver = new WixVariableResolver(this.Context.Messaging); + this.componentIdPlaceholdersResolver = new WixVariableResolver(this.Messaging); // parse the document var source = this.Context.Source; @@ -185,7 +189,7 @@ namespace WixToolset.Core this.Core = null; } - return this.Context.Messaging.EncounteredError ? null : target; + return this.Messaging.EncounteredError ? null : target; } private void ResolveComponentIdPlaceholders(Intermediate target) diff --git a/src/WixToolset.Core/CompilerCore.cs b/src/WixToolset.Core/CompilerCore.cs index 651c80a3..c9165b52 100644 --- a/src/WixToolset.Core/CompilerCore.cs +++ b/src/WixToolset.Core/CompilerCore.cs @@ -14,6 +14,7 @@ namespace WixToolset.Core using System.Xml.Linq; using WixToolset.Data; using WixToolset.Extensibility; + using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; using Wix = WixToolset.Data.Serialize; diff --git a/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs b/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs index b65abdfb..f62f8f10 100644 --- a/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs +++ b/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs @@ -12,10 +12,11 @@ namespace WixToolset.Core.ExtensibilityServices using System.Text.RegularExpressions; using System.Xml.Linq; using WixToolset.Data; - using Wix = WixToolset.Data.Serialize; using WixToolset.Data.Tuples; using WixToolset.Extensibility; + using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; + using Wix = WixToolset.Data.Serialize; internal class ParseHelper : IParseHelper { diff --git a/src/WixToolset.Core/ExtensibilityServices/PreprocessHelper.cs b/src/WixToolset.Core/ExtensibilityServices/PreprocessHelper.cs index 0331c815..0e4bba51 100644 --- a/src/WixToolset.Core/ExtensibilityServices/PreprocessHelper.cs +++ b/src/WixToolset.Core/ExtensibilityServices/PreprocessHelper.cs @@ -9,6 +9,7 @@ namespace WixToolset.Core.ExtensibilityServices using System.Xml.Linq; using WixToolset.Data; using WixToolset.Extensibility; + using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; internal class PreprocessHelper : IPreprocessHelper @@ -19,10 +20,14 @@ namespace WixToolset.Core.ExtensibilityServices public PreprocessHelper(IServiceProvider serviceProvider) { this.ServiceProvider = serviceProvider; + + this.Messaging = this.ServiceProvider.GetService(); } private IServiceProvider ServiceProvider { get; } + private IMessaging Messaging { get; } + private Dictionary ExtensionsByPrefix { get; set; } public void AddVariable(IPreprocessContext context, string name, string value) @@ -42,7 +47,7 @@ namespace WixToolset.Core.ExtensibilityServices { if (showWarning) { - context.Messaging.Write(WarningMessages.VariableDeclarationCollision(context.CurrentSourceLineNumber, name, value, currentValue)); + this.Messaging.Write(WarningMessages.VariableDeclarationCollision(context.CurrentSourceLineNumber, name, value, currentValue)); } context.Variables[name] = value; @@ -220,7 +225,7 @@ namespace WixToolset.Core.ExtensibilityServices return context.CurrentSourceLineNumber.FileName; case "PLATFORM": - context.Messaging.Write(WarningMessages.DeprecatedPreProcVariable(context.CurrentSourceLineNumber, "$(sys.PLATFORM)", "$(sys.BUILDARCH)")); + this.Messaging.Write(WarningMessages.DeprecatedPreProcVariable(context.CurrentSourceLineNumber, "$(sys.PLATFORM)", "$(sys.BUILDARCH)")); goto case "BUILDARCH"; @@ -295,7 +300,7 @@ namespace WixToolset.Core.ExtensibilityServices { // Add any core defined pragmas here default: - context.Messaging.Write(WarningMessages.PreprocessorUnknownPragma(context.CurrentSourceLineNumber, pragmaName)); + this.Messaging.Write(WarningMessages.PreprocessorUnknownPragma(context.CurrentSourceLineNumber, pragmaName)); break; } break; @@ -306,7 +311,7 @@ namespace WixToolset.Core.ExtensibilityServices { if (!extension.ProcessPragma(prefix, pragma, args, parent)) { - context.Messaging.Write(WarningMessages.PreprocessorUnknownPragma(context.CurrentSourceLineNumber, pragmaName)); + this.Messaging.Write(WarningMessages.PreprocessorUnknownPragma(context.CurrentSourceLineNumber, pragmaName)); } } break; @@ -339,7 +344,7 @@ namespace WixToolset.Core.ExtensibilityServices currentPosition = remainder.IndexOf(')'); if (-1 == currentPosition) { - context.Messaging.Write(ErrorMessages.InvalidPreprocessorVariable(context.CurrentSourceLineNumber, remainder)); + this.Messaging.Write(ErrorMessages.InvalidPreprocessorVariable(context.CurrentSourceLineNumber, remainder)); break; } @@ -385,12 +390,12 @@ namespace WixToolset.Core.ExtensibilityServices { if (isFunction) { - context.Messaging.Write(ErrorMessages.InvalidPreprocessorFunction(context.CurrentSourceLineNumber, remainder)); + this.Messaging.Write(ErrorMessages.InvalidPreprocessorFunction(context.CurrentSourceLineNumber, remainder)); break; } else { - context.Messaging.Write(ErrorMessages.InvalidPreprocessorVariable(context.CurrentSourceLineNumber, remainder)); + this.Messaging.Write(ErrorMessages.InvalidPreprocessorVariable(context.CurrentSourceLineNumber, remainder)); break; } } @@ -410,12 +415,12 @@ namespace WixToolset.Core.ExtensibilityServices { if (isFunction) { - context.Messaging.Write(ErrorMessages.UndefinedPreprocessorFunction(context.CurrentSourceLineNumber, subString)); + this.Messaging.Write(ErrorMessages.UndefinedPreprocessorFunction(context.CurrentSourceLineNumber, subString)); break; } else { - context.Messaging.Write(ErrorMessages.UndefinedPreprocessorVariable(context.CurrentSourceLineNumber, subString)); + this.Messaging.Write(ErrorMessages.UndefinedPreprocessorVariable(context.CurrentSourceLineNumber, subString)); break; } } @@ -448,7 +453,7 @@ namespace WixToolset.Core.ExtensibilityServices { if (!context.Variables.Remove(name)) { - context.Messaging.Write(ErrorMessages.CannotReundefineVariable(context.CurrentSourceLineNumber, name)); + this.Messaging.Write(ErrorMessages.CannotReundefineVariable(context.CurrentSourceLineNumber, name)); } } diff --git a/src/WixToolset.Core/IncribeContext.cs b/src/WixToolset.Core/IncribeContext.cs index 9e4e3602..9a002d68 100644 --- a/src/WixToolset.Core/IncribeContext.cs +++ b/src/WixToolset.Core/IncribeContext.cs @@ -3,7 +3,7 @@ namespace WixToolset.Core { using System; - using WixToolset.Extensibility; + using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; internal class InscribeContext : IInscribeContext @@ -15,8 +15,6 @@ namespace WixToolset.Core public IServiceProvider ServiceProvider { get; } - public IMessaging Messaging { get; set; } - public string IntermediateFolder { get; set; } public string InputFilePath { get; set; } diff --git a/src/WixToolset.Core/Layout.cs b/src/WixToolset.Core/Layout.cs index d62335fb..a44c212d 100644 --- a/src/WixToolset.Core/Layout.cs +++ b/src/WixToolset.Core/Layout.cs @@ -8,8 +8,8 @@ namespace WixToolset.Core using System.Linq; using WixToolset.Core.Bind; using WixToolset.Data; - using WixToolset.Data.Bind; using WixToolset.Extensibility; + using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; /// @@ -20,10 +20,14 @@ namespace WixToolset.Core public Layout(IServiceProvider serviceProvider) { this.ServiceProvider = serviceProvider; + + this.Messaging = serviceProvider.GetService(); } private IServiceProvider ServiceProvider { get; } + private IMessaging Messaging { get; } + public IEnumerable FileTransfers { get; set; } public IEnumerable ContentFilePaths { get; set; } @@ -36,21 +40,16 @@ namespace WixToolset.Core public bool SuppressAclReset { get; set; } - private IMessaging Messaging { get; set; } - public void Execute() { - this.Messaging = this.ServiceProvider.GetService(); - var extensionManager = this.ServiceProvider.GetService(); var context = this.ServiceProvider.GetService(); - context.Messaging = this.Messaging; context.Extensions = extensionManager.Create(); context.FileTransfers = this.FileTransfers; context.ContentFilePaths = this.ContentFilePaths; context.ContentsFile = this.ContentsFile; - context.OutputPdbPath = this.OutputsFile; + context.OutputsFile = this.OutputsFile; context.BuiltOutputsFile = this.BuiltOutputsFile; context.SuppressAclReset = this.SuppressAclReset; @@ -69,7 +68,7 @@ namespace WixToolset.Core { this.Messaging.Write(VerboseMessages.LayingOutMedia()); - var command = new TransferFilesCommand(context.Messaging, context.Extensions, context.FileTransfers, context.SuppressAclReset); + var command = new TransferFilesCommand(this.Messaging, context.Extensions, context.FileTransfers, context.SuppressAclReset); command.Execute(); } } diff --git a/src/WixToolset.Core/LayoutContext.cs b/src/WixToolset.Core/LayoutContext.cs index 24f171a9..af0df518 100644 --- a/src/WixToolset.Core/LayoutContext.cs +++ b/src/WixToolset.Core/LayoutContext.cs @@ -4,9 +4,8 @@ namespace WixToolset.Core { using System; using System.Collections.Generic; - using WixToolset.Data.Bind; using WixToolset.Extensibility; - using WixToolset.Extensibility.Services; + using WixToolset.Extensibility.Data; public class LayoutContext : ILayoutContext { @@ -17,8 +16,6 @@ namespace WixToolset.Core public IServiceProvider ServiceProvider { get; } - public IMessaging Messaging { get; set; } - public IEnumerable Extensions { get; set; } public IEnumerable FileSystemExtensions { get; set; } diff --git a/src/WixToolset.Core/Librarian.cs b/src/WixToolset.Core/Librarian.cs index c42356ac..15efcfcc 100644 --- a/src/WixToolset.Core/Librarian.cs +++ b/src/WixToolset.Core/Librarian.cs @@ -9,6 +9,7 @@ namespace WixToolset.Core using WixToolset.Core.Link; using WixToolset.Data; using WixToolset.Extensibility; + using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; /// @@ -19,10 +20,14 @@ namespace WixToolset.Core public Librarian(IServiceProvider serviceProvider) { this.ServiceProvider = serviceProvider; + + this.Messaging = this.ServiceProvider.GetService(); } private IServiceProvider ServiceProvider { get; } + private IMessaging Messaging { get; } + private ILibraryContext Context { get; set; } public bool BindFiles { get; set; } @@ -41,7 +46,6 @@ namespace WixToolset.Core public Intermediate Execute() { this.Context = new LibraryContext(this.ServiceProvider); - this.Context.Messaging = this.ServiceProvider.GetService(); this.Context.BindFiles = this.BindFiles; this.Context.BindPaths = this.BindPaths; this.Context.Extensions = this.ServiceProvider.GetService().Create(); @@ -59,10 +63,10 @@ namespace WixToolset.Core { var sections = this.Context.Intermediates.SelectMany(i => i.Sections).ToList(); - var collate = new CollateLocalizationsCommand(this.Context.Messaging, this.Context.Localizations); + var collate = new CollateLocalizationsCommand(this.Messaging, this.Context.Localizations); var localizationsByCulture = collate.Execute(); - if (this.Context.Messaging.EncounteredError) + if (this.Messaging.EncounteredError) { return null; } @@ -86,7 +90,7 @@ namespace WixToolset.Core } } - return this.Context.Messaging.EncounteredError ? null : library; + return this.Messaging.EncounteredError ? null : library; } /// @@ -95,7 +99,7 @@ namespace WixToolset.Core /// Library to validate. private void Validate(Intermediate library) { - FindEntrySectionAndLoadSymbolsCommand find = new FindEntrySectionAndLoadSymbolsCommand(this.Context.Messaging, library.Sections); + FindEntrySectionAndLoadSymbolsCommand find = new FindEntrySectionAndLoadSymbolsCommand(this.Messaging, library.Sections); find.Execute(); // TODO: Consider bringing this sort of verification back. @@ -116,7 +120,7 @@ namespace WixToolset.Core // Resolve paths to files that are to be embedded in the library. if (this.Context.BindFiles) { - var variableResolver = new WixVariableResolver(this.Context.Messaging); + var variableResolver = new WixVariableResolver(this.Messaging); var fileResolver = new FileResolver(this.Context.BindPaths, this.Context.Extensions); @@ -141,7 +145,7 @@ namespace WixToolset.Core } else { - this.Context.Messaging.Write(ErrorMessages.FileNotFound(tuple.SourceLineNumbers, pathField.Path, tuple.Definition.Name)); + this.Messaging.Write(ErrorMessages.FileNotFound(tuple.SourceLineNumbers, pathField.Path, tuple.Definition.Name)); } } } diff --git a/src/WixToolset.Core/LibraryContext.cs b/src/WixToolset.Core/LibraryContext.cs index 56a9389f..0b09aa93 100644 --- a/src/WixToolset.Core/LibraryContext.cs +++ b/src/WixToolset.Core/LibraryContext.cs @@ -6,6 +6,7 @@ namespace WixToolset.Core using System.Collections.Generic; using WixToolset.Data; using WixToolset.Extensibility; + using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; public class LibraryContext : ILibraryContext diff --git a/src/WixToolset.Core/LinkContext.cs b/src/WixToolset.Core/LinkContext.cs index b4474ec5..7576ca3f 100644 --- a/src/WixToolset.Core/LinkContext.cs +++ b/src/WixToolset.Core/LinkContext.cs @@ -6,7 +6,7 @@ namespace WixToolset.Core using System.Collections.Generic; using WixToolset.Data; using WixToolset.Extensibility; - using WixToolset.Extensibility.Services; + using WixToolset.Extensibility.Data; public class LinkContext : ILinkContext { @@ -17,8 +17,6 @@ namespace WixToolset.Core public IServiceProvider ServiceProvider { get; } - public IMessaging Messaging { get; set; } - public IEnumerable Extensions { get; set; } public IEnumerable ExtensionData { get; set; } diff --git a/src/WixToolset.Core/Linker.cs b/src/WixToolset.Core/Linker.cs index db2514fb..4d1a6965 100644 --- a/src/WixToolset.Core/Linker.cs +++ b/src/WixToolset.Core/Linker.cs @@ -12,6 +12,7 @@ namespace WixToolset.Core using WixToolset.Data; using WixToolset.Data.Tuples; using WixToolset.Extensibility; + using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; using WixToolset.Link; @@ -31,11 +32,14 @@ namespace WixToolset.Core public Linker(IServiceProvider serviceProvider) { this.ServiceProvider = serviceProvider; + this.Messaging = this.ServiceProvider.GetService(); this.sectionIdOnRows = true; // TODO: what is the correct value for this? } private IServiceProvider ServiceProvider { get; } + private IMessaging Messaging { get; } + private ILinkContext Context { get; set; } /// @@ -71,7 +75,6 @@ namespace WixToolset.Core var creator = this.TupleDefinitionCreator ?? this.ServiceProvider.GetService(); this.Context = this.ServiceProvider.GetService(); - this.Context.Messaging = this.ServiceProvider.GetService(); this.Context.Extensions = extensionManager.Create(); this.Context.ExtensionData = extensionManager.Create(); this.Context.ExpectedOutputType = this.OutputType; @@ -151,7 +154,7 @@ namespace WixToolset.Core // First find the entry section and while processing all sections load all the symbols from all of the sections. // sections.FindEntrySectionAndLoadSymbols(false, this, expectedOutputType, out entrySection, out allSymbols); - var find = new FindEntrySectionAndLoadSymbolsCommand(this.Context.Messaging, sections); + var find = new FindEntrySectionAndLoadSymbolsCommand(this.Messaging, sections); find.ExpectedOutputType = this.Context.ExpectedOutputType; find.Execute(); @@ -166,12 +169,12 @@ namespace WixToolset.Core // Resolve the symbol references to find the set of sections we care about for linking. // Of course, we start with the entry section (that's how it got its name after all). - var resolve = new ResolveReferencesCommand(this.Context.Messaging, find.EntrySection, find.Symbols); + var resolve = new ResolveReferencesCommand(this.Messaging, find.EntrySection, find.Symbols); resolve.BuildingMergeModule = (SectionType.Module == find.EntrySection.Type); resolve.Execute(); - if (this.Context.Messaging.EncounteredError) + if (this.Messaging.EncounteredError) { return null; } @@ -185,7 +188,7 @@ namespace WixToolset.Core this.FlattenSectionsComplexReferences(sections); - if (this.Context.Messaging.EncounteredError) + if (this.Messaging.EncounteredError) { return null; } @@ -197,7 +200,7 @@ namespace WixToolset.Core var modulesToFeatures = new ConnectToFeatureCollection(); this.ProcessComplexReferences(find.EntrySection, sections, referencedComponents, componentsToFeatures, featuresToFeatures, modulesToFeatures); - if (this.Context.Messaging.EncounteredError) + if (this.Messaging.EncounteredError) { return null; } @@ -212,10 +215,10 @@ namespace WixToolset.Core } // Report duplicates that would ultimately end up being primary key collisions. - var reportDupes = new ReportConflictingSymbolsCommand(this.Context.Messaging, find.PossiblyConflictingSymbols, resolve.ResolvedSections); + var reportDupes = new ReportConflictingSymbolsCommand(this.Messaging, find.PossiblyConflictingSymbols, resolve.ResolvedSections); reportDupes.Execute(); - if (this.Context.Messaging.EncounteredError) + if (this.Messaging.EncounteredError) { return null; } @@ -716,12 +719,12 @@ namespace WixToolset.Core // Bundles have groups of data that must be flattened in a way different from other types. this.FlattenBundleTables(resolvedSection); - if (this.Context.Messaging.EncounteredError) + if (this.Messaging.EncounteredError) { return null; } - var collate = new CollateLocalizationsCommand(this.Context.Messaging, localizations); + var collate = new CollateLocalizationsCommand(this.Messaging, localizations); var localizationsByCulture = collate.Execute(); intermediate = new Intermediate(resolvedSection.Id, new[] { resolvedSection }, localizationsByCulture, null); @@ -738,7 +741,7 @@ namespace WixToolset.Core } } - return this.Context.Messaging.EncounteredError ? null : intermediate; + return this.Messaging.EncounteredError ? null : intermediate; } #if SOLVE_CUSTOM_TABLE @@ -1118,7 +1121,7 @@ namespace WixToolset.Core /// Message event arguments. public void OnMessage(Message message) { - this.Context.Messaging.Write(message); + this.Messaging.Write(message); } /// @@ -1616,7 +1619,7 @@ namespace WixToolset.Core // will hold Payloads under UX, ChainPackages (references?) under Chain, // and ChainPackages/Payloads under the attached and any detatched // Containers. - var groups = new WixGroupingOrdering(entrySection, this.Context.Messaging); + var groups = new WixGroupingOrdering(entrySection, this.Messaging); // Create UX payloads and Package payloads groups.UseTypes(new string[] { "Container", "Layout", "PackageGroup", "PayloadGroup", "Package" }, new string[] { "PackageGroup", "Package", "PayloadGroup", "Payload" }); diff --git a/src/WixToolset.Core/PreprocessContext.cs b/src/WixToolset.Core/PreprocessContext.cs index a6085b81..151506e2 100644 --- a/src/WixToolset.Core/PreprocessContext.cs +++ b/src/WixToolset.Core/PreprocessContext.cs @@ -6,7 +6,7 @@ namespace WixToolset.Core using System.Collections.Generic; using WixToolset.Data; using WixToolset.Extensibility; - using WixToolset.Extensibility.Services; + using WixToolset.Extensibility.Data; internal class PreprocessContext : IPreprocessContext { @@ -17,8 +17,6 @@ namespace WixToolset.Core public IServiceProvider ServiceProvider { get; } - public IMessaging Messaging { get; set; } - public IEnumerable Extensions { get; set; } public Platform Platform { get; set; } diff --git a/src/WixToolset.Core/Preprocessor.cs b/src/WixToolset.Core/Preprocessor.cs index 23d3f205..ac8cefe3 100644 --- a/src/WixToolset.Core/Preprocessor.cs +++ b/src/WixToolset.Core/Preprocessor.cs @@ -6,15 +6,16 @@ namespace WixToolset.Core using System.Collections.Generic; using System.Globalization; using System.IO; + using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Xml; using System.Xml.Linq; + using WixToolset.Core.Preprocess; using WixToolset.Data; using WixToolset.Extensibility; - using WixToolset.Core.Preprocess; + using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; - using System.Linq; /// /// Preprocessor object @@ -39,6 +40,8 @@ namespace WixToolset.Core public Preprocessor(IServiceProvider serviceProvider) { this.ServiceProvider = serviceProvider; + + this.Messaging = this.ServiceProvider.GetService(); } public IEnumerable IncludeSearchPaths { get; set; } @@ -51,6 +54,8 @@ namespace WixToolset.Core private IServiceProvider ServiceProvider { get; } + private IMessaging Messaging { get; } + private IPreprocessContext Context { get; set; } private Stack CurrentFileStack { get; } = new Stack(); @@ -169,7 +174,7 @@ namespace WixToolset.Core throw new WixException(ErrorMessages.InvalidXml(this.Context.CurrentSourceLineNumber, "source", e.Message)); } - return this.Context.Messaging.EncounteredError ? null : output; + return this.Messaging.EncounteredError ? null : output; } /// @@ -482,7 +487,7 @@ namespace WixToolset.Core { if ("Include" != reader.LocalName) { - this.Context.Messaging.Write(ErrorMessages.InvalidDocumentElement(sourceLineNumbers, reader.Name, "include", "Include")); + this.Messaging.Write(ErrorMessages.InvalidDocumentElement(sourceLineNumbers, reader.Name, "include", "Include")); } this.IncludeNextStack.Pop(); @@ -570,7 +575,7 @@ namespace WixToolset.Core // Resolve other variables in the warning message. warningMessage = this.Helper.PreprocessString(this.Context, warningMessage); - this.Context.Messaging.Write(WarningMessages.PreprocessorWarning(this.Context.CurrentSourceLineNumber, warningMessage)); + this.Messaging.Write(WarningMessages.PreprocessorWarning(this.Context.CurrentSourceLineNumber, warningMessage)); } /// @@ -1431,7 +1436,6 @@ namespace WixToolset.Core private IPreprocessContext CreateContext() { var context = this.ServiceProvider.GetService(); - context.Messaging = this.ServiceProvider.GetService(); context.Extensions = this.ServiceProvider.GetService().Create(); context.CurrentSourceLineNumber = new SourceLineNumber(this.SourcePath); context.Platform = this.Platform; @@ -1456,7 +1460,7 @@ namespace WixToolset.Core } else { - this.Context.Messaging.Write(ErrorMessages.DuplicateExtensionPreprocessorType(extension.GetType().ToString(), prefix, collidingExtension.GetType().ToString())); + this.Messaging.Write(ErrorMessages.DuplicateExtensionPreprocessorType(extension.GetType().ToString(), prefix, collidingExtension.GetType().ToString())); } } } diff --git a/src/WixToolset.Core/ResolveContext.cs b/src/WixToolset.Core/ResolveContext.cs index d49a7d4b..65b991ea 100644 --- a/src/WixToolset.Core/ResolveContext.cs +++ b/src/WixToolset.Core/ResolveContext.cs @@ -6,6 +6,7 @@ namespace WixToolset.Core using System.Collections.Generic; using WixToolset.Data; using WixToolset.Extensibility; + using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; public class ResolveContext : IResolveContext @@ -17,8 +18,6 @@ namespace WixToolset.Core public IServiceProvider ServiceProvider { get; } - public IMessaging Messaging { get; set; } - public IEnumerable BindPaths { get; set; } public IEnumerable Extensions { get; set; } diff --git a/src/WixToolset.Core/Resolver.cs b/src/WixToolset.Core/Resolver.cs index 503d4bb7..5e283f2c 100644 --- a/src/WixToolset.Core/Resolver.cs +++ b/src/WixToolset.Core/Resolver.cs @@ -9,6 +9,7 @@ namespace WixToolset.Core using WixToolset.Data; using WixToolset.Data.Tuples; using WixToolset.Extensibility; + using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; /// @@ -19,9 +20,13 @@ namespace WixToolset.Core public Resolver(IServiceProvider serviceProvider) { this.ServiceProvider = serviceProvider; + + this.Messaging = serviceProvider.GetService(); } - private IServiceProvider ServiceProvider { get; set; } + private IServiceProvider ServiceProvider { get; } + + public IMessaging Messaging { get; } public IEnumerable BindPaths { get; set; } @@ -38,7 +43,6 @@ namespace WixToolset.Core var extensionManager = this.ServiceProvider.GetService(); var context = this.ServiceProvider.GetService(); - context.Messaging = this.ServiceProvider.GetService(); context.BindPaths = this.BindPaths; context.Extensions = extensionManager.Create(); context.ExtensionData = extensionManager.Create(); @@ -46,7 +50,7 @@ namespace WixToolset.Core context.IntermediateFolder = this.IntermediateFolder; context.IntermediateRepresentation = this.IntermediateRepresentation; context.Localizations = this.Localizations; - context.VariableResolver = new WixVariableResolver(context.Messaging); + context.VariableResolver = new WixVariableResolver(this.Messaging); foreach (IResolverExtension extension in context.Extensions) { @@ -82,7 +86,7 @@ namespace WixToolset.Core IEnumerable delayedFields; { var command = new ResolveFieldsCommand(); - command.Messaging = context.Messaging; + command.Messaging = this.Messaging; command.BuildingPatch = buildingPatch; command.VariableResolver = context.VariableResolver; command.BindPaths = context.BindPaths; diff --git a/src/WixToolset.Core/WixToolsetServiceProvider.cs b/src/WixToolset.Core/WixToolsetServiceProvider.cs index 7d318648..dd6da8c8 100644 --- a/src/WixToolset.Core/WixToolsetServiceProvider.cs +++ b/src/WixToolset.Core/WixToolsetServiceProvider.cs @@ -7,7 +7,7 @@ namespace WixToolset.Core using WixToolset.Core.CommandLine; using WixToolset.Core.ExtensibilityServices; using WixToolset.Data; - using WixToolset.Extensibility; + using WixToolset.Extensibility.Data; using WixToolset.Extensibility.Services; public class WixToolsetServiceProvider : IServiceProvider @@ -27,7 +27,7 @@ namespace WixToolset.Core // Transients. { typeof(ICommandLineArguments), (provider, singletons) => new CommandLineArguments(provider) }, { typeof(ICommandLineContext), (provider, singletons) => new CommandLineContext(provider) }, - { typeof(ICommandLine), (provider, singletons) => new CommandLineParser() }, + { typeof(ICommandLineParser), (provider, singletons) => new CommandLineParser(provider) }, { typeof(IPreprocessContext), (provider, singletons) => new PreprocessContext(provider) }, { typeof(ICompileContext), (provider, singletons) => new CompileContext(provider) }, { typeof(ILinkContext), (provider, singletons) => new LinkContext(provider) }, -- cgit v1.2.3-55-g6feb