diff options
author | Rob Mensching <rob@firegiant.com> | 2022-07-26 17:20:39 -0700 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2022-08-01 20:25:19 -0700 |
commit | a627ca9b720047e633a8fe72003ab9bee31006c5 (patch) | |
tree | 2bc8a924bb4141ab718e74d08f6459a0ffe8d573 /src/tools/WixToolset.HeatTasks/WixCommandLineBuilder.cs | |
parent | 521eb3c9cf38823a2c4019abb85dc0b3200b92cb (diff) | |
download | wix-a627ca9b720047e633a8fe72003ab9bee31006c5.tar.gz wix-a627ca9b720047e633a8fe72003ab9bee31006c5.tar.bz2 wix-a627ca9b720047e633a8fe72003ab9bee31006c5.zip |
Create WixToolset.Heat.nupkg to distribute heat.exe and Heat targets
Moves Heat functionality to the "tools" layer and packages it all
up in WixToolset.Heat.nupkg for distribution in WiX v4.
Completes 6838
Diffstat (limited to 'src/tools/WixToolset.HeatTasks/WixCommandLineBuilder.cs')
-rw-r--r-- | src/tools/WixToolset.HeatTasks/WixCommandLineBuilder.cs | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/tools/WixToolset.HeatTasks/WixCommandLineBuilder.cs b/src/tools/WixToolset.HeatTasks/WixCommandLineBuilder.cs new file mode 100644 index 00000000..c3989902 --- /dev/null +++ b/src/tools/WixToolset.HeatTasks/WixCommandLineBuilder.cs | |||
@@ -0,0 +1,56 @@ | |||
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.HeatTasks | ||
4 | { | ||
5 | using System; | ||
6 | using System.Collections.Generic; | ||
7 | using Microsoft.Build.Utilities; | ||
8 | |||
9 | /// <summary> | ||
10 | /// Helper class for appending the command line arguments. | ||
11 | /// </summary> | ||
12 | public class WixCommandLineBuilder : CommandLineBuilder | ||
13 | { | ||
14 | /// <summary> | ||
15 | /// Append a switch to the command line if the condition is true. | ||
16 | /// </summary> | ||
17 | /// <param name="switchName">Switch to append.</param> | ||
18 | /// <param name="condition">Condition specified by the user.</param> | ||
19 | public void AppendIfTrue(string switchName, bool condition) | ||
20 | { | ||
21 | if (condition) | ||
22 | { | ||
23 | this.AppendSwitch(switchName); | ||
24 | } | ||
25 | } | ||
26 | |||
27 | /// <summary> | ||
28 | /// Append a switch to the command line if any values in the array have been specified. | ||
29 | /// </summary> | ||
30 | /// <param name="switchName">Switch to append.</param> | ||
31 | /// <param name="values">Values specified by the user.</param> | ||
32 | public void AppendArrayIfNotNull(string switchName, IEnumerable<string> values) | ||
33 | { | ||
34 | if (values != null) | ||
35 | { | ||
36 | foreach (var value in values) | ||
37 | { | ||
38 | this.AppendSwitchIfNotNull(switchName, value); | ||
39 | } | ||
40 | } | ||
41 | } | ||
42 | |||
43 | /// <summary> | ||
44 | /// Append arbitrary text to the command-line if specified. | ||
45 | /// </summary> | ||
46 | /// <param name="textToAppend">Text to append.</param> | ||
47 | public void AppendTextIfNotNull(string textToAppend) | ||
48 | { | ||
49 | if (!String.IsNullOrWhiteSpace(textToAppend)) | ||
50 | { | ||
51 | this.AppendSpaceIfNotEmpty(); | ||
52 | this.AppendTextUnquoted(textToAppend); | ||
53 | } | ||
54 | } | ||
55 | } | ||
56 | } | ||