diff options
| author | Rob Mensching <rob@firegiant.com> | 2018-07-21 07:36:34 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2018-07-21 07:36:34 -0700 |
| commit | 306f1d0c528cb6c151594ff96a41b5c01a5c4d9b (patch) | |
| tree | 95deb0884b59decc082eae7adf5d65d45c5f3848 /src/WixToolset.BuildTasks/HeatTask.cs | |
| parent | 6fc54af07b10742e883f3a39ef0114e55e6a36a0 (diff) | |
| download | wix-306f1d0c528cb6c151594ff96a41b5c01a5c4d9b.tar.gz wix-306f1d0c528cb6c151594ff96a41b5c01a5c4d9b.tar.bz2 wix-306f1d0c528cb6c151594ff96a41b5c01a5c4d9b.zip | |
Integrate tools from Core project
Diffstat (limited to 'src/WixToolset.BuildTasks/HeatTask.cs')
| -rw-r--r-- | src/WixToolset.BuildTasks/HeatTask.cs | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/src/WixToolset.BuildTasks/HeatTask.cs b/src/WixToolset.BuildTasks/HeatTask.cs new file mode 100644 index 00000000..bf0a2ad3 --- /dev/null +++ b/src/WixToolset.BuildTasks/HeatTask.cs | |||
| @@ -0,0 +1,121 @@ | |||
| 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.BuildTasks | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.Diagnostics; | ||
| 7 | using System.Globalization; | ||
| 8 | using System.IO; | ||
| 9 | using System.Text; | ||
| 10 | |||
| 11 | using Microsoft.Build.Framework; | ||
| 12 | using Microsoft.Build.Utilities; | ||
| 13 | |||
| 14 | /// <summary> | ||
| 15 | /// A base MSBuild task to run the WiX harvester. | ||
| 16 | /// Specific harvester tasks should extend this class. | ||
| 17 | /// </summary> | ||
| 18 | public abstract class HeatTask : WixToolTask | ||
| 19 | { | ||
| 20 | private const string HeatToolName = "Heat.exe"; | ||
| 21 | |||
| 22 | private bool autogenerageGuids; | ||
| 23 | private bool generateGuidsNow; | ||
| 24 | private ITaskItem outputFile; | ||
| 25 | private bool suppressFragments; | ||
| 26 | private bool suppressUniqueIds; | ||
| 27 | private string[] transforms; | ||
| 28 | |||
| 29 | public bool AutogenerateGuids | ||
| 30 | { | ||
| 31 | get { return this.autogenerageGuids; } | ||
| 32 | set { this.autogenerageGuids = value; } | ||
| 33 | } | ||
| 34 | |||
| 35 | public bool GenerateGuidsNow | ||
| 36 | { | ||
| 37 | get { return this.generateGuidsNow; } | ||
| 38 | set { this.generateGuidsNow = value; } | ||
| 39 | } | ||
| 40 | |||
| 41 | [Required] | ||
| 42 | [Output] | ||
| 43 | public ITaskItem OutputFile | ||
| 44 | { | ||
| 45 | get { return this.outputFile; } | ||
| 46 | set { this.outputFile = value; } | ||
| 47 | } | ||
| 48 | |||
| 49 | public bool SuppressFragments | ||
| 50 | { | ||
| 51 | get { return this.suppressFragments; } | ||
| 52 | set { this.suppressFragments = value; } | ||
| 53 | } | ||
| 54 | |||
| 55 | public bool SuppressUniqueIds | ||
| 56 | { | ||
| 57 | get { return this.suppressUniqueIds; } | ||
| 58 | set { this.suppressUniqueIds = value; } | ||
| 59 | } | ||
| 60 | |||
| 61 | public string[] Transforms | ||
| 62 | { | ||
| 63 | get { return this.transforms; } | ||
| 64 | set { this.transforms = value; } | ||
| 65 | } | ||
| 66 | |||
| 67 | /// <summary> | ||
| 68 | /// Get the name of the executable. | ||
| 69 | /// </summary> | ||
| 70 | /// <remarks>The ToolName is used with the ToolPath to get the location of heat.exe.</remarks> | ||
| 71 | /// <value>The name of the executable.</value> | ||
| 72 | protected override string ToolName | ||
| 73 | { | ||
| 74 | get { return HeatToolName; } | ||
| 75 | } | ||
| 76 | |||
| 77 | /// <summary> | ||
| 78 | /// Gets the name of the heat operation performed by the task. | ||
| 79 | /// </summary> | ||
| 80 | /// <remarks>This is the first parameter passed on the heat.exe command-line.</remarks> | ||
| 81 | /// <value>The name of the heat operation performed by the task.</value> | ||
| 82 | protected abstract string OperationName | ||
| 83 | { | ||
| 84 | get; | ||
| 85 | } | ||
| 86 | |||
| 87 | /// <summary> | ||
| 88 | /// Get the path to the executable. | ||
| 89 | /// </summary> | ||
| 90 | /// <remarks>GetFullPathToTool is only called when the ToolPath property is not set (see the ToolName remarks above).</remarks> | ||
| 91 | /// <returns>The full path to the executable or simply heat.exe if it's expected to be in the system path.</returns> | ||
| 92 | protected override string GenerateFullPathToTool() | ||
| 93 | { | ||
| 94 | // If there's not a ToolPath specified, it has to be in the system path. | ||
| 95 | if (String.IsNullOrEmpty(this.ToolPath)) | ||
| 96 | { | ||
| 97 | return HeatToolName; | ||
| 98 | } | ||
| 99 | |||
| 100 | return Path.Combine(Path.GetFullPath(this.ToolPath), HeatToolName); | ||
| 101 | } | ||
| 102 | |||
| 103 | /// <summary> | ||
| 104 | /// Builds a command line from options in this task. | ||
| 105 | /// </summary> | ||
| 106 | protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilder) | ||
| 107 | { | ||
| 108 | base.BuildCommandLine(commandLineBuilder); | ||
| 109 | |||
| 110 | commandLineBuilder.AppendIfTrue("-ag", this.AutogenerateGuids); | ||
| 111 | commandLineBuilder.AppendIfTrue("-gg", this.GenerateGuidsNow); | ||
| 112 | commandLineBuilder.AppendIfTrue("-nologo", this.NoLogo); | ||
| 113 | commandLineBuilder.AppendIfTrue("-sfrag", this.SuppressFragments); | ||
| 114 | commandLineBuilder.AppendIfTrue("-suid", this.SuppressUniqueIds); | ||
| 115 | commandLineBuilder.AppendArrayIfNotNull("-sw", this.SuppressSpecificWarnings); | ||
| 116 | commandLineBuilder.AppendArrayIfNotNull("-t ", this.Transforms); | ||
| 117 | commandLineBuilder.AppendTextIfNotNull(this.AdditionalOptions); | ||
| 118 | commandLineBuilder.AppendSwitchIfNotNull("-out ", this.OutputFile); | ||
| 119 | } | ||
| 120 | } | ||
| 121 | } | ||
