aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2017-12-19 12:24:49 -0800
committerRob Mensching <rob@firegiant.com>2017-12-19 12:24:49 -0800
commit46a4f1d98fdedc82c701ada198252dfd6099959f (patch)
treeafa6a48a83cc1294aa8a923277bfa763e9de6c87
parent54cacc5653a0c8a053d6641badf4470d1b54e865 (diff)
downloadwix-46a4f1d98fdedc82c701ada198252dfd6099959f.tar.gz
wix-46a4f1d98fdedc82c701ada198252dfd6099959f.tar.bz2
wix-46a4f1d98fdedc82c701ada198252dfd6099959f.zip
Integrate simplified message handling
-rw-r--r--src/WixToolset.Extensibility/BaseCompilerExtension.cs2
-rw-r--r--src/WixToolset.Extensibility/IBinderFileManagerCore.cs2
-rw-r--r--src/WixToolset.Extensibility/ICompileContext.cs3
-rw-r--r--src/WixToolset.Extensibility/IDecompilerCore.cs2
-rw-r--r--src/WixToolset.Extensibility/IInscribeContext.cs6
-rw-r--r--src/WixToolset.Extensibility/IInspectorCore.cs4
-rw-r--r--src/WixToolset.Extensibility/ILibraryContext.cs3
-rw-r--r--src/WixToolset.Extensibility/IMessageListener.cs17
-rw-r--r--src/WixToolset.Extensibility/IPreprocessContext.cs3
-rw-r--r--src/WixToolset.Extensibility/IUnbindContext.cs9
-rw-r--r--src/WixToolset.Extensibility/Services/IBindContext.cs2
-rw-r--r--src/WixToolset.Extensibility/Services/ICommandLineContext.cs3
-rw-r--r--src/WixToolset.Extensibility/Services/ILinkContext.cs2
-rw-r--r--src/WixToolset.Extensibility/Services/IMessaging.cs80
14 files changed, 119 insertions, 19 deletions
diff --git a/src/WixToolset.Extensibility/BaseCompilerExtension.cs b/src/WixToolset.Extensibility/BaseCompilerExtension.cs
index 5dfe5dcf..0f386e28 100644
--- a/src/WixToolset.Extensibility/BaseCompilerExtension.cs
+++ b/src/WixToolset.Extensibility/BaseCompilerExtension.cs
@@ -15,7 +15,7 @@ namespace WixToolset.Extensibility
15 /// <summary> 15 /// <summary>
16 /// Messaging for use by the extension. 16 /// Messaging for use by the extension.
17 /// </summary> 17 /// </summary>
18 protected Messaging Messaging { get; private set; } 18 protected IMessaging Messaging { get; private set; }
19 19
20 /// <summary> 20 /// <summary>
21 /// ParserHelper for use by the extension. 21 /// ParserHelper for use by the extension.
diff --git a/src/WixToolset.Extensibility/IBinderFileManagerCore.cs b/src/WixToolset.Extensibility/IBinderFileManagerCore.cs
index b73acb6b..27644413 100644
--- a/src/WixToolset.Extensibility/IBinderFileManagerCore.cs
+++ b/src/WixToolset.Extensibility/IBinderFileManagerCore.cs
@@ -6,7 +6,7 @@ namespace WixToolset.Extensibility
6 using WixToolset.Data; 6 using WixToolset.Data;
7 using WixToolset.Data.Bind; 7 using WixToolset.Data.Bind;
8 8
9 public interface IBinderFileManagerCore : IMessageHandler 9 public interface IBinderFileManagerCore
10 { 10 {
11 /// <summary> 11 /// <summary>
12 /// Gets or sets the path to cabinet cache. 12 /// Gets or sets the path to cabinet cache.
diff --git a/src/WixToolset.Extensibility/ICompileContext.cs b/src/WixToolset.Extensibility/ICompileContext.cs
index bd0d0a4b..fbe38d63 100644
--- a/src/WixToolset.Extensibility/ICompileContext.cs
+++ b/src/WixToolset.Extensibility/ICompileContext.cs
@@ -6,12 +6,13 @@ namespace WixToolset.Extensibility
6 using System.Collections.Generic; 6 using System.Collections.Generic;
7 using System.Xml.Linq; 7 using System.Xml.Linq;
8 using WixToolset.Data; 8 using WixToolset.Data;
9 using WixToolset.Extensibility.Services;
9 10
10 public interface ICompileContext 11 public interface ICompileContext
11 { 12 {
12 IServiceProvider ServiceProvider { get; } 13 IServiceProvider ServiceProvider { get; }
13 14
14 Messaging Messaging { get; set; } 15 IMessaging Messaging { get; set; }
15 16
16 string CompilationId { get; set; } 17 string CompilationId { get; set; }
17 18
diff --git a/src/WixToolset.Extensibility/IDecompilerCore.cs b/src/WixToolset.Extensibility/IDecompilerCore.cs
index 1c367e0c..2133829a 100644
--- a/src/WixToolset.Extensibility/IDecompilerCore.cs
+++ b/src/WixToolset.Extensibility/IDecompilerCore.cs
@@ -6,7 +6,7 @@ namespace WixToolset.Extensibility
6 using WixToolset.Data; 6 using WixToolset.Data;
7 using Wix = WixToolset.Data.Serialize; 7 using Wix = WixToolset.Data.Serialize;
8 8
9 public interface IDecompilerCore : IMessageHandler 9 public interface IDecompilerCore
10 { 10 {
11 11
12 /// <summary> 12 /// <summary>
diff --git a/src/WixToolset.Extensibility/IInscribeContext.cs b/src/WixToolset.Extensibility/IInscribeContext.cs
index 6294271e..7f741024 100644
--- a/src/WixToolset.Extensibility/IInscribeContext.cs
+++ b/src/WixToolset.Extensibility/IInscribeContext.cs
@@ -3,18 +3,18 @@
3namespace WixToolset.Extensibility 3namespace WixToolset.Extensibility
4{ 4{
5 using System; 5 using System;
6 using WixToolset.Data; 6 using WixToolset.Extensibility.Services;
7 7
8 public interface IInscribeContext 8 public interface IInscribeContext
9 { 9 {
10 IServiceProvider ServiceProvider { get; } 10 IServiceProvider ServiceProvider { get; }
11 11
12 IMessaging Messaging { get; set; }
13
12 string InputFilePath { get; set; } 14 string InputFilePath { get; set; }
13 15
14 string IntermediateFolder { get; set; } 16 string IntermediateFolder { get; set; }
15 17
16 Messaging Messaging { get; }
17
18 string OutputFile { get; set; } 18 string OutputFile { get; set; }
19 19
20 string SignedEngineFile { get; set; } 20 string SignedEngineFile { get; set; }
diff --git a/src/WixToolset.Extensibility/IInspectorCore.cs b/src/WixToolset.Extensibility/IInspectorCore.cs
index 06239ce5..9420ea05 100644
--- a/src/WixToolset.Extensibility/IInspectorCore.cs
+++ b/src/WixToolset.Extensibility/IInspectorCore.cs
@@ -2,12 +2,10 @@
2 2
3namespace WixToolset.Extensibility 3namespace WixToolset.Extensibility
4{ 4{
5 using WixToolset.Data;
6
7 /// <summary> 5 /// <summary>
8 /// Core facilities for inspector extensions. 6 /// Core facilities for inspector extensions.
9 /// </summary> 7 /// </summary>
10 public interface IInspectorCore : IMessageHandler 8 public interface IInspectorCore
11 { 9 {
12 /// <summary> 10 /// <summary>
13 /// Gets whether an error occured. 11 /// Gets whether an error occured.
diff --git a/src/WixToolset.Extensibility/ILibraryContext.cs b/src/WixToolset.Extensibility/ILibraryContext.cs
index b8c1887a..e715080f 100644
--- a/src/WixToolset.Extensibility/ILibraryContext.cs
+++ b/src/WixToolset.Extensibility/ILibraryContext.cs
@@ -5,12 +5,13 @@ namespace WixToolset.Extensibility
5 using System; 5 using System;
6 using System.Collections.Generic; 6 using System.Collections.Generic;
7 using WixToolset.Data; 7 using WixToolset.Data;
8 using WixToolset.Extensibility.Services;
8 9
9 public interface ILibraryContext 10 public interface ILibraryContext
10 { 11 {
11 IServiceProvider ServiceProvider { get; } 12 IServiceProvider ServiceProvider { get; }
12 13
13 Messaging Messaging { get; set; } 14 IMessaging Messaging { get; set; }
14 15
15 bool BindFiles { get; set; } 16 bool BindFiles { get; set; }
16 17
diff --git a/src/WixToolset.Extensibility/IMessageListener.cs b/src/WixToolset.Extensibility/IMessageListener.cs
new file mode 100644
index 00000000..91e3da31
--- /dev/null
+++ b/src/WixToolset.Extensibility/IMessageListener.cs
@@ -0,0 +1,17 @@
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.Extensibility
4{
5 using WixToolset.Data;
6
7 public interface IMessageListener
8 {
9 string ShortAppName { get; }
10
11 string LongAppName { get; }
12
13 void Write(Message message);
14
15 void Write(string message);
16 }
17}
diff --git a/src/WixToolset.Extensibility/IPreprocessContext.cs b/src/WixToolset.Extensibility/IPreprocessContext.cs
index 0f9c90bf..2e288d59 100644
--- a/src/WixToolset.Extensibility/IPreprocessContext.cs
+++ b/src/WixToolset.Extensibility/IPreprocessContext.cs
@@ -5,12 +5,13 @@ namespace WixToolset.Extensibility
5 using System; 5 using System;
6 using System.Collections.Generic; 6 using System.Collections.Generic;
7 using WixToolset.Data; 7 using WixToolset.Data;
8 using WixToolset.Extensibility.Services;
8 9
9 public interface IPreprocessContext 10 public interface IPreprocessContext
10 { 11 {
11 IServiceProvider ServiceProvider { get; } 12 IServiceProvider ServiceProvider { get; }
12 13
13 Messaging Messaging { get; set; } 14 IMessaging Messaging { get; set; }
14 15
15 IEnumerable<IPreprocessorExtension> Extensions { get; set; } 16 IEnumerable<IPreprocessorExtension> Extensions { get; set; }
16 17
diff --git a/src/WixToolset.Extensibility/IUnbindContext.cs b/src/WixToolset.Extensibility/IUnbindContext.cs
index 82364652..beaa5491 100644
--- a/src/WixToolset.Extensibility/IUnbindContext.cs
+++ b/src/WixToolset.Extensibility/IUnbindContext.cs
@@ -2,10 +2,15 @@
2 2
3namespace WixToolset.Extensibility 3namespace WixToolset.Extensibility
4{ 4{
5 using WixToolset.Data; 5 using System;
6 using WixToolset.Extensibility.Services;
6 7
7 public interface IUnbindContext 8 public interface IUnbindContext
8 { 9 {
10 IServiceProvider ServiceProvider { get; }
11
12 IMessaging Messaging { get; set; }
13
9 string ExportBasePath { get; set; } 14 string ExportBasePath { get; set; }
10 15
11 string InputFilePath { get; set; } 16 string InputFilePath { get; set; }
@@ -14,8 +19,6 @@ namespace WixToolset.Extensibility
14 19
15 bool IsAdminImage { get; set; } 20 bool IsAdminImage { get; set; }
16 21
17 Messaging Messaging { get; }
18
19 bool SuppressDemodularization { get; set; } 22 bool SuppressDemodularization { get; set; }
20 23
21 bool SuppressExtractCabinets { get; set; } 24 bool SuppressExtractCabinets { get; set; }
diff --git a/src/WixToolset.Extensibility/Services/IBindContext.cs b/src/WixToolset.Extensibility/Services/IBindContext.cs
index 6bed0ef6..ad1aa818 100644
--- a/src/WixToolset.Extensibility/Services/IBindContext.cs
+++ b/src/WixToolset.Extensibility/Services/IBindContext.cs
@@ -10,7 +10,7 @@ namespace WixToolset.Extensibility.Services
10 { 10 {
11 IServiceProvider ServiceProvider { get; } 11 IServiceProvider ServiceProvider { get; }
12 12
13 Messaging Messaging { get; set; } 13 IMessaging Messaging { get; set; }
14 14
15 IEnumerable<BindPath> BindPaths { get; set; } 15 IEnumerable<BindPath> BindPaths { get; set; }
16 16
diff --git a/src/WixToolset.Extensibility/Services/ICommandLineContext.cs b/src/WixToolset.Extensibility/Services/ICommandLineContext.cs
index 0e040d7f..27d4e6dd 100644
--- a/src/WixToolset.Extensibility/Services/ICommandLineContext.cs
+++ b/src/WixToolset.Extensibility/Services/ICommandLineContext.cs
@@ -3,13 +3,12 @@
3namespace WixToolset.Extensibility.Services 3namespace WixToolset.Extensibility.Services
4{ 4{
5 using System; 5 using System;
6 using WixToolset.Data;
7 6
8 public interface ICommandLineContext 7 public interface ICommandLineContext
9 { 8 {
10 IServiceProvider ServiceProvider { get; } 9 IServiceProvider ServiceProvider { get; }
11 10
12 Messaging Messaging { get; set; } 11 IMessaging Messaging { get; set; }
13 12
14 IExtensionManager ExtensionManager { get; set; } 13 IExtensionManager ExtensionManager { get; set; }
15 14
diff --git a/src/WixToolset.Extensibility/Services/ILinkContext.cs b/src/WixToolset.Extensibility/Services/ILinkContext.cs
index 25c7962f..e098a900 100644
--- a/src/WixToolset.Extensibility/Services/ILinkContext.cs
+++ b/src/WixToolset.Extensibility/Services/ILinkContext.cs
@@ -10,7 +10,7 @@ namespace WixToolset.Extensibility.Services
10 { 10 {
11 IServiceProvider ServiceProvider { get; } 11 IServiceProvider ServiceProvider { get; }
12 12
13 Messaging Messaging { get; set; } 13 IMessaging Messaging { get; set; }
14 14
15 IEnumerable<ILinkerExtension> Extensions { get; set; } 15 IEnumerable<ILinkerExtension> Extensions { get; set; }
16 16
diff --git a/src/WixToolset.Extensibility/Services/IMessaging.cs b/src/WixToolset.Extensibility/Services/IMessaging.cs
new file mode 100644
index 00000000..901c7af4
--- /dev/null
+++ b/src/WixToolset.Extensibility/Services/IMessaging.cs
@@ -0,0 +1,80 @@
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.Extensibility.Services
4{
5 using WixToolset.Data;
6
7 /// <summary>
8 /// Interface for handling messages (error/warning/verbose).
9 /// </summary>
10 public interface IMessaging
11 {
12 /// <summary>
13 /// Indicates whether an error has been found.
14 /// </summary>
15 /// <value>A bool indicating whether an error has been found.</value>
16 bool EncounteredError { get; }
17
18 /// <summary>
19 /// Gets the last error code encountered during messaging.
20 /// </summary>
21 /// <value>The exit code for the process.</value>
22 int LastErrorNumber { get; }
23
24 /// <summary>
25 /// Gets or sets the option to show verbose messages.
26 /// </summary>
27 /// <value>The option to show verbose messages.</value>
28 bool ShowVerboseMessages { get; set; }
29
30 /// <summary>
31 /// Gets or sets the option to suppress all warning messages.
32 /// </summary>
33 /// <value>The option to suppress all warning messages.</value>
34 bool SuppressAllWarnings { get; set; }
35
36 /// <summary>
37 /// Gets and sets the option to treat warnings as errors.
38 /// </summary>
39 /// <value>The option to treat warnings as errors.</value>
40 bool WarningsAsError { get; set; }
41
42 /// <summary>
43 /// Sets the listener for messaging.
44 /// </summary>
45 /// <param name="listener"></param>
46 void SetListener(IMessageListener listener);
47
48 /// <summary>
49 /// Adds a warning message id to be elevated to an error message.
50 /// </summary>
51 /// <param name="warningNumber">Id of the message to elevate.</param>
52 void ElevateWarningMessage(int warningNumber);
53
54 /// <summary>
55 /// Adds a warning message id to be suppressed in message output.
56 /// </summary>
57 /// <param name="warningNumber">Id of the message to suppress.</param>
58 void SuppressWarningMessage(int warningNumber);
59
60 /// <summary>
61 /// Formats a message to standard message.
62 /// </summary>
63 /// <param name="message">Message to format.</param>
64 /// <returns>Formatted message</returns>
65 string FormatMessage(Message message);
66
67 /// <summary>
68 /// Sends a message with the given arguments.
69 /// </summary>
70 /// <param name="message">Message to write.</param>
71 void Write(Message message);
72
73 /// <summary>
74 /// Sends a message with the given arguments.
75 /// </summary>
76 /// <param name="message">Message to write.</param>
77 /// <param name="verbose">Indicates where to write a verbose message.</param>
78 void Write(string message, bool verbose = false);
79 }
80}