| 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 | public sealed class HeatProject : HeatTask |
| 9 | { |
| 10 | private string[] projectOutputGroups; |
| 11 | |
| 12 | public string Configuration { get; set; } |
| 13 | |
| 14 | public string DirectoryIds { get; set; } |
| 15 | |
| 16 | public bool GenerateWixVariables { get; set; } |
| 17 | |
| 18 | public string GenerateType { get; set; } |
| 19 | |
| 20 | public string MsbuildBinPath { get; set; } |
| 21 | |
| 22 | public string Platform { get; set; } |
| 23 | |
| 24 | [Required] |
| 25 | public string Project { get; set; } |
| 26 | |
| 27 | public string ProjectName { get; set; } |
| 28 | |
| 29 | public string[] ProjectOutputGroups |
| 30 | { |
| 31 | get |
| 32 | { |
| 33 | return this.projectOutputGroups; |
| 34 | } |
| 35 | set |
| 36 | { |
| 37 | this.projectOutputGroups = value; |
| 38 | |
| 39 | // If it's just one string and it contains semicolons, let's |
| 40 | // split it into separate items. |
| 41 | if (this.projectOutputGroups.Length == 1) |
| 42 | { |
| 43 | this.projectOutputGroups = this.projectOutputGroups[0].Split(new char[] { ';' }); |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | public bool UseToolsVersion { get; set; } |
| 49 | |
| 50 | protected override string OperationName => "project"; |
| 51 | |
| 52 | protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilder) |
| 53 | { |
| 54 | commandLineBuilder.AppendSwitch(this.OperationName); |
| 55 | commandLineBuilder.AppendFileNameIfNotNull(this.Project); |
| 56 | |
| 57 | commandLineBuilder.AppendSwitchIfNotNull("-configuration ", this.Configuration); |
| 58 | commandLineBuilder.AppendSwitchIfNotNull("-directoryid ", this.DirectoryIds); |
| 59 | commandLineBuilder.AppendSwitchIfNotNull("-generate ", this.GenerateType); |
| 60 | commandLineBuilder.AppendSwitchIfNotNull("-msbuildbinpath ", this.MsbuildBinPath); |
| 61 | commandLineBuilder.AppendSwitchIfNotNull("-platform ", this.Platform); |
| 62 | commandLineBuilder.AppendArrayIfNotNull("-pog ", this.ProjectOutputGroups); |
| 63 | commandLineBuilder.AppendSwitchIfNotNull("-projectname ", this.ProjectName); |
| 64 | commandLineBuilder.AppendIfTrue("-wixvar", this.GenerateWixVariables); |
| 65 | |
| 66 | #if !NETCOREAPP |
| 67 | commandLineBuilder.AppendIfTrue("-usetoolsversion", this.UseToolsVersion); |
| 68 | #endif |
| 69 | |
| 70 | base.BuildCommandLine(commandLineBuilder); |
| 71 | } |
| 72 | } |
| 73 | } |