diff options
author | Rob Mensching <rob@firegiant.com> | 2020-06-08 16:25:38 -0700 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2020-06-08 16:37:14 -0700 |
commit | 04b8976ca565ce95cf32a58c8725843618724383 (patch) | |
tree | 72cf07a394f193a49afcba9bac89647e3b0a0922 /src | |
parent | 3fb889ab7aa3cb0dfae23e0379e28552e919ad72 (diff) | |
download | wix-04b8976ca565ce95cf32a58c8725843618724383.tar.gz wix-04b8976ca565ce95cf32a58c8725843618724383.tar.bz2 wix-04b8976ca565ce95cf32a58c8725843618724383.zip |
Make commands async and internal processes cancelable
Diffstat (limited to 'src')
-rw-r--r-- | src/WixToolset.Core.TestPackage/WixRunner.cs | 11 | ||||
-rw-r--r-- | src/WixToolset.Core/BindContext.cs | 4 | ||||
-rw-r--r-- | src/WixToolset.Core/CommandLine/BuildCommand.cs | 45 | ||||
-rw-r--r-- | src/WixToolset.Core/CommandLine/CompileCommand.cs | 12 | ||||
-rw-r--r-- | src/WixToolset.Core/CommandLine/DecompileCommand.cs | 10 | ||||
-rw-r--r-- | src/WixToolset.Core/CommandLine/HelpCommand.cs | 8 | ||||
-rw-r--r-- | src/WixToolset.Core/CommandLine/VersionCommand.cs | 6 | ||||
-rw-r--r-- | src/WixToolset.Core/CompileContext.cs | 4 | ||||
-rw-r--r-- | src/WixToolset.Core/LayoutContext.cs | 4 | ||||
-rw-r--r-- | src/WixToolset.Core/LibraryContext.cs | 4 | ||||
-rw-r--r-- | src/WixToolset.Core/LinkContext.cs | 4 | ||||
-rw-r--r-- | src/WixToolset.Core/PreprocessContext.cs | 4 | ||||
-rw-r--r-- | src/WixToolset.Core/ResolveContext.cs | 4 |
13 files changed, 75 insertions, 45 deletions
diff --git a/src/WixToolset.Core.TestPackage/WixRunner.cs b/src/WixToolset.Core.TestPackage/WixRunner.cs index 082e9e10..679956bd 100644 --- a/src/WixToolset.Core.TestPackage/WixRunner.cs +++ b/src/WixToolset.Core.TestPackage/WixRunner.cs | |||
@@ -4,6 +4,8 @@ namespace WixToolset.Core.TestPackage | |||
4 | { | 4 | { |
5 | using System; | 5 | using System; |
6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
7 | using System.Threading; | ||
8 | using System.Threading.Tasks; | ||
7 | using WixToolset.Data; | 9 | using WixToolset.Data; |
8 | using WixToolset.Extensibility.Data; | 10 | using WixToolset.Extensibility.Data; |
9 | using WixToolset.Extensibility.Services; | 11 | using WixToolset.Extensibility.Services; |
@@ -13,17 +15,18 @@ namespace WixToolset.Core.TestPackage | |||
13 | public static int Execute(string[] args, out List<Message> messages) | 15 | public static int Execute(string[] args, out List<Message> messages) |
14 | { | 16 | { |
15 | var serviceProvider = WixToolsetServiceProviderFactory.CreateServiceProvider(); | 17 | var serviceProvider = WixToolsetServiceProviderFactory.CreateServiceProvider(); |
16 | return Execute(args, serviceProvider, out messages); | 18 | var task = Execute(args, serviceProvider, out messages); |
19 | return task.Result; | ||
17 | } | 20 | } |
18 | 21 | ||
19 | public static WixRunnerResult Execute(params string[] args) | 22 | public static WixRunnerResult Execute(params string[] args) |
20 | { | 23 | { |
21 | var serviceProvider = WixToolsetServiceProviderFactory.CreateServiceProvider(); | 24 | var serviceProvider = WixToolsetServiceProviderFactory.CreateServiceProvider(); |
22 | var exitCode = Execute(args, serviceProvider, out var messages); | 25 | var exitCode = Execute(args, serviceProvider, out var messages); |
23 | return new WixRunnerResult { ExitCode = exitCode, Messages = messages.ToArray() }; | 26 | return new WixRunnerResult { ExitCode = exitCode.Result, Messages = messages.ToArray() }; |
24 | } | 27 | } |
25 | 28 | ||
26 | public static int Execute(string[] args, IWixToolsetServiceProvider serviceProvider, out List<Message> messages) | 29 | public static Task<int> Execute(string[] args, IWixToolsetServiceProvider serviceProvider, out List<Message> messages) |
27 | { | 30 | { |
28 | var listener = new TestMessageListener(); | 31 | var listener = new TestMessageListener(); |
29 | 32 | ||
@@ -39,7 +42,7 @@ namespace WixToolset.Core.TestPackage | |||
39 | commandLine.ExtensionManager = CreateExtensionManagerWithStandardBackends(serviceProvider, arguments.Extensions); | 42 | commandLine.ExtensionManager = CreateExtensionManagerWithStandardBackends(serviceProvider, arguments.Extensions); |
40 | commandLine.Arguments = arguments; | 43 | commandLine.Arguments = arguments; |
41 | var command = commandLine.ParseStandardCommandLine(); | 44 | var command = commandLine.ParseStandardCommandLine(); |
42 | return command?.Execute() ?? 1; | 45 | return command?.ExecuteAsync(CancellationToken.None) ?? Task.FromResult(1); |
43 | } | 46 | } |
44 | 47 | ||
45 | private static IExtensionManager CreateExtensionManagerWithStandardBackends(IWixToolsetServiceProvider serviceProvider, string[] extensions) | 48 | private static IExtensionManager CreateExtensionManagerWithStandardBackends(IWixToolsetServiceProvider serviceProvider, string[] extensions) |
diff --git a/src/WixToolset.Core/BindContext.cs b/src/WixToolset.Core/BindContext.cs index 3d7563c6..47375fb0 100644 --- a/src/WixToolset.Core/BindContext.cs +++ b/src/WixToolset.Core/BindContext.cs | |||
@@ -2,8 +2,8 @@ | |||
2 | 2 | ||
3 | namespace WixToolset.Core | 3 | namespace WixToolset.Core |
4 | { | 4 | { |
5 | using System; | ||
6 | using System.Collections.Generic; | 5 | using System.Collections.Generic; |
6 | using System.Threading; | ||
7 | using WixToolset.Data; | 7 | using WixToolset.Data; |
8 | using WixToolset.Extensibility; | 8 | using WixToolset.Extensibility; |
9 | using WixToolset.Extensibility.Data; | 9 | using WixToolset.Extensibility.Data; |
@@ -55,5 +55,7 @@ namespace WixToolset.Core | |||
55 | public bool SuppressValidation { get; set; } | 55 | public bool SuppressValidation { get; set; } |
56 | 56 | ||
57 | public bool SuppressLayout { get; set; } | 57 | public bool SuppressLayout { get; set; } |
58 | |||
59 | public CancellationToken CancellationToken { get; set; } | ||
58 | } | 60 | } |
59 | } | 61 | } |
diff --git a/src/WixToolset.Core/CommandLine/BuildCommand.cs b/src/WixToolset.Core/CommandLine/BuildCommand.cs index 8392131f..8602c514 100644 --- a/src/WixToolset.Core/CommandLine/BuildCommand.cs +++ b/src/WixToolset.Core/CommandLine/BuildCommand.cs | |||
@@ -6,6 +6,8 @@ namespace WixToolset.Core.CommandLine | |||
6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
7 | using System.IO; | 7 | using System.IO; |
8 | using System.Linq; | 8 | using System.Linq; |
9 | using System.Threading; | ||
10 | using System.Threading.Tasks; | ||
9 | using System.Xml.Linq; | 11 | using System.Xml.Linq; |
10 | using WixToolset.Data; | 12 | using WixToolset.Data; |
11 | using WixToolset.Extensibility; | 13 | using WixToolset.Extensibility; |
@@ -54,12 +56,12 @@ namespace WixToolset.Core.CommandLine | |||
54 | 56 | ||
55 | private string BuiltOutputsFile { get; set; } | 57 | private string BuiltOutputsFile { get; set; } |
56 | 58 | ||
57 | public int Execute() | 59 | public Task<int> ExecuteAsync(CancellationToken cancellationToken) |
58 | { | 60 | { |
59 | if (this.commandLine.ShowHelp) | 61 | if (this.commandLine.ShowHelp) |
60 | { | 62 | { |
61 | Console.WriteLine("TODO: Show build command help"); | 63 | Console.WriteLine("TODO: Show build command help"); |
62 | return -1; | 64 | return Task.FromResult(-1); |
63 | } | 65 | } |
64 | 66 | ||
65 | this.IntermediateFolder = this.commandLine.CalculateIntermedateFolder(); | 67 | this.IntermediateFolder = this.commandLine.CalculateIntermedateFolder(); |
@@ -107,23 +109,23 @@ namespace WixToolset.Core.CommandLine | |||
107 | 109 | ||
108 | if (this.Messaging.EncounteredError) | 110 | if (this.Messaging.EncounteredError) |
109 | { | 111 | { |
110 | return this.Messaging.LastErrorNumber; | 112 | return Task.FromResult(this.Messaging.LastErrorNumber); |
111 | } | 113 | } |
112 | 114 | ||
113 | var wixobjs = this.CompilePhase(preprocessorVariables, codeFiles); | 115 | var wixobjs = this.CompilePhase(preprocessorVariables, codeFiles, cancellationToken); |
114 | 116 | ||
115 | var wxls = this.LoadLocalizationFiles(this.commandLine.LocalizationFilePaths, preprocessorVariables); | 117 | var wxls = this.LoadLocalizationFiles(this.commandLine.LocalizationFilePaths, preprocessorVariables, cancellationToken); |
116 | 118 | ||
117 | if (this.Messaging.EncounteredError) | 119 | if (this.Messaging.EncounteredError) |
118 | { | 120 | { |
119 | return this.Messaging.LastErrorNumber; | 121 | return Task.FromResult(this.Messaging.LastErrorNumber); |
120 | } | 122 | } |
121 | 123 | ||
122 | if (this.OutputType == OutputType.Library) | 124 | if (this.OutputType == OutputType.Library) |
123 | { | 125 | { |
124 | using (new IntermediateFieldContext("wix.lib")) | 126 | using (new IntermediateFieldContext("wix.lib")) |
125 | { | 127 | { |
126 | var wixlib = this.LibraryPhase(wixobjs, wxls, this.commandLine.BindFiles, this.commandLine.BindPaths); | 128 | var wixlib = this.LibraryPhase(wixobjs, wxls, this.commandLine.BindFiles, this.commandLine.BindPaths, cancellationToken); |
127 | 129 | ||
128 | if (!this.Messaging.EncounteredError) | 130 | if (!this.Messaging.EncounteredError) |
129 | { | 131 | { |
@@ -137,7 +139,7 @@ namespace WixToolset.Core.CommandLine | |||
137 | { | 139 | { |
138 | if (wixipl == null) | 140 | if (wixipl == null) |
139 | { | 141 | { |
140 | wixipl = this.LinkPhase(wixobjs, this.commandLine.LibraryFilePaths, creator); | 142 | wixipl = this.LinkPhase(wixobjs, this.commandLine.LibraryFilePaths, creator, cancellationToken); |
141 | } | 143 | } |
142 | 144 | ||
143 | if (!this.Messaging.EncounteredError) | 145 | if (!this.Messaging.EncounteredError) |
@@ -157,14 +159,14 @@ namespace WixToolset.Core.CommandLine | |||
157 | { | 159 | { |
158 | using (new IntermediateFieldContext("wix.bind")) | 160 | using (new IntermediateFieldContext("wix.bind")) |
159 | { | 161 | { |
160 | this.BindPhase(wixipl, wxls, filterCultures, this.commandLine.CabCachePath, this.commandLine.BindPaths); | 162 | this.BindPhase(wixipl, wxls, filterCultures, this.commandLine.CabCachePath, this.commandLine.BindPaths, cancellationToken); |
161 | } | 163 | } |
162 | } | 164 | } |
163 | } | 165 | } |
164 | } | 166 | } |
165 | } | 167 | } |
166 | 168 | ||
167 | return this.Messaging.LastErrorNumber; | 169 | return Task.FromResult(this.Messaging.LastErrorNumber); |
168 | } | 170 | } |
169 | 171 | ||
170 | public bool TryParseArgument(ICommandLineParser parser, string argument) | 172 | public bool TryParseArgument(ICommandLineParser parser, string argument) |
@@ -210,13 +212,13 @@ namespace WixToolset.Core.CommandLine | |||
210 | } | 212 | } |
211 | } | 213 | } |
212 | 214 | ||
213 | private IEnumerable<Intermediate> CompilePhase(IDictionary<string, string> preprocessorVariables, IEnumerable<SourceFile> sourceFiles) | 215 | private IEnumerable<Intermediate> CompilePhase(IDictionary<string, string> preprocessorVariables, IEnumerable<SourceFile> sourceFiles, CancellationToken cancellationToken) |
214 | { | 216 | { |
215 | var intermediates = new List<Intermediate>(); | 217 | var intermediates = new List<Intermediate>(); |
216 | 218 | ||
217 | foreach (var sourceFile in sourceFiles) | 219 | foreach (var sourceFile in sourceFiles) |
218 | { | 220 | { |
219 | var document = this.Preprocess(preprocessorVariables, sourceFile.SourcePath); | 221 | var document = this.Preprocess(preprocessorVariables, sourceFile.SourcePath, cancellationToken); |
220 | 222 | ||
221 | if (this.Messaging.EncounteredError) | 223 | if (this.Messaging.EncounteredError) |
222 | { | 224 | { |
@@ -228,6 +230,7 @@ namespace WixToolset.Core.CommandLine | |||
228 | context.OutputPath = sourceFile.OutputPath; | 230 | context.OutputPath = sourceFile.OutputPath; |
229 | context.Platform = this.Platform; | 231 | context.Platform = this.Platform; |
230 | context.Source = document; | 232 | context.Source = document; |
233 | context.CancellationToken = cancellationToken; | ||
231 | 234 | ||
232 | Intermediate intermediate = null; | 235 | Intermediate intermediate = null; |
233 | try | 236 | try |
@@ -251,7 +254,7 @@ namespace WixToolset.Core.CommandLine | |||
251 | return intermediates; | 254 | return intermediates; |
252 | } | 255 | } |
253 | 256 | ||
254 | private Intermediate LibraryPhase(IEnumerable<Intermediate> intermediates, IEnumerable<Localization> localizations, bool bindFiles, IEnumerable<IBindPath> bindPaths) | 257 | private Intermediate LibraryPhase(IEnumerable<Intermediate> intermediates, IEnumerable<Localization> localizations, bool bindFiles, IEnumerable<IBindPath> bindPaths, CancellationToken cancellationToken) |
255 | { | 258 | { |
256 | var context = this.ServiceProvider.GetService<ILibraryContext>(); | 259 | var context = this.ServiceProvider.GetService<ILibraryContext>(); |
257 | context.BindFiles = bindFiles; | 260 | context.BindFiles = bindFiles; |
@@ -259,6 +262,7 @@ namespace WixToolset.Core.CommandLine | |||
259 | context.Extensions = this.ExtensionManager.GetServices<ILibrarianExtension>(); | 262 | context.Extensions = this.ExtensionManager.GetServices<ILibrarianExtension>(); |
260 | context.Localizations = localizations; | 263 | context.Localizations = localizations; |
261 | context.Intermediates = intermediates; | 264 | context.Intermediates = intermediates; |
265 | context.CancellationToken = cancellationToken; | ||
262 | 266 | ||
263 | Intermediate library = null; | 267 | Intermediate library = null; |
264 | try | 268 | try |
@@ -274,7 +278,7 @@ namespace WixToolset.Core.CommandLine | |||
274 | return library; | 278 | return library; |
275 | } | 279 | } |
276 | 280 | ||
277 | private Intermediate LinkPhase(IEnumerable<Intermediate> intermediates, IEnumerable<string> libraryFiles, ITupleDefinitionCreator creator) | 281 | private Intermediate LinkPhase(IEnumerable<Intermediate> intermediates, IEnumerable<string> libraryFiles, ITupleDefinitionCreator creator, CancellationToken cancellationToken) |
278 | { | 282 | { |
279 | var libraries = this.LoadLibraries(libraryFiles, creator); | 283 | var libraries = this.LoadLibraries(libraryFiles, creator); |
280 | 284 | ||
@@ -289,12 +293,13 @@ namespace WixToolset.Core.CommandLine | |||
289 | context.ExpectedOutputType = this.OutputType; | 293 | context.ExpectedOutputType = this.OutputType; |
290 | context.Intermediates = intermediates.Concat(libraries).ToList(); | 294 | context.Intermediates = intermediates.Concat(libraries).ToList(); |
291 | context.TupleDefinitionCreator = creator; | 295 | context.TupleDefinitionCreator = creator; |
296 | context.CancellationToken = cancellationToken; | ||
292 | 297 | ||
293 | var linker = this.ServiceProvider.GetService<ILinker>(); | 298 | var linker = this.ServiceProvider.GetService<ILinker>(); |
294 | return linker.Link(context); | 299 | return linker.Link(context); |
295 | } | 300 | } |
296 | 301 | ||
297 | private void BindPhase(Intermediate output, IEnumerable<Localization> localizations, IEnumerable<string> filterCultures, string cabCachePath, IEnumerable<IBindPath> bindPaths) | 302 | private void BindPhase(Intermediate output, IEnumerable<Localization> localizations, IEnumerable<string> filterCultures, string cabCachePath, IEnumerable<IBindPath> bindPaths, CancellationToken cancellationToken) |
298 | { | 303 | { |
299 | var intermediateFolder = this.IntermediateFolder; | 304 | var intermediateFolder = this.IntermediateFolder; |
300 | if (String.IsNullOrEmpty(intermediateFolder)) | 305 | if (String.IsNullOrEmpty(intermediateFolder)) |
@@ -312,6 +317,7 @@ namespace WixToolset.Core.CommandLine | |||
312 | context.IntermediateFolder = intermediateFolder; | 317 | context.IntermediateFolder = intermediateFolder; |
313 | context.IntermediateRepresentation = output; | 318 | context.IntermediateRepresentation = output; |
314 | context.Localizations = localizations; | 319 | context.Localizations = localizations; |
320 | context.CancellationToken = cancellationToken; | ||
315 | 321 | ||
316 | var resolver = this.ServiceProvider.GetService<IResolver>(); | 322 | var resolver = this.ServiceProvider.GetService<IResolver>(); |
317 | resolveResult = resolver.Resolve(context); | 323 | resolveResult = resolver.Resolve(context); |
@@ -343,6 +349,7 @@ namespace WixToolset.Core.CommandLine | |||
343 | context.PdbPath = this.PdbType == PdbType.None ? null : this.PdbFile ?? Path.ChangeExtension(this.OutputFile, ".wixpdb"); | 349 | context.PdbPath = this.PdbType == PdbType.None ? null : this.PdbFile ?? Path.ChangeExtension(this.OutputFile, ".wixpdb"); |
344 | context.SuppressIces = Array.Empty<string>(); // TODO: set this correctly | 350 | context.SuppressIces = Array.Empty<string>(); // TODO: set this correctly |
345 | context.SuppressValidation = true; // TODO: set this correctly | 351 | context.SuppressValidation = true; // TODO: set this correctly |
352 | context.CancellationToken = cancellationToken; | ||
346 | 353 | ||
347 | var binder = this.ServiceProvider.GetService<IBinder>(); | 354 | var binder = this.ServiceProvider.GetService<IBinder>(); |
348 | bindResult = binder.Bind(context); | 355 | bindResult = binder.Bind(context); |
@@ -363,6 +370,7 @@ namespace WixToolset.Core.CommandLine | |||
363 | context.OutputsFile = this.OutputsFile; | 370 | context.OutputsFile = this.OutputsFile; |
364 | context.BuiltOutputsFile = this.BuiltOutputsFile; | 371 | context.BuiltOutputsFile = this.BuiltOutputsFile; |
365 | context.SuppressAclReset = false; // TODO: correctly set SuppressAclReset | 372 | context.SuppressAclReset = false; // TODO: correctly set SuppressAclReset |
373 | context.CancellationToken = cancellationToken; | ||
366 | 374 | ||
367 | var layout = this.ServiceProvider.GetService<ILayoutCreator>(); | 375 | var layout = this.ServiceProvider.GetService<ILayoutCreator>(); |
368 | layout.Layout(context); | 376 | layout.Layout(context); |
@@ -392,14 +400,14 @@ namespace WixToolset.Core.CommandLine | |||
392 | return Array.Empty<Intermediate>(); | 400 | return Array.Empty<Intermediate>(); |
393 | } | 401 | } |
394 | 402 | ||
395 | private IEnumerable<Localization> LoadLocalizationFiles(IEnumerable<string> locFiles, IDictionary<string, string> preprocessorVariables) | 403 | private IEnumerable<Localization> LoadLocalizationFiles(IEnumerable<string> locFiles, IDictionary<string, string> preprocessorVariables, CancellationToken cancellationToken) |
396 | { | 404 | { |
397 | var localizations = new List<Localization>(); | 405 | var localizations = new List<Localization>(); |
398 | var parser = this.ServiceProvider.GetService<ILocalizationParser>(); | 406 | var parser = this.ServiceProvider.GetService<ILocalizationParser>(); |
399 | 407 | ||
400 | foreach (var loc in locFiles) | 408 | foreach (var loc in locFiles) |
401 | { | 409 | { |
402 | var document = this.Preprocess(preprocessorVariables, loc); | 410 | var document = this.Preprocess(preprocessorVariables, loc, cancellationToken); |
403 | 411 | ||
404 | if (this.Messaging.EncounteredError) | 412 | if (this.Messaging.EncounteredError) |
405 | { | 413 | { |
@@ -413,7 +421,7 @@ namespace WixToolset.Core.CommandLine | |||
413 | return localizations; | 421 | return localizations; |
414 | } | 422 | } |
415 | 423 | ||
416 | private XDocument Preprocess(IDictionary<string, string> preprocessorVariables, string sourcePath) | 424 | private XDocument Preprocess(IDictionary<string, string> preprocessorVariables, string sourcePath, CancellationToken cancellationToken) |
417 | { | 425 | { |
418 | var context = this.ServiceProvider.GetService<IPreprocessContext>(); | 426 | var context = this.ServiceProvider.GetService<IPreprocessContext>(); |
419 | context.Extensions = this.ExtensionManager.GetServices<IPreprocessorExtension>(); | 427 | context.Extensions = this.ExtensionManager.GetServices<IPreprocessorExtension>(); |
@@ -421,6 +429,7 @@ namespace WixToolset.Core.CommandLine | |||
421 | context.IncludeSearchPaths = this.IncludeSearchPaths; | 429 | context.IncludeSearchPaths = this.IncludeSearchPaths; |
422 | context.SourcePath = sourcePath; | 430 | context.SourcePath = sourcePath; |
423 | context.Variables = preprocessorVariables; | 431 | context.Variables = preprocessorVariables; |
432 | context.CancellationToken = cancellationToken; | ||
424 | 433 | ||
425 | IPreprocessResult result = null; | 434 | IPreprocessResult result = null; |
426 | try | 435 | try |
diff --git a/src/WixToolset.Core/CommandLine/CompileCommand.cs b/src/WixToolset.Core/CommandLine/CompileCommand.cs index 67756947..d16c7a46 100644 --- a/src/WixToolset.Core/CommandLine/CompileCommand.cs +++ b/src/WixToolset.Core/CommandLine/CompileCommand.cs | |||
@@ -4,7 +4,8 @@ namespace WixToolset.Core.CommandLine | |||
4 | { | 4 | { |
5 | using System; | 5 | using System; |
6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
7 | using System.Xml.Linq; | 7 | using System.Threading; |
8 | using System.Threading.Tasks; | ||
8 | using WixToolset.Data; | 9 | using WixToolset.Data; |
9 | using WixToolset.Extensibility; | 10 | using WixToolset.Extensibility; |
10 | using WixToolset.Extensibility.Data; | 11 | using WixToolset.Extensibility.Data; |
@@ -47,12 +48,9 @@ namespace WixToolset.Core.CommandLine | |||
47 | 48 | ||
48 | public bool StopParsing => throw new NotImplementedException(); | 49 | public bool StopParsing => throw new NotImplementedException(); |
49 | 50 | ||
50 | public bool TryParseArgument(ICommandLineParser parseHelper, string argument) | 51 | public bool TryParseArgument(ICommandLineParser parseHelper, string argument) => throw new NotImplementedException(); |
51 | { | ||
52 | throw new NotImplementedException(); | ||
53 | } | ||
54 | 52 | ||
55 | public int Execute() | 53 | public Task<int> ExecuteAsync(CancellationToken _) |
56 | { | 54 | { |
57 | foreach (var sourceFile in this.SourceFiles) | 55 | foreach (var sourceFile in this.SourceFiles) |
58 | { | 56 | { |
@@ -91,7 +89,7 @@ namespace WixToolset.Core.CommandLine | |||
91 | intermediate.Save(sourceFile.OutputPath); | 89 | intermediate.Save(sourceFile.OutputPath); |
92 | } | 90 | } |
93 | 91 | ||
94 | return 0; | 92 | return Task.FromResult(0); |
95 | } | 93 | } |
96 | } | 94 | } |
97 | } | 95 | } |
diff --git a/src/WixToolset.Core/CommandLine/DecompileCommand.cs b/src/WixToolset.Core/CommandLine/DecompileCommand.cs index 0e21a4f4..1e11ae52 100644 --- a/src/WixToolset.Core/CommandLine/DecompileCommand.cs +++ b/src/WixToolset.Core/CommandLine/DecompileCommand.cs | |||
@@ -4,6 +4,8 @@ namespace WixToolset.Core.CommandLine | |||
4 | { | 4 | { |
5 | using System; | 5 | using System; |
6 | using System.IO; | 6 | using System.IO; |
7 | using System.Threading; | ||
8 | using System.Threading.Tasks; | ||
7 | using System.Xml.Linq; | 9 | using System.Xml.Linq; |
8 | using WixToolset.Data; | 10 | using WixToolset.Data; |
9 | using WixToolset.Extensibility; | 11 | using WixToolset.Extensibility; |
@@ -29,12 +31,12 @@ namespace WixToolset.Core.CommandLine | |||
29 | 31 | ||
30 | public IMessaging Messaging { get; } | 32 | public IMessaging Messaging { get; } |
31 | 33 | ||
32 | public int Execute() | 34 | public Task<int> ExecuteAsync(CancellationToken _) |
33 | { | 35 | { |
34 | if (this.commandLine.ShowHelp) | 36 | if (this.commandLine.ShowHelp) |
35 | { | 37 | { |
36 | Console.WriteLine("TODO: Show decompile command help"); | 38 | Console.WriteLine("TODO: Show decompile command help"); |
37 | return -1; | 39 | return Task.FromResult(-1); |
38 | } | 40 | } |
39 | 41 | ||
40 | var context = this.ServiceProvider.GetService<IDecompileContext>(); | 42 | var context = this.ServiceProvider.GetService<IDecompileContext>(); |
@@ -61,10 +63,10 @@ namespace WixToolset.Core.CommandLine | |||
61 | 63 | ||
62 | if (this.Messaging.EncounteredError) | 64 | if (this.Messaging.EncounteredError) |
63 | { | 65 | { |
64 | return 1; | 66 | return Task.FromResult(1); |
65 | } | 67 | } |
66 | 68 | ||
67 | return 0; | 69 | return Task.FromResult(0); |
68 | } | 70 | } |
69 | 71 | ||
70 | public bool TryParseArgument(ICommandLineParser parser, string argument) | 72 | public bool TryParseArgument(ICommandLineParser parser, string argument) |
diff --git a/src/WixToolset.Core/CommandLine/HelpCommand.cs b/src/WixToolset.Core/CommandLine/HelpCommand.cs index 224b154c..78845189 100644 --- a/src/WixToolset.Core/CommandLine/HelpCommand.cs +++ b/src/WixToolset.Core/CommandLine/HelpCommand.cs | |||
@@ -1,8 +1,10 @@ | |||
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. | 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 | 2 | ||
3 | namespace WixToolset.Core.CommandLine | 3 | namespace WixToolset.Core.CommandLine |
4 | { | 4 | { |
5 | using System; | 5 | using System; |
6 | using System.Threading; | ||
7 | using System.Threading.Tasks; | ||
6 | using WixToolset.Extensibility.Data; | 8 | using WixToolset.Extensibility.Data; |
7 | using WixToolset.Extensibility.Services; | 9 | using WixToolset.Extensibility.Services; |
8 | 10 | ||
@@ -12,11 +14,11 @@ namespace WixToolset.Core.CommandLine | |||
12 | 14 | ||
13 | public bool StopParsing => true; | 15 | public bool StopParsing => true; |
14 | 16 | ||
15 | public int Execute() | 17 | public Task<int> ExecuteAsync(CancellationToken _) |
16 | { | 18 | { |
17 | Console.WriteLine("TODO: Show list of available commands"); | 19 | Console.WriteLine("TODO: Show list of available commands"); |
18 | 20 | ||
19 | return -1; | 21 | return Task.FromResult(-1); |
20 | } | 22 | } |
21 | 23 | ||
22 | public bool TryParseArgument(ICommandLineParser parseHelper, string argument) | 24 | public bool TryParseArgument(ICommandLineParser parseHelper, string argument) |
diff --git a/src/WixToolset.Core/CommandLine/VersionCommand.cs b/src/WixToolset.Core/CommandLine/VersionCommand.cs index 50e90a93..6ce2a89d 100644 --- a/src/WixToolset.Core/CommandLine/VersionCommand.cs +++ b/src/WixToolset.Core/CommandLine/VersionCommand.cs | |||
@@ -3,6 +3,8 @@ | |||
3 | namespace WixToolset.Core.CommandLine | 3 | namespace WixToolset.Core.CommandLine |
4 | { | 4 | { |
5 | using System; | 5 | using System; |
6 | using System.Threading; | ||
7 | using System.Threading.Tasks; | ||
6 | using WixToolset.Extensibility.Data; | 8 | using WixToolset.Extensibility.Data; |
7 | using WixToolset.Extensibility.Services; | 9 | using WixToolset.Extensibility.Services; |
8 | 10 | ||
@@ -12,12 +14,12 @@ namespace WixToolset.Core.CommandLine | |||
12 | 14 | ||
13 | public bool StopParsing => true; | 15 | public bool StopParsing => true; |
14 | 16 | ||
15 | public int Execute() | 17 | public Task<int> ExecuteAsync(CancellationToken cancellationToken) |
16 | { | 18 | { |
17 | Console.WriteLine("wix version {0}", ThisAssembly.AssemblyInformationalVersion); | 19 | Console.WriteLine("wix version {0}", ThisAssembly.AssemblyInformationalVersion); |
18 | Console.WriteLine(); | 20 | Console.WriteLine(); |
19 | 21 | ||
20 | return 0; | 22 | return Task.FromResult(0); |
21 | } | 23 | } |
22 | 24 | ||
23 | public bool TryParseArgument(ICommandLineParser parseHelper, string argument) => true; // eat any arguments | 25 | public bool TryParseArgument(ICommandLineParser parseHelper, string argument) => true; // eat any arguments |
diff --git a/src/WixToolset.Core/CompileContext.cs b/src/WixToolset.Core/CompileContext.cs index f92a131d..7dc862b9 100644 --- a/src/WixToolset.Core/CompileContext.cs +++ b/src/WixToolset.Core/CompileContext.cs | |||
@@ -2,8 +2,8 @@ | |||
2 | 2 | ||
3 | namespace WixToolset.Core | 3 | namespace WixToolset.Core |
4 | { | 4 | { |
5 | using System; | ||
6 | using System.Collections.Generic; | 5 | using System.Collections.Generic; |
6 | using System.Threading; | ||
7 | using System.Xml.Linq; | 7 | using System.Xml.Linq; |
8 | using WixToolset.Data; | 8 | using WixToolset.Data; |
9 | using WixToolset.Extensibility; | 9 | using WixToolset.Extensibility; |
@@ -28,5 +28,7 @@ namespace WixToolset.Core | |||
28 | public Platform Platform { get; set; } | 28 | public Platform Platform { get; set; } |
29 | 29 | ||
30 | public XDocument Source { get; set; } | 30 | public XDocument Source { get; set; } |
31 | |||
32 | public CancellationToken CancellationToken { get; set; } | ||
31 | } | 33 | } |
32 | } | 34 | } |
diff --git a/src/WixToolset.Core/LayoutContext.cs b/src/WixToolset.Core/LayoutContext.cs index 385aa610..7bbae0c0 100644 --- a/src/WixToolset.Core/LayoutContext.cs +++ b/src/WixToolset.Core/LayoutContext.cs | |||
@@ -2,8 +2,8 @@ | |||
2 | 2 | ||
3 | namespace WixToolset.Core | 3 | namespace WixToolset.Core |
4 | { | 4 | { |
5 | using System; | ||
6 | using System.Collections.Generic; | 5 | using System.Collections.Generic; |
6 | using System.Threading; | ||
7 | using WixToolset.Extensibility; | 7 | using WixToolset.Extensibility; |
8 | using WixToolset.Extensibility.Data; | 8 | using WixToolset.Extensibility.Data; |
9 | using WixToolset.Extensibility.Services; | 9 | using WixToolset.Extensibility.Services; |
@@ -34,5 +34,7 @@ namespace WixToolset.Core | |||
34 | public string BuiltOutputsFile { get; set; } | 34 | public string BuiltOutputsFile { get; set; } |
35 | 35 | ||
36 | public bool SuppressAclReset { get; set; } | 36 | public bool SuppressAclReset { get; set; } |
37 | |||
38 | public CancellationToken CancellationToken { get; set; } | ||
37 | } | 39 | } |
38 | } | 40 | } |
diff --git a/src/WixToolset.Core/LibraryContext.cs b/src/WixToolset.Core/LibraryContext.cs index 4df19702..9fd76cf5 100644 --- a/src/WixToolset.Core/LibraryContext.cs +++ b/src/WixToolset.Core/LibraryContext.cs | |||
@@ -2,8 +2,8 @@ | |||
2 | 2 | ||
3 | namespace WixToolset.Core | 3 | namespace WixToolset.Core |
4 | { | 4 | { |
5 | using System; | ||
6 | using System.Collections.Generic; | 5 | using System.Collections.Generic; |
6 | using System.Threading; | ||
7 | using WixToolset.Data; | 7 | using WixToolset.Data; |
8 | using WixToolset.Extensibility; | 8 | using WixToolset.Extensibility; |
9 | using WixToolset.Extensibility.Data; | 9 | using WixToolset.Extensibility.Data; |
@@ -31,5 +31,7 @@ namespace WixToolset.Core | |||
31 | public IEnumerable<Localization> Localizations { get; set; } | 31 | public IEnumerable<Localization> Localizations { get; set; } |
32 | 32 | ||
33 | public IEnumerable<Intermediate> Intermediates { get; set; } | 33 | public IEnumerable<Intermediate> Intermediates { get; set; } |
34 | |||
35 | public CancellationToken CancellationToken { get; set; } | ||
34 | } | 36 | } |
35 | } | 37 | } |
diff --git a/src/WixToolset.Core/LinkContext.cs b/src/WixToolset.Core/LinkContext.cs index 64dd2320..65b1179e 100644 --- a/src/WixToolset.Core/LinkContext.cs +++ b/src/WixToolset.Core/LinkContext.cs | |||
@@ -2,8 +2,8 @@ | |||
2 | 2 | ||
3 | namespace WixToolset.Core | 3 | namespace WixToolset.Core |
4 | { | 4 | { |
5 | using System; | ||
6 | using System.Collections.Generic; | 5 | using System.Collections.Generic; |
6 | using System.Threading; | ||
7 | using WixToolset.Data; | 7 | using WixToolset.Data; |
8 | using WixToolset.Extensibility; | 8 | using WixToolset.Extensibility; |
9 | using WixToolset.Extensibility.Data; | 9 | using WixToolset.Extensibility.Data; |
@@ -27,5 +27,7 @@ namespace WixToolset.Core | |||
27 | public IEnumerable<Intermediate> Intermediates { get; set; } | 27 | public IEnumerable<Intermediate> Intermediates { get; set; } |
28 | 28 | ||
29 | public ITupleDefinitionCreator TupleDefinitionCreator { get; set; } | 29 | public ITupleDefinitionCreator TupleDefinitionCreator { get; set; } |
30 | |||
31 | public CancellationToken CancellationToken { get; set; } | ||
30 | } | 32 | } |
31 | } | 33 | } |
diff --git a/src/WixToolset.Core/PreprocessContext.cs b/src/WixToolset.Core/PreprocessContext.cs index 15529d24..d273d76b 100644 --- a/src/WixToolset.Core/PreprocessContext.cs +++ b/src/WixToolset.Core/PreprocessContext.cs | |||
@@ -2,8 +2,8 @@ | |||
2 | 2 | ||
3 | namespace WixToolset.Core | 3 | namespace WixToolset.Core |
4 | { | 4 | { |
5 | using System; | ||
6 | using System.Collections.Generic; | 5 | using System.Collections.Generic; |
6 | using System.Threading; | ||
7 | using WixToolset.Data; | 7 | using WixToolset.Data; |
8 | using WixToolset.Extensibility; | 8 | using WixToolset.Extensibility; |
9 | using WixToolset.Extensibility.Data; | 9 | using WixToolset.Extensibility.Data; |
@@ -29,5 +29,7 @@ namespace WixToolset.Core | |||
29 | public IDictionary<string, string> Variables { get; set; } | 29 | public IDictionary<string, string> Variables { get; set; } |
30 | 30 | ||
31 | public SourceLineNumber CurrentSourceLineNumber { get; set; } | 31 | public SourceLineNumber CurrentSourceLineNumber { get; set; } |
32 | |||
33 | public CancellationToken CancellationToken { get; set; } | ||
32 | } | 34 | } |
33 | } | 35 | } |
diff --git a/src/WixToolset.Core/ResolveContext.cs b/src/WixToolset.Core/ResolveContext.cs index 34da34d1..6e1718b6 100644 --- a/src/WixToolset.Core/ResolveContext.cs +++ b/src/WixToolset.Core/ResolveContext.cs | |||
@@ -2,8 +2,8 @@ | |||
2 | 2 | ||
3 | namespace WixToolset.Core | 3 | namespace WixToolset.Core |
4 | { | 4 | { |
5 | using System; | ||
6 | using System.Collections.Generic; | 5 | using System.Collections.Generic; |
6 | using System.Threading; | ||
7 | using WixToolset.Data; | 7 | using WixToolset.Data; |
8 | using WixToolset.Extensibility; | 8 | using WixToolset.Extensibility; |
9 | using WixToolset.Extensibility.Data; | 9 | using WixToolset.Extensibility.Data; |
@@ -35,5 +35,7 @@ namespace WixToolset.Core | |||
35 | public IVariableResolver VariableResolver { get; set; } | 35 | public IVariableResolver VariableResolver { get; set; } |
36 | 36 | ||
37 | public bool AllowUnresolvedVariables { get; set; } | 37 | public bool AllowUnresolvedVariables { get; set; } |
38 | |||
39 | public CancellationToken CancellationToken { get; set; } | ||
38 | } | 40 | } |
39 | } | 41 | } |