aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Extensibility/Services
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2017-12-02 00:45:33 -0800
committerRob Mensching <rob@firegiant.com>2017-12-02 00:45:33 -0800
commitfb2df0e24c0709ce94c396624cf86c70e02da01f (patch)
treee0a16a342dca4f9b343afa945d89116856950b83 /src/WixToolset.Extensibility/Services
parent404f34f00ecce034a8a06fe4757789c6ce62f3f6 (diff)
downloadwix-fb2df0e24c0709ce94c396624cf86c70e02da01f.tar.gz
wix-fb2df0e24c0709ce94c396624cf86c70e02da01f.tar.bz2
wix-fb2df0e24c0709ce94c396624cf86c70e02da01f.zip
Fix IExtensionCommandLine and IPreprocessorExtension
Diffstat (limited to 'src/WixToolset.Extensibility/Services')
-rw-r--r--src/WixToolset.Extensibility/Services/IParseCommandLine.cs21
-rw-r--r--src/WixToolset.Extensibility/Services/IParseHelper.cs9
-rw-r--r--src/WixToolset.Extensibility/Services/IPreprocessHelper.cs89
3 files changed, 118 insertions, 1 deletions
diff --git a/src/WixToolset.Extensibility/Services/IParseCommandLine.cs b/src/WixToolset.Extensibility/Services/IParseCommandLine.cs
new file mode 100644
index 00000000..1b23be14
--- /dev/null
+++ b/src/WixToolset.Extensibility/Services/IParseCommandLine.cs
@@ -0,0 +1,21 @@
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 System.Collections.Generic;
6
7 public interface IParseCommandLine
8 {
9 bool IsSwitch(string arg);
10
11 bool IsSwitchAt(IEnumerable<string> args, int index);
12
13 void GetNextArgumentOrError(ref string arg);
14
15 void GetNextArgumentOrError(IList<string> args);
16
17 void GetNextArgumentAsFilePathOrError(IList<string> args, string fileType);
18
19 bool TryGetNextArgumentOrError(out string arg);
20 }
21}
diff --git a/src/WixToolset.Extensibility/Services/IParseHelper.cs b/src/WixToolset.Extensibility/Services/IParseHelper.cs
index 46ade2e1..ad15c063 100644
--- a/src/WixToolset.Extensibility/Services/IParseHelper.cs
+++ b/src/WixToolset.Extensibility/Services/IParseHelper.cs
@@ -8,7 +8,7 @@ namespace WixToolset.Extensibility.Services
8 using WixToolset.Data; 8 using WixToolset.Data;
9 9
10 /// <summary> 10 /// <summary>
11 /// Core interface provided by the compiler. 11 /// Interface provided to help compiler extensions parse.
12 /// </summary> 12 /// </summary>
13 public interface IParseHelper 13 public interface IParseHelper
14 { 14 {
@@ -243,6 +243,13 @@ namespace WixToolset.Extensibility.Services
243 YesNoDefaultType GetAttributeYesNoDefaultValue(SourceLineNumber sourceLineNumbers, XAttribute attribute); 243 YesNoDefaultType GetAttributeYesNoDefaultValue(SourceLineNumber sourceLineNumbers, XAttribute attribute);
244 244
245 /// <summary> 245 /// <summary>
246 /// Gets a source line number for an element.
247 /// </summary>
248 /// <param name="element">Element to get source line number.</param>
249 /// <returns>Source line number.</returns>
250 SourceLineNumber GetSourceLineNumbers(XElement element);
251
252 /// <summary>
246 /// Gets node's inner text and ensure's it is safe for use in a condition by trimming any extra whitespace. 253 /// Gets node's inner text and ensure's it is safe for use in a condition by trimming any extra whitespace.
247 /// </summary> 254 /// </summary>
248 /// <param name="node">The node to ensure inner text is a condition.</param> 255 /// <param name="node">The node to ensure inner text is a condition.</param>
diff --git a/src/WixToolset.Extensibility/Services/IPreprocessHelper.cs b/src/WixToolset.Extensibility/Services/IPreprocessHelper.cs
new file mode 100644
index 00000000..01c55009
--- /dev/null
+++ b/src/WixToolset.Extensibility/Services/IPreprocessHelper.cs
@@ -0,0 +1,89 @@
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 System.Xml.Linq;
6
7 /// <summary>
8 /// Interface provided to help preprocessor extensions.
9 /// </summary>
10 public interface IPreprocessHelper
11 {
12 /// <summary>
13 /// Add a variable.
14 /// </summary>
15 /// <param name="context">The preprocess context.</param>
16 /// <param name="name">The variable name.</param>
17 /// <param name="value">The variable value.</param>
18 void AddVariable(IPreprocessContext context, string name, string value);
19
20 /// <summary>
21 /// Add a variable.
22 /// </summary>
23 /// <param name="context">The preprocess context.</param>
24 /// <param name="name">The variable name.</param>
25 /// <param name="value">The variable value.</param>
26 /// <param name="overwrite">Set to true to show variable overwrite warning.</param>
27 void AddVariable(IPreprocessContext context, string name, string value, bool showWarning);
28
29 /// <summary>
30 /// Evaluate a function.
31 /// </summary>
32 /// <param name="context">The preprocess context.</param>
33 /// <param name="function">The function expression including the prefix and name.</param>
34 /// <returns>The function value.</returns>
35 string EvaluateFunction(IPreprocessContext context, string function);
36
37 /// <summary>
38 /// Evaluate a function.
39 /// </summary>
40 /// <param name="context">The preprocess context.</param>
41 /// <param name="prefix">The function prefix.</param>
42 /// <param name="function">The function name.</param>
43 /// <param name="args">The arguments for the function.</param>
44 /// <returns>The function value or null if the function is not defined.</returns>
45 string EvaluateFunction(IPreprocessContext context, string prefix, string function, string[] args);
46
47 /// <summary>
48 /// Get the value of a variable expression like var.name.
49 /// </summary>
50 /// <param name="context">The preprocess context.</param>
51 /// <param name="variable">The variable expression including the optional prefix and name.</param>
52 /// <param name="allowMissingPrefix">true to allow the variable prefix to be missing.</param>
53 /// <returns>The variable value.</returns>
54 string GetVariableValue(IPreprocessContext context, string variable, bool allowMissingPrefix);
55
56 /// <summary>
57 /// Get the value of a variable.
58 /// </summary>
59 /// <param name="context">The preprocess context.</param>
60 /// <param name="prefix">The variable prefix.</param>
61 /// <param name="name">The variable name.</param>
62 /// <returns>The variable value or null if the variable is not set.</returns>
63 string GetVariableValue(IPreprocessContext context, string prefix, string name);
64
65 /// <summary>
66 /// Evaluate a Pragma.
67 /// </summary>
68 /// <param name="context">The preprocess context.</param>
69 /// <param name="pragmaName">The pragma's full name (<prefix>.<pragma>).</param>
70 /// <param name="args">The arguments to the pragma.</param>
71 /// <param name="parent">The parent element of the pragma.</param>
72 void PreprocessPragma(IPreprocessContext context, string pragmaName, string args, XContainer parent);
73
74 /// <summary>
75 /// Replaces parameters in the source text.
76 /// </summary>
77 /// <param name="context">The preprocess context.</param>
78 /// <param name="value">Text that may contain parameters to replace.</param>
79 /// <returns>Text after parameters have been replaced.</returns>
80 string PreprocessString(IPreprocessContext context, string value);
81
82 /// <summary>
83 /// Remove a variable.
84 /// </summary>
85 /// <param name="context">The preprocess context.</param>
86 /// <param name="name">The variable name.</param>
87 void RemoveVariable(IPreprocessContext context, string name);
88 }
89}