diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/wix/WixToolset.Core/CommandLine/CommandLine.cs | 7 | ||||
| -rw-r--r-- | src/wix/WixToolset.Core/CommandLine/CompileCommand.cs | 99 | ||||
| -rw-r--r-- | src/wix/WixToolset.Core/SourceFile.cs | 17 |
3 files changed, 0 insertions, 123 deletions
diff --git a/src/wix/WixToolset.Core/CommandLine/CommandLine.cs b/src/wix/WixToolset.Core/CommandLine/CommandLine.cs index 8913828b..cd3b2fe4 100644 --- a/src/wix/WixToolset.Core/CommandLine/CommandLine.cs +++ b/src/wix/WixToolset.Core/CommandLine/CommandLine.cs | |||
| @@ -14,9 +14,6 @@ namespace WixToolset.Core.CommandLine | |||
| 14 | Unknown, | 14 | Unknown, |
| 15 | Build, | 15 | Build, |
| 16 | Preprocess, | 16 | Preprocess, |
| 17 | Compile, | ||
| 18 | Link, | ||
| 19 | Bind, | ||
| 20 | Decompile, | 17 | Decompile, |
| 21 | } | 18 | } |
| 22 | 19 | ||
| @@ -165,10 +162,6 @@ namespace WixToolset.Core.CommandLine | |||
| 165 | command = new BuildCommand(this.ServiceProvider); | 162 | command = new BuildCommand(this.ServiceProvider); |
| 166 | break; | 163 | break; |
| 167 | 164 | ||
| 168 | case CommandTypes.Compile: | ||
| 169 | command = new CompileCommand(this.ServiceProvider); | ||
| 170 | break; | ||
| 171 | |||
| 172 | case CommandTypes.Decompile: | 165 | case CommandTypes.Decompile: |
| 173 | command = new DecompileCommand(this.ServiceProvider); | 166 | command = new DecompileCommand(this.ServiceProvider); |
| 174 | break; | 167 | break; |
diff --git a/src/wix/WixToolset.Core/CommandLine/CompileCommand.cs b/src/wix/WixToolset.Core/CommandLine/CompileCommand.cs deleted file mode 100644 index 73e5bcbe..00000000 --- a/src/wix/WixToolset.Core/CommandLine/CompileCommand.cs +++ /dev/null | |||
| @@ -1,99 +0,0 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | namespace WixToolset.Core.CommandLine | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.Collections.Generic; | ||
| 7 | using System.Threading; | ||
| 8 | using System.Threading.Tasks; | ||
| 9 | using WixToolset.Data; | ||
| 10 | using WixToolset.Extensibility; | ||
| 11 | using WixToolset.Extensibility.Data; | ||
| 12 | using WixToolset.Extensibility.Services; | ||
| 13 | |||
| 14 | internal class CompileCommand : ICommandLineCommand | ||
| 15 | { | ||
| 16 | public CompileCommand(IServiceProvider serviceProvider) | ||
| 17 | { | ||
| 18 | this.ServiceProvider = serviceProvider; | ||
| 19 | this.Messaging = serviceProvider.GetService<IMessaging>(); | ||
| 20 | this.ExtensionManager = serviceProvider.GetService<IExtensionManager>(); | ||
| 21 | } | ||
| 22 | |||
| 23 | public CompileCommand(IServiceProvider serviceProvider, IEnumerable<SourceFile> sources, IDictionary<string, string> preprocessorVariables, Platform platform) | ||
| 24 | { | ||
| 25 | this.ServiceProvider = serviceProvider; | ||
| 26 | this.Messaging = serviceProvider.GetService<IMessaging>(); | ||
| 27 | this.ExtensionManager = serviceProvider.GetService<IExtensionManager>(); | ||
| 28 | this.SourceFiles = sources; | ||
| 29 | this.PreprocessorVariables = preprocessorVariables; | ||
| 30 | this.Platform = platform; | ||
| 31 | } | ||
| 32 | |||
| 33 | public bool ShowHelp { get; set; } | ||
| 34 | |||
| 35 | public bool ShowLogo { get; set; } | ||
| 36 | |||
| 37 | public bool StopParsing { get; } | ||
| 38 | |||
| 39 | private IServiceProvider ServiceProvider { get; } | ||
| 40 | |||
| 41 | private IMessaging Messaging { get; } | ||
| 42 | |||
| 43 | private IExtensionManager ExtensionManager { get; } | ||
| 44 | |||
| 45 | private IEnumerable<SourceFile> SourceFiles { get; } | ||
| 46 | |||
| 47 | private IDictionary<string, string> PreprocessorVariables { get; } | ||
| 48 | |||
| 49 | private Platform Platform { get; } | ||
| 50 | |||
| 51 | public IReadOnlyCollection<string> IncludeSearchPaths { get; } | ||
| 52 | |||
| 53 | public bool TryParseArgument(ICommandLineParser parseHelper, string argument) | ||
| 54 | { | ||
| 55 | throw new NotImplementedException(); | ||
| 56 | } | ||
| 57 | |||
| 58 | public Task<int> ExecuteAsync(CancellationToken _) | ||
| 59 | { | ||
| 60 | foreach (var sourceFile in this.SourceFiles) | ||
| 61 | { | ||
| 62 | var context = this.ServiceProvider.GetService<IPreprocessContext>(); | ||
| 63 | context.Extensions = this.ExtensionManager.GetServices<IPreprocessorExtension>(); | ||
| 64 | context.Platform = this.Platform; | ||
| 65 | context.IncludeSearchPaths = this.IncludeSearchPaths; | ||
| 66 | context.SourcePath = sourceFile.SourcePath; | ||
| 67 | context.Variables = this.PreprocessorVariables; | ||
| 68 | |||
| 69 | IPreprocessResult result = null; | ||
| 70 | try | ||
| 71 | { | ||
| 72 | var preprocessor = this.ServiceProvider.GetService<IPreprocessor>(); | ||
| 73 | result = preprocessor.Preprocess(context); | ||
| 74 | } | ||
| 75 | catch (WixException e) | ||
| 76 | { | ||
| 77 | this.Messaging.Write(e.Error); | ||
| 78 | } | ||
| 79 | |||
| 80 | if (this.Messaging.EncounteredError) | ||
| 81 | { | ||
| 82 | continue; | ||
| 83 | } | ||
| 84 | |||
| 85 | var compileContext = this.ServiceProvider.GetService<ICompileContext>(); | ||
| 86 | compileContext.Extensions = this.ExtensionManager.GetServices<ICompilerExtension>(); | ||
| 87 | compileContext.Platform = this.Platform; | ||
| 88 | compileContext.Source = result?.Document; | ||
| 89 | |||
| 90 | var compiler = this.ServiceProvider.GetService<ICompiler>(); | ||
| 91 | var intermediate = compiler.Compile(compileContext); | ||
| 92 | |||
| 93 | intermediate.Save(sourceFile.OutputPath); | ||
| 94 | } | ||
| 95 | |||
| 96 | return Task.FromResult(0); | ||
| 97 | } | ||
| 98 | } | ||
| 99 | } | ||
diff --git a/src/wix/WixToolset.Core/SourceFile.cs b/src/wix/WixToolset.Core/SourceFile.cs deleted file mode 100644 index d7ea7a50..00000000 --- a/src/wix/WixToolset.Core/SourceFile.cs +++ /dev/null | |||
| @@ -1,17 +0,0 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | namespace WixToolset.Core | ||
| 4 | { | ||
| 5 | internal class SourceFile | ||
| 6 | { | ||
| 7 | public SourceFile(string sourcePath, string outputPath) | ||
| 8 | { | ||
| 9 | this.SourcePath = sourcePath; | ||
| 10 | this.OutputPath = outputPath; | ||
| 11 | } | ||
| 12 | |||
| 13 | public string OutputPath { get; } | ||
| 14 | |||
| 15 | public string SourcePath { get; } | ||
| 16 | } | ||
| 17 | } | ||
