Removal of dead scenarios/code
The only reason to have "compile" command was to allow different compilation used to build the same code that would be included in the final output. This scenario is now supported by combining multiple compiles into .wixlibs and, optionally, including those .wixlibs into a single .wixlib.
Rob Mensching committed
Mar 15, 2022 at 14:03 UTC
7558404a7e853aa98344e52ecffd2bf92d0b0afd
3 files changed
-123
src/wix/WixToolset.Core/CommandLine/CommandLine.cs
-7
@@ -14,9 +14,6 @@ namespace WixToolset.Core.CommandLine
14
Unknown,
15
Build,
16
Preprocess,
17
- Compile,
18
- Link,
19
- Bind,
17
Decompile,
18
}
19
@@ -165,10 +162,6 @@ namespace WixToolset.Core.CommandLine
162
command = new BuildCommand(this.ServiceProvider);
163
break;
164
168
- case CommandTypes.Compile:
169
- command = new CompileCommand(this.ServiceProvider);
170
- break;
171
-
165
case CommandTypes.Decompile:
166
command = new DecompileCommand(this.ServiceProvider);
167
break;
src/wix/WixToolset.Core/CommandLine/CompileCommand.cs
deleted
-99
@@ -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
-}
src/wix/WixToolset.Core/SourceFile.cs
deleted
-17
@@ -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
-}