| 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 Microsoft.Build.Framework; |
| 6 | using WixToolset.BaseBuildTasks; |
| 7 | |
| 8 | /// <summary> |
| 9 | /// A base MSBuild task to run the WiX harvester. |
| 10 | /// Specific harvester tasks should extend this class. |
| 11 | /// </summary> |
| 12 | public abstract partial class HeatTask : BaseToolsetTask |
| 13 | { |
| 14 | public bool AutogenerateGuids { get; set; } |
| 15 | |
| 16 | public bool GenerateGuidsNow { get; set; } |
| 17 | |
| 18 | [Required] |
| 19 | [Output] |
| 20 | public ITaskItem OutputFile { get; set; } |
| 21 | |
| 22 | public bool SuppressFragments { get; set; } |
| 23 | |
| 24 | public bool SuppressUniqueIds { get; set; } |
| 25 | |
| 26 | public string[] Transforms { get; set; } |
| 27 | |
| 28 | /// <summary> |
| 29 | /// Gets the name of the heat operation performed by the task. |
| 30 | /// </summary> |
| 31 | /// <remarks>This is the first parameter passed on the heat.exe command-line.</remarks> |
| 32 | /// <value>The name of the heat operation performed by the task.</value> |
| 33 | protected abstract string OperationName { get; } |
| 34 | |
| 35 | protected sealed override string ToolName => "heat.exe"; |
| 36 | |
| 37 | /// <summary> |
| 38 | /// Builds a command line from options in this task. |
| 39 | /// </summary> |
| 40 | protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilder) |
| 41 | { |
| 42 | base.BuildCommandLine(commandLineBuilder); |
| 43 | |
| 44 | commandLineBuilder.AppendIfTrue("-ag", this.AutogenerateGuids); |
| 45 | commandLineBuilder.AppendIfTrue("-gg", this.GenerateGuidsNow); |
| 46 | commandLineBuilder.AppendIfTrue("-sfrag", this.SuppressFragments); |
| 47 | commandLineBuilder.AppendIfTrue("-suid", this.SuppressUniqueIds); |
| 48 | commandLineBuilder.AppendArrayIfNotNull("-t ", this.Transforms); |
| 49 | commandLineBuilder.AppendSwitchIfNotNull("-out ", this.OutputFile); |
| 50 | } |
| 51 | } |
| 52 | } |