@joebigelow / wix-1 / commits / 5a1afc90

Integrate Extensibility.Data namespace change from Extensibility repo

Rob Mensching committed Jul 23, 2018 at 14:21 UTC 5a1afc9030a1fcc101b6bb52b576fbbfa3ad33c2
55 files changed +178 -150
src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs
+1
@@ -14,6 +14,7 @@ namespace WixToolset.Core.Burn
14 using WixToolset.Data;
15 using WixToolset.Data.Bind;
16 using WixToolset.Extensibility;
17 + using WixToolset.Extensibility.Data;
18 using WixToolset.Extensibility.Services;
19
20 // TODO: (4.0) Refactor so that these don't need to be copied.
src/WixToolset.Core.Burn/BundleBackend.cs
+1 -1
@@ -7,8 +7,8 @@ namespace WixToolset.Core.Burn
7 using WixToolset.Core.Burn.Bundles;
8 using WixToolset.Core.Burn.Inscribe;
9 using WixToolset.Data;
10 - using WixToolset.Data.Bind;
10 using WixToolset.Extensibility;
11 + using WixToolset.Extensibility.Data;
12
13 internal class BundleBackend : IBackend
14 {
src/WixToolset.Core.Burn/BurnBackendFactory.cs
+2 -2
@@ -5,11 +5,11 @@ namespace WixToolset.Core.Burn
5 using System;
6 using System.IO;
7 using WixToolset.Extensibility;
8 - using WixToolset.Extensibility.Services;
8 + using WixToolset.Extensibility.Data;
9
10 internal class BurnBackendFactory : IBackendFactory
11 {
12 - public bool TryCreateBackend(string outputType, string outputFile, WixToolset.Extensibility.IBindContext context, out IBackend backend)
12 + public bool TryCreateBackend(string outputType, string outputFile, IBindContext context, out IBackend backend)
13 {
14 if (String.IsNullOrEmpty(outputType))
15 {
src/WixToolset.Core.Burn/Inscribe/InscribeBundleCommand.cs
+8 -2
@@ -5,16 +5,22 @@ namespace WixToolset.Core.Burn.Inscribe
5 using System.IO;
6 using WixToolset.Core.Burn.Bundles;
7 using WixToolset.Extensibility;
8 + using WixToolset.Extensibility.Data;
9 + using WixToolset.Extensibility.Services;
10
11 internal class InscribeBundleCommand
12 {
13 public InscribeBundleCommand(IInscribeContext context)
14 {
15 this.Context = context;
14 - }
16
17 + this.Messaging = context.ServiceProvider.GetService<IMessaging>();
18 + }
19 +
20 private IInscribeContext Context { get; }
21
22 + public IMessaging Messaging { get; }
23 +
24 public bool Execute()
25 {
26 bool inscribed = false;
@@ -29,7 +35,7 @@ namespace WixToolset.Core.Burn.Inscribe
35 {
36 reader.Stream.Seek(reader.AttachedContainerAddress, SeekOrigin.Begin);
37
32 - using (BurnWriter writer = BurnWriter.Open(this.Context.Messaging, tempFile))
38 + using (BurnWriter writer = BurnWriter.Open(this.Messaging, tempFile))
39 {
40 writer.RememberThenResetSignature();
41 writer.AppendContainer(reader.Stream, reader.AttachedContainerSize, BurnCommon.Container.Attached);
src/WixToolset.Core.Burn/Inscribe/InscribeBundleEngineCommand.cs
+1 -1
@@ -5,7 +5,7 @@ namespace WixToolset.Core.Burn.Inscribe
5 using System;
6 using System.IO;
7 using WixToolset.Core.Burn.Bundles;
8 - using WixToolset.Extensibility;
8 + using WixToolset.Extensibility.Data;
9
10 internal class InscribeBundleEngineCommand
11 {
src/WixToolset.Core.TestPackage/WixRunner.cs
+5 -7
@@ -6,6 +6,7 @@ namespace WixToolset.Core.TestPackage
6 using System.Collections.Generic;
7 using WixToolset.Data;
8 using WixToolset.Extensibility;
9 + using WixToolset.Extensibility.Data;
10 using WixToolset.Extensibility.Services;
11
12 public static class WixRunner
@@ -24,13 +25,10 @@ namespace WixToolset.Core.TestPackage
25 var arguments = serviceProvider.GetService<ICommandLineArguments>();
26 arguments.Populate(args);
27
27 - var context = serviceProvider.GetService<ICommandLineContext>();
28 - context.Messaging = messaging;
29 - context.ExtensionManager = CreateExtensionManagerWithStandardBackends(serviceProvider, arguments.Extensions);
30 - context.Arguments = arguments;
31 -
32 - var commandLine = serviceProvider.GetService<ICommandLine>();
33 - var command = commandLine.ParseStandardCommandLine(context);
28 + var commandLine = serviceProvider.GetService<ICommandLineParser>();
29 + commandLine.ExtensionManager = CreateExtensionManagerWithStandardBackends(serviceProvider, arguments.Extensions);
30 + commandLine.Arguments = arguments;
31 + var command = commandLine.ParseStandardCommandLine();
32 return command?.Execute() ?? 1;
33 }
34
src/WixToolset.Core.TestPackage/WixToolset.Core.TestPackage.csproj
+1 -1
@@ -3,7 +3,7 @@
3
4 <Project Sdk="Microsoft.NET.Sdk">
5 <PropertyGroup>
6 - <TargetFramework>netcoreapp2.1</TargetFramework>
6 + <TargetFramework>netstandard2.0</TargetFramework>
7 <Description>Internal WiX Toolset Test Package</Description>
8 <DebugType>embedded</DebugType>
9 <PublishRepositoryUrl>true</PublishRepositoryUrl>
src/WixToolset.Core.WindowsInstaller/Bind/BindDatabaseCommand.cs
+3 -3
@@ -8,10 +8,10 @@ namespace WixToolset.Core.WindowsInstaller.Bind
8 using System.Linq;
9 using WixToolset.Core.Bind;
10 using WixToolset.Data;
11 - using WixToolset.Data.Bind;
11 using WixToolset.Data.Tuples;
12 using WixToolset.Data.WindowsInstaller;
13 using WixToolset.Extensibility;
14 + using WixToolset.Extensibility.Data;
15 using WixToolset.Extensibility.Services;
16
17 /// <summary>
@@ -24,6 +24,8 @@ namespace WixToolset.Core.WindowsInstaller.Bind
24
25 public BindDatabaseCommand(IBindContext context, IEnumerable<IWindowsInstallerBackendExtension> backendExtension, Validator validator)
26 {
27 + this.Messaging = context.ServiceProvider.GetService<IMessaging>();
28 +
29 this.TableDefinitions = WindowsInstallerStandardInternal.GetTableDefinitions();
30
31 this.CabbingThreadCount = context.CabbingThreadCount;
@@ -34,7 +36,6 @@ namespace WixToolset.Core.WindowsInstaller.Bind
36 this.ExpectedEmbeddedFiles = context.ExpectedEmbeddedFiles;
37 this.FileSystemExtensions = context.FileSystemExtensions;
38 this.Intermediate = context.IntermediateRepresentation;
37 - this.Messaging = context.Messaging;
39 this.OutputPath = context.OutputPath;
40 this.IntermediateFolder = context.IntermediateFolder;
41 this.Validator = validator;
@@ -76,7 +77,6 @@ namespace WixToolset.Core.WindowsInstaller.Bind
77
78 private Validator Validator { get; }
79
79 -
80 public IEnumerable<FileTransfer> FileTransfers { get; private set; }
81
82 public IEnumerable<string> ContentFilePaths { get; private set; }
src/WixToolset.Core.WindowsInstaller/Bind/CabinetResolver.cs
+1
@@ -10,6 +10,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
10 using WixToolset.Core.Native;
11 using WixToolset.Data;
12 using WixToolset.Extensibility;
13 + using WixToolset.Extensibility.Data;
14
15 public class CabinetResolver
16 {
src/WixToolset.Core.WindowsInstaller/Bind/CreateCabinetsCommand.cs
+1 -1
@@ -11,11 +11,11 @@ namespace WixToolset.Core.WindowsInstaller.Bind
11 using System.Threading;
12 using WixToolset.Core.Bind;
13 using WixToolset.Data;
14 - using WixToolset.Data.Bind;
14 using WixToolset.Data.Tuples;
15 using WixToolset.Data.WindowsInstaller;
16 using WixToolset.Data.WindowsInstaller.Rows;
17 using WixToolset.Extensibility;
18 + using WixToolset.Extensibility.Data;
19 using WixToolset.Extensibility.Services;
20
21 /// <summary>
src/WixToolset.Core.WindowsInstaller/Bind/ProcessUncompressedFilesCommand.cs
+1 -1
@@ -9,8 +9,8 @@ namespace WixToolset.Core.WindowsInstaller.Bind
9 using WixToolset.Core.Bind;
10 using WixToolset.Core.Native;
11 using WixToolset.Data;
12 - using WixToolset.Data.Bind;
12 using WixToolset.Data.Tuples;
13 + using WixToolset.Extensibility.Data;
14 using WixToolset.Msi;
15
16 /// <summary>
src/WixToolset.Core.WindowsInstaller/Inscribe/InscribeMsiPackageCommand.cs
+12 -8
@@ -12,7 +12,8 @@ namespace WixToolset.Core.WindowsInstaller.Inscribe
12 using WixToolset.Core.WindowsInstaller.Bind;
13 using WixToolset.Data;
14 using WixToolset.Data.WindowsInstaller;
15 - using WixToolset.Extensibility;
15 + using WixToolset.Extensibility.Data;
16 + using WixToolset.Extensibility.Services;
17 using WixToolset.Msi;
18
19 internal class InscribeMsiPackageCommand
@@ -20,11 +21,14 @@ namespace WixToolset.Core.WindowsInstaller.Inscribe
21 public InscribeMsiPackageCommand(IInscribeContext context)
22 {
23 this.Context = context;
24 + this.Messaging = context.ServiceProvider.GetService<IMessaging>();
25 this.TableDefinitions = WindowsInstallerStandardInternal.GetTableDefinitions();
26 }
27
28 private IInscribeContext Context { get; }
29
30 + private IMessaging Messaging { get; }
31 +
32 private TableDefinitionCollection TableDefinitions { get; }
33
34 public bool Execute()
@@ -36,7 +40,7 @@ namespace WixToolset.Core.WindowsInstaller.Inscribe
40 FileAttributes attributes = File.GetAttributes(this.Context.InputFilePath);
41 if (FileAttributes.ReadOnly == (attributes & FileAttributes.ReadOnly))
42 {
39 - this.Context.Messaging.Write(ErrorMessages.ReadOnlyOutputFile(this.Context.InputFilePath));
43 + this.Messaging.Write(ErrorMessages.ReadOnlyOutputFile(this.Context.InputFilePath));
44 return shouldCommit;
45 }
46
@@ -179,7 +183,7 @@ namespace WixToolset.Core.WindowsInstaller.Inscribe
183 // If the cabs aren't there, throw an error but continue to catch the other errors
184 if (!File.Exists(cabPath))
185 {
182 - this.Context.Messaging.Write(ErrorMessages.WixFileNotFound(cabPath));
186 + this.Messaging.Write(ErrorMessages.WixFileNotFound(cabPath));
187 continue;
188 }
189
@@ -205,11 +209,11 @@ namespace WixToolset.Core.WindowsInstaller.Inscribe
209 if ((5 == Environment.OSVersion.Version.Major && 2 == Environment.OSVersion.Version.Minor) || // W2K3
210 (5 == Environment.OSVersion.Version.Major && 1 == Environment.OSVersion.Version.Minor)) // XP
211 {
208 - this.Context.Messaging.Write(ErrorMessages.UnableToGetAuthenticodeCertOfFileDownlevelOS(cabPath, String.Format(CultureInfo.InvariantCulture, "HRESULT: 0x{0:x8}", HResult)));
212 + this.Messaging.Write(ErrorMessages.UnableToGetAuthenticodeCertOfFileDownlevelOS(cabPath, String.Format(CultureInfo.InvariantCulture, "HRESULT: 0x{0:x8}", HResult)));
213 }
214 else // otherwise, generic error
215 {
212 - this.Context.Messaging.Write(ErrorMessages.UnableToGetAuthenticodeCertOfFile(cabPath, String.Format(CultureInfo.InvariantCulture, "HRESULT: 0x{0:x8}", HResult)));
216 + this.Messaging.Write(ErrorMessages.UnableToGetAuthenticodeCertOfFile(cabPath, String.Format(CultureInfo.InvariantCulture, "HRESULT: 0x{0:x8}", HResult)));
217 }
218 }
219
@@ -252,7 +256,7 @@ namespace WixToolset.Core.WindowsInstaller.Inscribe
256
257 if (digitalCertificateTable.Rows.Count > 0)
258 {
255 - var command = new CreateIdtFileCommand(this.Context.Messaging, digitalCertificateTable, codepage, this.Context.IntermediateFolder, true);
259 + var command = new CreateIdtFileCommand(this.Messaging, digitalCertificateTable, codepage, this.Context.IntermediateFolder, true);
260 command.Execute();
261
262 database.Import(command.IdtPath);
@@ -261,7 +265,7 @@ namespace WixToolset.Core.WindowsInstaller.Inscribe
265
266 if (digitalSignatureTable.Rows.Count > 0)
267 {
264 - var command = new CreateIdtFileCommand(this.Context.Messaging, digitalSignatureTable, codepage, this.Context.IntermediateFolder, true);
268 + var command = new CreateIdtFileCommand(this.Messaging, digitalSignatureTable, codepage, this.Context.IntermediateFolder, true);
269 command.Execute();
270
271 database.Import(command.IdtPath);
@@ -275,7 +279,7 @@ namespace WixToolset.Core.WindowsInstaller.Inscribe
279 // If we did find external cabs but none of them were signed, give a warning
280 if (foundUnsignedExternals)
281 {
278 - this.Context.Messaging.Write(WarningMessages.ExternalCabsAreNotSigned(this.Context.InputFilePath));
282 + this.Messaging.Write(WarningMessages.ExternalCabsAreNotSigned(this.Context.InputFilePath));
283 }
284
285 if (shouldCommit)
src/WixToolset.Core.WindowsInstaller/MsiBackend.cs
+1 -1
@@ -7,8 +7,8 @@ namespace WixToolset.Core.WindowsInstaller
7 using WixToolset.Core.WindowsInstaller.Inscribe;
8 using WixToolset.Core.WindowsInstaller.Unbind;
9 using WixToolset.Data;
10 - using WixToolset.Data.Bind;
10 using WixToolset.Extensibility;
11 + using WixToolset.Extensibility.Data;
12 using WixToolset.Extensibility.Services;
13
14 internal class MsiBackend : IBackend
src/WixToolset.Core.WindowsInstaller/MsmBackend.cs
+2 -2
@@ -6,13 +6,13 @@ namespace WixToolset.Core.WindowsInstaller
6 using WixToolset.Core.WindowsInstaller.Bind;
7 using WixToolset.Core.WindowsInstaller.Unbind;
8 using WixToolset.Data;
9 - using WixToolset.Data.Bind;
9 using WixToolset.Extensibility;
10 + using WixToolset.Extensibility.Data;
11 using WixToolset.Extensibility.Services;
12
13 internal class MsmBackend : IBackend
14 {
15 - public BindResult Bind(WixToolset.Extensibility.IBindContext context)
15 + public BindResult Bind(IBindContext context)
16 {
17 var extensionManager = context.ServiceProvider.GetService<IExtensionManager>();
18
src/WixToolset.Core.WindowsInstaller/MspBackend.cs
+2 -2
@@ -10,13 +10,13 @@ namespace WixToolset.Core.WindowsInstaller
10 using WixToolset.Data;
11 using WixToolset.Data.Bind;
12 using WixToolset.Extensibility;
13 - using WixToolset.Extensibility.Services;
13 + using WixToolset.Extensibility.Data;
14 using WixToolset.Msi;
15 using WixToolset.Ole32;
16
17 internal class MspBackend : IBackend
18 {
19 - public BindResult Bind(WixToolset.Extensibility.IBindContext context)
19 + public BindResult Bind(IBindContext context)
20 {
21 throw new NotImplementedException();
22 }
src/WixToolset.Core.WindowsInstaller/MstBackend.cs
+1 -1
@@ -5,8 +5,8 @@ namespace WixToolset.Core.WindowsInstaller
5 using System;
6 using WixToolset.Core.WindowsInstaller.Unbind;
7 using WixToolset.Data;
8 - using WixToolset.Data.Bind;
8 using WixToolset.Extensibility;
9 + using WixToolset.Extensibility.Data;
10
11 internal class MstBackend : IBackend
12 {
src/WixToolset.Core.WindowsInstaller/Unbind/UnbindMsiOrMsmCommand.cs
+1 -1
@@ -6,7 +6,7 @@ namespace WixToolset.Core.WindowsInstaller.Unbind
6 using System.ComponentModel;
7 using WixToolset.Core.Native;
8 using WixToolset.Data;
9 - using WixToolset.Extensibility;
9 + using WixToolset.Extensibility.Data;
10 using WixToolset.Msi;
11
12 internal class UnbindMsiOrMsmCommand
src/WixToolset.Core.WindowsInstaller/UnbindContext.cs
+1 -4
@@ -3,15 +3,12 @@
3 namespace WixToolset.Core
4 {
5 using System;
6 - using WixToolset.Extensibility;
7 - using WixToolset.Extensibility.Services;
6 + using WixToolset.Extensibility.Data;
7
8 internal class UnbindContext : IUnbindContext
9 {
10 public IServiceProvider ServiceProvider { get; }
11
13 - public IMessaging Messaging { get; set; }
14 -
12 public string ExportBasePath { get; set; }
13
14 public string InputFilePath { get; set; }
src/WixToolset.Core.WindowsInstaller/Validator.cs
+4 -2
@@ -16,6 +16,7 @@ namespace WixToolset.Core.WindowsInstaller
16 using WixToolset.Data;
17 using WixToolset.Data.WindowsInstaller;
18 using WixToolset.Extensibility;
19 + using WixToolset.Extensibility.Data;
20 using WixToolset.Extensibility.Services;
21 using WixToolset.Msi;
22
@@ -324,14 +325,15 @@ namespace WixToolset.Core.WindowsInstaller
325 }
326 }
327
327 - public static Validator CreateFromContext(WixToolset.Extensibility.IBindContext context, string cubeFilename)
328 + public static Validator CreateFromContext(IBindContext context, string cubeFilename)
329 {
330 Validator validator = null;
331 + var messaging = context.ServiceProvider.GetService<IMessaging>();
332
333 // Tell the binder about the validator if validation isn't suppressed
334 if (!context.SuppressValidation)
335 {
334 - validator = new Validator(context.Messaging);
336 + validator = new Validator(messaging);
337 validator.IntermediateFolder = Path.Combine(context.IntermediateFolder, "validate");
338
339 // set the default cube file
src/WixToolset.Core.WindowsInstaller/WindowsInstallerBackendFactory.cs
+1
@@ -5,6 +5,7 @@ namespace WixToolset.Core.WindowsInstaller
5 using System;
6 using System.IO;
7 using WixToolset.Extensibility;
8 + using WixToolset.Extensibility.Data;
9
10 internal class WindowsInstallerBackendFactory : IBackendFactory
11 {
src/WixToolset.Core/Bind/DelayedField.cs
+1 -1
@@ -3,7 +3,7 @@
3 namespace WixToolset.Core.Bind
4 {
5 using WixToolset.Data;
6 - using WixToolset.Extensibility;
6 + using WixToolset.Extensibility.Data;
7
8 /// <summary>
9 /// Structure used to hold a row and field that contain binder variables, which need to be resolved
src/WixToolset.Core/Bind/ExpectedExtractFile.cs
+1 -1
@@ -3,7 +3,7 @@
3 namespace WixToolset.Core.Bind
4 {
5 using System;
6 - using WixToolset.Extensibility;
6 + using WixToolset.Extensibility.Data;
7
8 internal class ExpectedExtractFile : IExpectedExtractFile
9 {
src/WixToolset.Core/Bind/ExtractEmbeddedFilesCommand.cs
+1 -1
@@ -7,7 +7,7 @@ namespace WixToolset.Core.Bind
7 using System.Linq;
8 using System.Reflection;
9 using WixToolset.Data;
10 - using WixToolset.Extensibility;
10 + using WixToolset.Extensibility.Data;
11
12 public class ExtractEmbeddedFilesCommand
13 {
src/WixToolset.Core/Bind/FileResolver.cs
+1 -1
@@ -7,8 +7,8 @@ namespace WixToolset.Core.Bind
7 using System.IO;
8 using System.Linq;
9 using WixToolset.Data;
10 - using WixToolset.Data.Bind;
10 using WixToolset.Extensibility;
11 + using WixToolset.Extensibility.Data;
12
13 internal class FileResolver
14 {
src/WixToolset.Core/Bind/ResolveDelayedFieldsCommand.cs
+1 -1
@@ -7,7 +7,7 @@ namespace WixToolset.Core.Bind
7 using System.Globalization;
8 using System.Text;
9 using WixToolset.Data;
10 - using WixToolset.Extensibility;
10 + using WixToolset.Extensibility.Data;
11 using WixToolset.Extensibility.Services;
12
13 /// <summary>
src/WixToolset.Core/Bind/ResolveFieldsCommand.cs
+1 -1
@@ -5,8 +5,8 @@ namespace WixToolset.Core.Bind
5 using System;
6 using System.Collections.Generic;
7 using WixToolset.Data;
8 - using WixToolset.Data.Bind;
8 using WixToolset.Extensibility;
9 + using WixToolset.Extensibility.Data;
10 using WixToolset.Extensibility.Services;
11
12 /// <summary>
src/WixToolset.Core/Bind/TransferFilesCommand.cs
+1 -1
@@ -7,8 +7,8 @@ namespace WixToolset.Core.Bind
7 using System.IO;
8 using System.Security.AccessControl;
9 using WixToolset.Data;
10 - using WixToolset.Data.Bind;
10 using WixToolset.Extensibility;
11 + using WixToolset.Extensibility.Data;
12 using WixToolset.Extensibility.Services;
13
14 internal class TransferFilesCommand
src/WixToolset.Core/BindContext.cs
+1 -3
@@ -6,7 +6,7 @@ namespace WixToolset.Core
6 using System.Collections.Generic;
7 using WixToolset.Data;
8 using WixToolset.Extensibility;
9 - using WixToolset.Extensibility.Services;
9 + using WixToolset.Extensibility.Data;
10
11 public class BindContext : IBindContext
12 {
@@ -17,8 +17,6 @@ namespace WixToolset.Core
17
18 public IServiceProvider ServiceProvider { get; }
19
20 - public IMessaging Messaging { get; set; }
21 -
20 public IEnumerable<BindPath> BindPaths { get; set; }
21
22 public int CabbingThreadCount { get; set; }
src/WixToolset.Core/Binder.cs
+1 -2
@@ -11,6 +11,7 @@ namespace WixToolset.Core
11 using WixToolset.Data.Bind;
12 using WixToolset.Data.Tuples;
13 using WixToolset.Extensibility;
14 + using WixToolset.Extensibility.Data;
15 using WixToolset.Extensibility.Services;
16
17 /// <summary>
@@ -56,7 +57,6 @@ namespace WixToolset.Core
57 public BindResult Execute()
58 {
59 var context = this.ServiceProvider.GetService<IBindContext>();
59 - context.Messaging = this.ServiceProvider.GetService<IMessaging>();
60 context.CabbingThreadCount = this.CabbingThreadCount;
61 context.CabCachePath = this.CabCachePath;
62 context.Codepage = this.Codepage;
@@ -72,7 +72,6 @@ namespace WixToolset.Core
72 context.SuppressIces = this.SuppressIces;
73 context.SuppressValidation = this.SuppressValidation;
74
75 -
75 // Prebind.
76 //
77 foreach (var extension in context.Extensions)
src/WixToolset.Core/CommandLine/BuildCommand.cs
+1 -2
@@ -7,8 +7,7 @@ namespace WixToolset.Core.CommandLine
7 using System.IO;
8 using System.Linq;
9 using WixToolset.Data;
10 - using WixToolset.Data.Bind;
11 - using WixToolset.Extensibility;
10 + using WixToolset.Extensibility.Data;
11 using WixToolset.Extensibility.Services;
12
13 internal class BuildCommand : ICommandLineCommand
src/WixToolset.Core/CommandLine/CommandLineArguments.cs
+1
@@ -7,6 +7,7 @@ namespace WixToolset.Core.CommandLine
7 using System.IO;
8 using System.Text;
9 using System.Text.RegularExpressions;
10 + using WixToolset.Extensibility.Data;
11 using WixToolset.Extensibility.Services;
12
13 internal class CommandLineArguments : ICommandLineArguments
src/WixToolset.Core/CommandLine/CommandLineContext.cs
+1 -2
@@ -3,6 +3,7 @@
3 namespace WixToolset.Core.CommandLine
4 {
5 using System;
6 + using WixToolset.Extensibility.Data;
7 using WixToolset.Extensibility.Services;
8
9 internal class CommandLineContext : ICommandLineContext
@@ -14,8 +15,6 @@ namespace WixToolset.Core.CommandLine
15
16 public IServiceProvider ServiceProvider { get; }
17
17 - public IMessaging Messaging { get; set; }
18 -
18 public IExtensionManager ExtensionManager { get; set; }
19
20 public ICommandLineArguments Arguments { get; set; }
src/WixToolset.Core/CommandLine/CommandLineParser.cs
+20 -12
@@ -7,6 +7,7 @@ namespace WixToolset.Core.CommandLine
7 using System.IO;
8 using WixToolset.Data;
9 using WixToolset.Extensibility;
10 + using WixToolset.Extensibility.Data;
11 using WixToolset.Extensibility.Services;
12
13 internal enum Commands
@@ -19,27 +20,34 @@ namespace WixToolset.Core.CommandLine
20 Bind,
21 }
22
22 - internal class CommandLineParser : ICommandLine
23 + internal class CommandLineParser : ICommandLineParser
24 {
24 - private IServiceProvider ServiceProvider { get; set; }
25 + public CommandLineParser(IServiceProvider serviceProvider)
26 + {
27 + this.ServiceProvider = serviceProvider;
28 +
29 + this.Messaging = this.ServiceProvider.GetService<IMessaging>();
30 + }
31 +
32 + private IServiceProvider ServiceProvider { get; }
33
34 private IMessaging Messaging { get; set; }
35
36 + public IExtensionManager ExtensionManager { get; set; }
37 +
38 + public ICommandLineArguments Arguments { get; set; }
39 +
40 public static string ExpectedArgument { get; } = "expected argument";
41
42 public string ActiveCommand { get; private set; }
43
32 - public IExtensionManager ExtensionManager { get; private set; }
33 -
34 - public bool ShowHelp { get; set; }
44 + public bool ShowHelp { get; private set; }
45
36 - public ICommandLineCommand ParseStandardCommandLine(ICommandLineContext context)
46 + public ICommandLineCommand ParseStandardCommandLine()
47 {
38 - this.ServiceProvider = context.ServiceProvider;
39 -
40 - this.Messaging = context.Messaging ?? this.ServiceProvider.GetService<IMessaging>();
41 -
42 - this.ExtensionManager = context.ExtensionManager ?? this.ServiceProvider.GetService<IExtensionManager>();
48 + var context = this.ServiceProvider.GetService<ICommandLineContext>();
49 + context.ExtensionManager = this.ExtensionManager ?? this.ServiceProvider.GetService<IExtensionManager>();
50 + context.Arguments = this.Arguments;
51
52 var next = String.Empty;
53
@@ -277,7 +285,7 @@ namespace WixToolset.Core.CommandLine
285 return OutputType.Unknown;
286 }
287
280 - private ICommandLine Parse(ICommandLineContext context, Func<CommandLineParser, string, bool> parseCommand, Func<CommandLineParser, IParseCommandLine, string, bool> parseArgument)
288 + private ICommandLineParser Parse(ICommandLineContext context, Func<CommandLineParser, string, bool> parseCommand, Func<CommandLineParser, IParseCommandLine, string, bool> parseArgument)
289 {
290 var extensions = this.ExtensionManager.Create<IExtensionCommandLine>();
291
src/WixToolset.Core/CommandLine/CompileCommand.cs
+1 -2
@@ -5,8 +5,7 @@ namespace WixToolset.Core.CommandLine
5 using System;
6 using System.Collections.Generic;
7 using WixToolset.Data;
8 - using WixToolset.Extensibility;
9 - using WixToolset.Extensibility.Services;
8 + using WixToolset.Extensibility.Data;
9
10 internal class CompileCommand : ICommandLineCommand
11 {
src/WixToolset.Core/CommandLine/HelpCommand.cs
+1 -1
@@ -3,7 +3,7 @@
3 namespace WixToolset.Core.CommandLine
4 {
5 using System;
6 - using WixToolset.Extensibility.Services;
6 + using WixToolset.Extensibility.Data;
7
8 internal class HelpCommand : ICommandLineCommand
9 {
src/WixToolset.Core/CommandLine/VersionCommand.cs
+1 -1
@@ -3,7 +3,7 @@
3 namespace WixToolset.Core.CommandLine
4 {
5 using System;
6 - using WixToolset.Extensibility.Services;
6 + using WixToolset.Extensibility.Data;
7
8 internal class VersionCommand : ICommandLineCommand
9 {
src/WixToolset.Core/CompileContext.cs
+1 -3
@@ -7,7 +7,7 @@ namespace WixToolset.Core
7 using System.Xml.Linq;
8 using WixToolset.Data;
9 using WixToolset.Extensibility;
10 - using WixToolset.Extensibility.Services;
10 + using WixToolset.Extensibility.Data;
11
12 public class CompileContext : ICompileContext
13 {
@@ -18,8 +18,6 @@ namespace WixToolset.Core
18
19 public IServiceProvider ServiceProvider { get; }
20
21 - public IMessaging Messaging { get; set; }
22 -
21 public string CompilationId { get; set; }
22
23 public IEnumerable<ICompilerExtension> Extensions { get; set; }
src/WixToolset.Core/Compiler.cs
+9 -5
@@ -15,6 +15,7 @@ namespace WixToolset.Core
15 using WixToolset.Data;
16 using WixToolset.Data.Tuples;
17 using WixToolset.Extensibility;
18 + using WixToolset.Extensibility.Data;
19 using WixToolset.Extensibility.Services;
20 using Wix = WixToolset.Data.Serialize;
21
@@ -71,10 +72,14 @@ namespace WixToolset.Core
72 public Compiler(IServiceProvider serviceProvider)
73 {
74 this.ServiceProvider = serviceProvider;
75 +
76 + this.Messaging = serviceProvider.GetService<IMessaging>();
77 }
78
79 private IServiceProvider ServiceProvider { get; }
80
81 + public IMessaging Messaging { get; }
82 +
83 private ICompileContext Context { get; set; }
84
85 private CompilerCore Core { get; set; }
@@ -107,7 +112,6 @@ namespace WixToolset.Core
112 public Intermediate Execute()
113 {
114 this.Context = this.ServiceProvider.GetService<ICompileContext>();
110 - this.Context.Messaging = this.ServiceProvider.GetService<IMessaging>();
115 this.Context.Extensions = this.ServiceProvider.GetService<IExtensionManager>().Create<ICompilerExtension>();
116 this.Context.CompilationId = this.CompliationId;
117 this.Context.OutputPath = this.OutputPath;
@@ -131,7 +135,7 @@ namespace WixToolset.Core
135 }
136 else
137 {
134 - this.Context.Messaging.Write(ErrorMessages.DuplicateExtensionXmlSchemaNamespace(extension.GetType().ToString(), extension.Namespace.NamespaceName, collidingExtension.GetType().ToString()));
138 + this.Messaging.Write(ErrorMessages.DuplicateExtensionXmlSchemaNamespace(extension.GetType().ToString(), extension.Namespace.NamespaceName, collidingExtension.GetType().ToString()));
139 }
140
141 extension.PreCompile(this.Context);
@@ -142,9 +146,9 @@ namespace WixToolset.Core
146 {
147 var parseHelper = this.Context.ServiceProvider.GetService<IParseHelper>();
148
145 - this.Core = new CompilerCore(target, this.Context.Messaging, parseHelper, extensionsByNamespace);
149 + this.Core = new CompilerCore(target, this.Messaging, parseHelper, extensionsByNamespace);
150 this.Core.ShowPedanticMessages = this.ShowPedanticMessages;
147 - this.componentIdPlaceholdersResolver = new WixVariableResolver(this.Context.Messaging);
151 + this.componentIdPlaceholdersResolver = new WixVariableResolver(this.Messaging);
152
153 // parse the document
154 var source = this.Context.Source;
@@ -185,7 +189,7 @@ namespace WixToolset.Core
189 this.Core = null;
190 }
191
188 - return this.Context.Messaging.EncounteredError ? null : target;
192 + return this.Messaging.EncounteredError ? null : target;
193 }
194
195 private void ResolveComponentIdPlaceholders(Intermediate target)
src/WixToolset.Core/CompilerCore.cs
+1
@@ -14,6 +14,7 @@ namespace WixToolset.Core
14 using System.Xml.Linq;
15 using WixToolset.Data;
16 using WixToolset.Extensibility;
17 + using WixToolset.Extensibility.Data;
18 using WixToolset.Extensibility.Services;
19 using Wix = WixToolset.Data.Serialize;
20
src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs
+2 -1
@@ -12,10 +12,11 @@ namespace WixToolset.Core.ExtensibilityServices
12 using System.Text.RegularExpressions;
13 using System.Xml.Linq;
14 using WixToolset.Data;
15 - using Wix = WixToolset.Data.Serialize;
15 using WixToolset.Data.Tuples;
16 using WixToolset.Extensibility;
17 + using WixToolset.Extensibility.Data;
18 using WixToolset.Extensibility.Services;
19 + using Wix = WixToolset.Data.Serialize;
20
21 internal class ParseHelper : IParseHelper
22 {
src/WixToolset.Core/ExtensibilityServices/PreprocessHelper.cs
+15 -10
@@ -9,6 +9,7 @@ namespace WixToolset.Core.ExtensibilityServices
9 using System.Xml.Linq;
10 using WixToolset.Data;
11 using WixToolset.Extensibility;
12 + using WixToolset.Extensibility.Data;
13 using WixToolset.Extensibility.Services;
14
15 internal class PreprocessHelper : IPreprocessHelper
@@ -19,10 +20,14 @@ namespace WixToolset.Core.ExtensibilityServices
20 public PreprocessHelper(IServiceProvider serviceProvider)
21 {
22 this.ServiceProvider = serviceProvider;
23 +
24 + this.Messaging = this.ServiceProvider.GetService<IMessaging>();
25 }
26
27 private IServiceProvider ServiceProvider { get; }
28
29 + private IMessaging Messaging { get; }
30 +
31 private Dictionary<string, IPreprocessorExtension> ExtensionsByPrefix { get; set; }
32
33 public void AddVariable(IPreprocessContext context, string name, string value)
@@ -42,7 +47,7 @@ namespace WixToolset.Core.ExtensibilityServices
47 {
48 if (showWarning)
49 {
45 - context.Messaging.Write(WarningMessages.VariableDeclarationCollision(context.CurrentSourceLineNumber, name, value, currentValue));
50 + this.Messaging.Write(WarningMessages.VariableDeclarationCollision(context.CurrentSourceLineNumber, name, value, currentValue));
51 }
52
53 context.Variables[name] = value;
@@ -220,7 +225,7 @@ namespace WixToolset.Core.ExtensibilityServices
225 return context.CurrentSourceLineNumber.FileName;
226
227 case "PLATFORM":
223 - context.Messaging.Write(WarningMessages.DeprecatedPreProcVariable(context.CurrentSourceLineNumber, "$(sys.PLATFORM)", "$(sys.BUILDARCH)"));
228 + this.Messaging.Write(WarningMessages.DeprecatedPreProcVariable(context.CurrentSourceLineNumber, "$(sys.PLATFORM)", "$(sys.BUILDARCH)"));
229
230 goto case "BUILDARCH";
231
@@ -295,7 +300,7 @@ namespace WixToolset.Core.ExtensibilityServices
300 {
301 // Add any core defined pragmas here
302 default:
298 - context.Messaging.Write(WarningMessages.PreprocessorUnknownPragma(context.CurrentSourceLineNumber, pragmaName));
303 + this.Messaging.Write(WarningMessages.PreprocessorUnknownPragma(context.CurrentSourceLineNumber, pragmaName));
304 break;
305 }
306 break;
@@ -306,7 +311,7 @@ namespace WixToolset.Core.ExtensibilityServices
311 {
312 if (!extension.ProcessPragma(prefix, pragma, args, parent))
313 {
309 - context.Messaging.Write(WarningMessages.PreprocessorUnknownPragma(context.CurrentSourceLineNumber, pragmaName));
314 + this.Messaging.Write(WarningMessages.PreprocessorUnknownPragma(context.CurrentSourceLineNumber, pragmaName));
315 }
316 }
317 break;
@@ -339,7 +344,7 @@ namespace WixToolset.Core.ExtensibilityServices
344 currentPosition = remainder.IndexOf(')');
345 if (-1 == currentPosition)
346 {
342 - context.Messaging.Write(ErrorMessages.InvalidPreprocessorVariable(context.CurrentSourceLineNumber, remainder));
347 + this.Messaging.Write(ErrorMessages.InvalidPreprocessorVariable(context.CurrentSourceLineNumber, remainder));
348 break;
349 }
350
@@ -385,12 +390,12 @@ namespace WixToolset.Core.ExtensibilityServices
390 {
391 if (isFunction)
392 {
388 - context.Messaging.Write(ErrorMessages.InvalidPreprocessorFunction(context.CurrentSourceLineNumber, remainder));
393 + this.Messaging.Write(ErrorMessages.InvalidPreprocessorFunction(context.CurrentSourceLineNumber, remainder));
394 break;
395 }
396 else
397 {
393 - context.Messaging.Write(ErrorMessages.InvalidPreprocessorVariable(context.CurrentSourceLineNumber, remainder));
398 + this.Messaging.Write(ErrorMessages.InvalidPreprocessorVariable(context.CurrentSourceLineNumber, remainder));
399 break;
400 }
401 }
@@ -410,12 +415,12 @@ namespace WixToolset.Core.ExtensibilityServices
415 {
416 if (isFunction)
417 {
413 - context.Messaging.Write(ErrorMessages.UndefinedPreprocessorFunction(context.CurrentSourceLineNumber, subString));
418 + this.Messaging.Write(ErrorMessages.UndefinedPreprocessorFunction(context.CurrentSourceLineNumber, subString));
419 break;
420 }
421 else
422 {
418 - context.Messaging.Write(ErrorMessages.UndefinedPreprocessorVariable(context.CurrentSourceLineNumber, subString));
423 + this.Messaging.Write(ErrorMessages.UndefinedPreprocessorVariable(context.CurrentSourceLineNumber, subString));
424 break;
425 }
426 }
@@ -448,7 +453,7 @@ namespace WixToolset.Core.ExtensibilityServices
453 {
454 if (!context.Variables.Remove(name))
455 {
451 - context.Messaging.Write(ErrorMessages.CannotReundefineVariable(context.CurrentSourceLineNumber, name));
456 + this.Messaging.Write(ErrorMessages.CannotReundefineVariable(context.CurrentSourceLineNumber, name));
457 }
458 }
459
src/WixToolset.Core/IncribeContext.cs
+1 -3
@@ -3,7 +3,7 @@
3 namespace WixToolset.Core
4 {
5 using System;
6 - using WixToolset.Extensibility;
6 + using WixToolset.Extensibility.Data;
7 using WixToolset.Extensibility.Services;
8
9 internal class InscribeContext : IInscribeContext
@@ -15,8 +15,6 @@ namespace WixToolset.Core
15
16 public IServiceProvider ServiceProvider { get; }
17
18 - public IMessaging Messaging { get; set; }
19 -
18 public string IntermediateFolder { get; set; }
19
20 public string InputFilePath { get; set; }
src/WixToolset.Core/Layout.cs
+7 -8
@@ -8,8 +8,8 @@ namespace WixToolset.Core
8 using System.Linq;
9 using WixToolset.Core.Bind;
10 using WixToolset.Data;
11 - using WixToolset.Data.Bind;
11 using WixToolset.Extensibility;
12 + using WixToolset.Extensibility.Data;
13 using WixToolset.Extensibility.Services;
14
15 /// <summary>
@@ -20,10 +20,14 @@ namespace WixToolset.Core
20 public Layout(IServiceProvider serviceProvider)
21 {
22 this.ServiceProvider = serviceProvider;
23 +
24 + this.Messaging = serviceProvider.GetService<IMessaging>();
25 }
26
27 private IServiceProvider ServiceProvider { get; }
28
29 + private IMessaging Messaging { get; }
30 +
31 public IEnumerable<FileTransfer> FileTransfers { get; set; }
32
33 public IEnumerable<string> ContentFilePaths { get; set; }
@@ -36,21 +40,16 @@ namespace WixToolset.Core
40
41 public bool SuppressAclReset { get; set; }
42
39 - private IMessaging Messaging { get; set; }
40 -
43 public void Execute()
44 {
43 - this.Messaging = this.ServiceProvider.GetService<IMessaging>();
44 -
45 var extensionManager = this.ServiceProvider.GetService<IExtensionManager>();
46
47 var context = this.ServiceProvider.GetService<ILayoutContext>();
48 - context.Messaging = this.Messaging;
48 context.Extensions = extensionManager.Create<ILayoutExtension>();
49 context.FileTransfers = this.FileTransfers;
50 context.ContentFilePaths = this.ContentFilePaths;
51 context.ContentsFile = this.ContentsFile;
53 - context.OutputPdbPath = this.OutputsFile;
52 + context.OutputsFile = this.OutputsFile;
53 context.BuiltOutputsFile = this.BuiltOutputsFile;
54 context.SuppressAclReset = this.SuppressAclReset;
55
@@ -69,7 +68,7 @@ namespace WixToolset.Core
68 {
69 this.Messaging.Write(VerboseMessages.LayingOutMedia());
70
72 - var command = new TransferFilesCommand(context.Messaging, context.Extensions, context.FileTransfers, context.SuppressAclReset);
71 + var command = new TransferFilesCommand(this.Messaging, context.Extensions, context.FileTransfers, context.SuppressAclReset);
72 command.Execute();
73 }
74 }
src/WixToolset.Core/LayoutContext.cs
+1 -4
@@ -4,9 +4,8 @@ namespace WixToolset.Core
4 {
5 using System;
6 using System.Collections.Generic;
7 - using WixToolset.Data.Bind;
7 using WixToolset.Extensibility;
9 - using WixToolset.Extensibility.Services;
8 + using WixToolset.Extensibility.Data;
9
10 public class LayoutContext : ILayoutContext
11 {
@@ -17,8 +16,6 @@ namespace WixToolset.Core
16
17 public IServiceProvider ServiceProvider { get; }
18
20 - public IMessaging Messaging { get; set; }
21 -
19 public IEnumerable<ILayoutExtension> Extensions { get; set; }
20
21 public IEnumerable<IFileSystemExtension> FileSystemExtensions { get; set; }
src/WixToolset.Core/Librarian.cs
+11 -7
@@ -9,6 +9,7 @@ namespace WixToolset.Core
9 using WixToolset.Core.Link;
10 using WixToolset.Data;
11 using WixToolset.Extensibility;
12 + using WixToolset.Extensibility.Data;
13 using WixToolset.Extensibility.Services;
14
15 /// <summary>
@@ -19,10 +20,14 @@ namespace WixToolset.Core
20 public Librarian(IServiceProvider serviceProvider)
21 {
22 this.ServiceProvider = serviceProvider;
23 +
24 + this.Messaging = this.ServiceProvider.GetService<IMessaging>();
25 }
26
27 private IServiceProvider ServiceProvider { get; }
28
29 + private IMessaging Messaging { get; }
30 +
31 private ILibraryContext Context { get; set; }
32
33 public bool BindFiles { get; set; }
@@ -41,7 +46,6 @@ namespace WixToolset.Core
46 public Intermediate Execute()
47 {
48 this.Context = new LibraryContext(this.ServiceProvider);
44 - this.Context.Messaging = this.ServiceProvider.GetService<IMessaging>();
49 this.Context.BindFiles = this.BindFiles;
50 this.Context.BindPaths = this.BindPaths;
51 this.Context.Extensions = this.ServiceProvider.GetService<IExtensionManager>().Create<ILibrarianExtension>();
@@ -59,10 +63,10 @@ namespace WixToolset.Core
63 {
64 var sections = this.Context.Intermediates.SelectMany(i => i.Sections).ToList();
65
62 - var collate = new CollateLocalizationsCommand(this.Context.Messaging, this.Context.Localizations);
66 + var collate = new CollateLocalizationsCommand(this.Messaging, this.Context.Localizations);
67 var localizationsByCulture = collate.Execute();
68
65 - if (this.Context.Messaging.EncounteredError)
69 + if (this.Messaging.EncounteredError)
70 {
71 return null;
72 }
@@ -86,7 +90,7 @@ namespace WixToolset.Core
90 }
91 }
92
89 - return this.Context.Messaging.EncounteredError ? null : library;
93 + return this.Messaging.EncounteredError ? null : library;
94 }
95
96 /// <summary>
@@ -95,7 +99,7 @@ namespace WixToolset.Core
99 /// <param name="library">Library to validate.</param>
100 private void Validate(Intermediate library)
101 {
98 - FindEntrySectionAndLoadSymbolsCommand find = new FindEntrySectionAndLoadSymbolsCommand(this.Context.Messaging, library.Sections);
102 + FindEntrySectionAndLoadSymbolsCommand find = new FindEntrySectionAndLoadSymbolsCommand(this.Messaging, library.Sections);
103 find.Execute();
104
105 // TODO: Consider bringing this sort of verification back.
@@ -116,7 +120,7 @@ namespace WixToolset.Core
120 // Resolve paths to files that are to be embedded in the library.
121 if (this.Context.BindFiles)
122 {
119 - var variableResolver = new WixVariableResolver(this.Context.Messaging);
123 + var variableResolver = new WixVariableResolver(this.Messaging);
124
125 var fileResolver = new FileResolver(this.Context.BindPaths, this.Context.Extensions);
126
@@ -141,7 +145,7 @@ namespace WixToolset.Core
145 }
146 else
147 {
144 - this.Context.Messaging.Write(ErrorMessages.FileNotFound(tuple.SourceLineNumbers, pathField.Path, tuple.Definition.Name));
148 + this.Messaging.Write(ErrorMessages.FileNotFound(tuple.SourceLineNumbers, pathField.Path, tuple.Definition.Name));
149 }
150 }
151 }
src/WixToolset.Core/LibraryContext.cs
+1
@@ -6,6 +6,7 @@ namespace WixToolset.Core
6 using System.Collections.Generic;
7 using WixToolset.Data;
8 using WixToolset.Extensibility;
9 + using WixToolset.Extensibility.Data;
10 using WixToolset.Extensibility.Services;
11
12 public class LibraryContext : ILibraryContext
src/WixToolset.Core/LinkContext.cs
+1 -3
@@ -6,7 +6,7 @@ namespace WixToolset.Core
6 using System.Collections.Generic;
7 using WixToolset.Data;
8 using WixToolset.Extensibility;
9 - using WixToolset.Extensibility.Services;
9 + using WixToolset.Extensibility.Data;
10
11 public class LinkContext : ILinkContext
12 {
@@ -17,8 +17,6 @@ namespace WixToolset.Core
17
18 public IServiceProvider ServiceProvider { get; }
19
20 - public IMessaging Messaging { get; set; }
21 -
20 public IEnumerable<ILinkerExtension> Extensions { get; set; }
21
22 public IEnumerable<IExtensionData> ExtensionData { get; set; }
src/WixToolset.Core/Linker.cs
+16 -13
@@ -12,6 +12,7 @@ namespace WixToolset.Core
12 using WixToolset.Data;
13 using WixToolset.Data.Tuples;
14 using WixToolset.Extensibility;
15 + using WixToolset.Extensibility.Data;
16 using WixToolset.Extensibility.Services;
17 using WixToolset.Link;
18
@@ -31,11 +32,14 @@ namespace WixToolset.Core
32 public Linker(IServiceProvider serviceProvider)
33 {
34 this.ServiceProvider = serviceProvider;
35 + this.Messaging = this.ServiceProvider.GetService<IMessaging>();
36 this.sectionIdOnRows = true; // TODO: what is the correct value for this?
37 }
38
39 private IServiceProvider ServiceProvider { get; }
40
41 + private IMessaging Messaging { get; }
42 +
43 private ILinkContext Context { get; set; }
44
45 /// <summary>
@@ -71,7 +75,6 @@ namespace WixToolset.Core
75 var creator = this.TupleDefinitionCreator ?? this.ServiceProvider.GetService<ITupleDefinitionCreator>();
76
77 this.Context = this.ServiceProvider.GetService<ILinkContext>();
74 - this.Context.Messaging = this.ServiceProvider.GetService<IMessaging>();
78 this.Context.Extensions = extensionManager.Create<ILinkerExtension>();
79 this.Context.ExtensionData = extensionManager.Create<IExtensionData>();
80 this.Context.ExpectedOutputType = this.OutputType;
@@ -151,7 +154,7 @@ namespace WixToolset.Core
154
155 // First find the entry section and while processing all sections load all the symbols from all of the sections.
156 // sections.FindEntrySectionAndLoadSymbols(false, this, expectedOutputType, out entrySection, out allSymbols);
154 - var find = new FindEntrySectionAndLoadSymbolsCommand(this.Context.Messaging, sections);
157 + var find = new FindEntrySectionAndLoadSymbolsCommand(this.Messaging, sections);
158 find.ExpectedOutputType = this.Context.ExpectedOutputType;
159 find.Execute();
160
@@ -166,12 +169,12 @@ namespace WixToolset.Core
169
170 // Resolve the symbol references to find the set of sections we care about for linking.
171 // Of course, we start with the entry section (that's how it got its name after all).
169 - var resolve = new ResolveReferencesCommand(this.Context.Messaging, find.EntrySection, find.Symbols);
172 + var resolve = new ResolveReferencesCommand(this.Messaging, find.EntrySection, find.Symbols);
173 resolve.BuildingMergeModule = (SectionType.Module == find.EntrySection.Type);
174
175 resolve.Execute();
176
174 - if (this.Context.Messaging.EncounteredError)
177 + if (this.Messaging.EncounteredError)
178 {
179 return null;
180 }
@@ -185,7 +188,7 @@ namespace WixToolset.Core
188
189 this.FlattenSectionsComplexReferences(sections);
190
188 - if (this.Context.Messaging.EncounteredError)
191 + if (this.Messaging.EncounteredError)
192 {
193 return null;
194 }
@@ -197,7 +200,7 @@ namespace WixToolset.Core
200 var modulesToFeatures = new ConnectToFeatureCollection();
201 this.ProcessComplexReferences(find.EntrySection, sections, referencedComponents, componentsToFeatures, featuresToFeatures, modulesToFeatures);
202
200 - if (this.Context.Messaging.EncounteredError)
203 + if (this.Messaging.EncounteredError)
204 {
205 return null;
206 }
@@ -212,10 +215,10 @@ namespace WixToolset.Core
215 }
216
217 // Report duplicates that would ultimately end up being primary key collisions.
215 - var reportDupes = new ReportConflictingSymbolsCommand(this.Context.Messaging, find.PossiblyConflictingSymbols, resolve.ResolvedSections);
218 + var reportDupes = new ReportConflictingSymbolsCommand(this.Messaging, find.PossiblyConflictingSymbols, resolve.ResolvedSections);
219 reportDupes.Execute();
220
218 - if (this.Context.Messaging.EncounteredError)
221 + if (this.Messaging.EncounteredError)
222 {
223 return null;
224 }
@@ -716,12 +719,12 @@ namespace WixToolset.Core
719 // Bundles have groups of data that must be flattened in a way different from other types.
720 this.FlattenBundleTables(resolvedSection);
721
719 - if (this.Context.Messaging.EncounteredError)
722 + if (this.Messaging.EncounteredError)
723 {
724 return null;
725 }
726
724 - var collate = new CollateLocalizationsCommand(this.Context.Messaging, localizations);
727 + var collate = new CollateLocalizationsCommand(this.Messaging, localizations);
728 var localizationsByCulture = collate.Execute();
729
730 intermediate = new Intermediate(resolvedSection.Id, new[] { resolvedSection }, localizationsByCulture, null);
@@ -738,7 +741,7 @@ namespace WixToolset.Core
741 }
742 }
743
741 - return this.Context.Messaging.EncounteredError ? null : intermediate;
744 + return this.Messaging.EncounteredError ? null : intermediate;
745 }
746
747 #if SOLVE_CUSTOM_TABLE
@@ -1118,7 +1121,7 @@ namespace WixToolset.Core
1121 /// <param name="message">Message event arguments.</param>
1122 public void OnMessage(Message message)
1123 {
1121 - this.Context.Messaging.Write(message);
1124 + this.Messaging.Write(message);
1125 }
1126
1127 /// <summary>
@@ -1616,7 +1619,7 @@ namespace WixToolset.Core
1619 // will hold Payloads under UX, ChainPackages (references?) under Chain,
1620 // and ChainPackages/Payloads under the attached and any detatched
1621 // Containers.
1619 - var groups = new WixGroupingOrdering(entrySection, this.Context.Messaging);
1622 + var groups = new WixGroupingOrdering(entrySection, this.Messaging);
1623
1624 // Create UX payloads and Package payloads
1625 groups.UseTypes(new string[] { "Container", "Layout", "PackageGroup", "PayloadGroup", "Package" }, new string[] { "PackageGroup", "Package", "PayloadGroup", "Payload" });
src/WixToolset.Core/PreprocessContext.cs
+1 -3
@@ -6,7 +6,7 @@ namespace WixToolset.Core
6 using System.Collections.Generic;
7 using WixToolset.Data;
8 using WixToolset.Extensibility;
9 - using WixToolset.Extensibility.Services;
9 + using WixToolset.Extensibility.Data;
10
11 internal class PreprocessContext : IPreprocessContext
12 {
@@ -17,8 +17,6 @@ namespace WixToolset.Core
17
18 public IServiceProvider ServiceProvider { get; }
19
20 - public IMessaging Messaging { get; set; }
21 -
20 public IEnumerable<IPreprocessorExtension> Extensions { get; set; }
21
22 public Platform Platform { get; set; }
src/WixToolset.Core/Preprocessor.cs
+11 -7
@@ -6,15 +6,16 @@ namespace WixToolset.Core
6 using System.Collections.Generic;
7 using System.Globalization;
8 using System.IO;
9 + using System.Linq;
10 using System.Text;
11 using System.Text.RegularExpressions;
12 using System.Xml;
13 using System.Xml.Linq;
14 + using WixToolset.Core.Preprocess;
15 using WixToolset.Data;
16 using WixToolset.Extensibility;
15 - using WixToolset.Core.Preprocess;
17 + using WixToolset.Extensibility.Data;
18 using WixToolset.Extensibility.Services;
17 - using System.Linq;
19
20 /// <summary>
21 /// Preprocessor object
@@ -39,6 +40,8 @@ namespace WixToolset.Core
40 public Preprocessor(IServiceProvider serviceProvider)
41 {
42 this.ServiceProvider = serviceProvider;
43 +
44 + this.Messaging = this.ServiceProvider.GetService<IMessaging>();
45 }
46
47 public IEnumerable<string> IncludeSearchPaths { get; set; }
@@ -51,6 +54,8 @@ namespace WixToolset.Core
54
55 private IServiceProvider ServiceProvider { get; }
56
57 + private IMessaging Messaging { get; }
58 +
59 private IPreprocessContext Context { get; set; }
60
61 private Stack<string> CurrentFileStack { get; } = new Stack<string>();
@@ -169,7 +174,7 @@ namespace WixToolset.Core
174 throw new WixException(ErrorMessages.InvalidXml(this.Context.CurrentSourceLineNumber, "source", e.Message));
175 }
176
172 - return this.Context.Messaging.EncounteredError ? null : output;
177 + return this.Messaging.EncounteredError ? null : output;
178 }
179
180 /// <summary>
@@ -482,7 +487,7 @@ namespace WixToolset.Core
487 {
488 if ("Include" != reader.LocalName)
489 {
485 - this.Context.Messaging.Write(ErrorMessages.InvalidDocumentElement(sourceLineNumbers, reader.Name, "include", "Include"));
490 + this.Messaging.Write(ErrorMessages.InvalidDocumentElement(sourceLineNumbers, reader.Name, "include", "Include"));
491 }
492
493 this.IncludeNextStack.Pop();
@@ -570,7 +575,7 @@ namespace WixToolset.Core
575 // Resolve other variables in the warning message.
576 warningMessage = this.Helper.PreprocessString(this.Context, warningMessage);
577
573 - this.Context.Messaging.Write(WarningMessages.PreprocessorWarning(this.Context.CurrentSourceLineNumber, warningMessage));
578 + this.Messaging.Write(WarningMessages.PreprocessorWarning(this.Context.CurrentSourceLineNumber, warningMessage));
579 }
580
581 /// <summary>
@@ -1431,7 +1436,6 @@ namespace WixToolset.Core
1436 private IPreprocessContext CreateContext()
1437 {
1438 var context = this.ServiceProvider.GetService<IPreprocessContext>();
1434 - context.Messaging = this.ServiceProvider.GetService<IMessaging>();
1439 context.Extensions = this.ServiceProvider.GetService<IExtensionManager>().Create<IPreprocessorExtension>();
1440 context.CurrentSourceLineNumber = new SourceLineNumber(this.SourcePath);
1441 context.Platform = this.Platform;
@@ -1456,7 +1460,7 @@ namespace WixToolset.Core
1460 }
1461 else
1462 {
1459 - this.Context.Messaging.Write(ErrorMessages.DuplicateExtensionPreprocessorType(extension.GetType().ToString(), prefix, collidingExtension.GetType().ToString()));
1463 + this.Messaging.Write(ErrorMessages.DuplicateExtensionPreprocessorType(extension.GetType().ToString(), prefix, collidingExtension.GetType().ToString()));
1464 }
1465 }
1466 }
src/WixToolset.Core/ResolveContext.cs
+1 -2
@@ -6,6 +6,7 @@ namespace WixToolset.Core
6 using System.Collections.Generic;
7 using WixToolset.Data;
8 using WixToolset.Extensibility;
9 + using WixToolset.Extensibility.Data;
10 using WixToolset.Extensibility.Services;
11
12 public class ResolveContext : IResolveContext
@@ -17,8 +18,6 @@ namespace WixToolset.Core
18
19 public IServiceProvider ServiceProvider { get; }
20
20 - public IMessaging Messaging { get; set; }
21 -
21 public IEnumerable<BindPath> BindPaths { get; set; }
22
23 public IEnumerable<IResolverExtension> Extensions { get; set; }
src/WixToolset.Core/Resolver.cs
+8 -4
@@ -9,6 +9,7 @@ namespace WixToolset.Core
9 using WixToolset.Data;
10 using WixToolset.Data.Tuples;
11 using WixToolset.Extensibility;
12 + using WixToolset.Extensibility.Data;
13 using WixToolset.Extensibility.Services;
14
15 /// <summary>
@@ -19,9 +20,13 @@ namespace WixToolset.Core
20 public Resolver(IServiceProvider serviceProvider)
21 {
22 this.ServiceProvider = serviceProvider;
23 +
24 + this.Messaging = serviceProvider.GetService<IMessaging>();
25 }
26
24 - private IServiceProvider ServiceProvider { get; set; }
27 + private IServiceProvider ServiceProvider { get; }
28 +
29 + public IMessaging Messaging { get; }
30
31 public IEnumerable<BindPath> BindPaths { get; set; }
32
@@ -38,7 +43,6 @@ namespace WixToolset.Core
43 var extensionManager = this.ServiceProvider.GetService<IExtensionManager>();
44
45 var context = this.ServiceProvider.GetService<IResolveContext>();
41 - context.Messaging = this.ServiceProvider.GetService<IMessaging>();
46 context.BindPaths = this.BindPaths;
47 context.Extensions = extensionManager.Create<IResolverExtension>();
48 context.ExtensionData = extensionManager.Create<IExtensionData>();
@@ -46,7 +50,7 @@ namespace WixToolset.Core
50 context.IntermediateFolder = this.IntermediateFolder;
51 context.IntermediateRepresentation = this.IntermediateRepresentation;
52 context.Localizations = this.Localizations;
49 - context.VariableResolver = new WixVariableResolver(context.Messaging);
53 + context.VariableResolver = new WixVariableResolver(this.Messaging);
54
55 foreach (IResolverExtension extension in context.Extensions)
56 {
@@ -82,7 +86,7 @@ namespace WixToolset.Core
86 IEnumerable<DelayedField> delayedFields;
87 {
88 var command = new ResolveFieldsCommand();
85 - command.Messaging = context.Messaging;
89 + command.Messaging = this.Messaging;
90 command.BuildingPatch = buildingPatch;
91 command.VariableResolver = context.VariableResolver;
92 command.BindPaths = context.BindPaths;
src/WixToolset.Core/WixToolsetServiceProvider.cs
+2 -2
@@ -7,7 +7,7 @@ namespace WixToolset.Core
7 using WixToolset.Core.CommandLine;
8 using WixToolset.Core.ExtensibilityServices;
9 using WixToolset.Data;
10 - using WixToolset.Extensibility;
10 + using WixToolset.Extensibility.Data;
11 using WixToolset.Extensibility.Services;
12
13 public class WixToolsetServiceProvider : IServiceProvider
@@ -27,7 +27,7 @@ namespace WixToolset.Core
27 // Transients.
28 { typeof(ICommandLineArguments), (provider, singletons) => new CommandLineArguments(provider) },
29 { typeof(ICommandLineContext), (provider, singletons) => new CommandLineContext(provider) },
30 - { typeof(ICommandLine), (provider, singletons) => new CommandLineParser() },
30 + { typeof(ICommandLineParser), (provider, singletons) => new CommandLineParser(provider) },
31 { typeof(IPreprocessContext), (provider, singletons) => new PreprocessContext(provider) },
32 { typeof(ICompileContext), (provider, singletons) => new CompileContext(provider) },
33 { typeof(ILinkContext), (provider, singletons) => new LinkContext(provider) },
src/test/Example.Extension/ExamplePreprocessorExtensionAndCommandLine.cs
+1
@@ -5,6 +5,7 @@ namespace Example.Extension
5 using System;
6 using System.Collections.Generic;
7 using WixToolset.Extensibility;
8 + using WixToolset.Extensibility.Data;
9 using WixToolset.Extensibility.Services;
10
11 internal class ExamplePreprocessorExtensionAndCommandLine : BasePreprocessorExtension, IExtensionCommandLine
src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
+3 -3
@@ -64,8 +64,8 @@
64 </ItemGroup>
65
66 <ItemGroup>
67 - <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.2" />
68 - <PackageReference Include="xunit" Version="2.3.1" />
69 - <PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
67 + <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
68 + <PackageReference Include="xunit" Version="2.4.0" />
69 + <PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
70 </ItemGroup>
71 </Project>