aboutsummaryrefslogtreecommitdiff
path: root/src/tools/heat/Program.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/tools/heat/Program.cs88
1 files changed, 0 insertions, 88 deletions
diff --git a/src/tools/heat/Program.cs b/src/tools/heat/Program.cs
deleted file mode 100644
index 80423e18..00000000
--- a/src/tools/heat/Program.cs
+++ /dev/null
@@ -1,88 +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
3namespace WixToolset.Tools.Heat
4{
5 using System;
6 using System.Runtime.InteropServices;
7 using System.Threading;
8 using System.Threading.Tasks;
9 using WixToolset.Core;
10 using WixToolset.Data;
11 using WixToolset.Extensibility;
12 using WixToolset.Extensibility.Data;
13 using WixToolset.Extensibility.Services;
14 using WixToolset.Harvesters;
15 using WixToolset.Harvesters.Data;
16 using WixToolset.Harvesters.Extensibility;
17 using WixToolset.Tools.Core;
18
19 /// <summary>
20 /// Wix Toolset Harvester.
21 /// </summary>
22 public sealed class Program
23 {
24 /// <summary>
25 /// The main entry point for the application.
26 /// </summary>
27 /// <param name="args">Commandline arguments for the application.</param>
28 /// <returns>Returns the application error code.</returns>
29 [MTAThread]
30 public static async Task<int> Main(string[] args)
31 {
32 var serviceProvider = WixToolsetServiceProviderFactory.CreateServiceProvider();
33 var listener = new ConsoleMessageListener("HEAT", "heat.exe");
34
35 try
36 {
37 var program = new Program();
38 return await program.Run(serviceProvider, listener, args);
39 }
40 catch (WixException e)
41 {
42 listener.Write(e.Error);
43
44 return e.Error.Id;
45 }
46 catch (Exception e)
47 {
48 listener.Write(ErrorMessages.UnexpectedException(e));
49
50 if (e is NullReferenceException || e is SEHException)
51 {
52 throw;
53 }
54
55 return e.HResult;
56 }
57 }
58
59 /// <summary>
60 /// Run the application with the given arguments.
61 /// </summary>
62 /// <param name="serviceProvider">Service provider to use throughout this execution.</param>
63 /// <param name="args">The commandline arguments.</param>
64 /// <returns>Returns the application error code.</returns>
65 public Task<int> Run(IServiceProvider serviceProvider, IMessageListener listener, string[] args)
66 {
67 var messaging = serviceProvider.GetService<IMessaging>();
68 messaging.SetListener(listener);
69
70 var arguments = serviceProvider.GetService<ICommandLineArguments>();
71 arguments.Populate(args);
72
73 var extensionManager = serviceProvider.GetService<IExtensionManager>();
74 foreach (var extension in arguments.Extensions)
75 {
76 extensionManager.Load(extension);
77 }
78 var heatExtensions = extensionManager.GetServices<IHeatExtension>();
79
80 var commandLine = HeatCommandLineFactory.CreateCommandLine(serviceProvider, heatExtensions);
81 var command = commandLine.ParseStandardCommandLine(arguments);
82
83 messaging.Write(HarvesterWarnings.HeatIsDeprecated());
84
85 return command?.ExecuteAsync(CancellationToken.None) ?? Task.FromResult(1);
86 }
87 }
88}