aboutsummaryrefslogtreecommitdiff
path: root/src/tools/WixToolset.HeatTasks/HeatProject.cs
blob: 998c14abbe04aa6dccdef2125def6f00b6519bd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// 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.

namespace WixToolset.HeatTasks
{
    using Microsoft.Build.Framework;
    using WixToolset.BaseBuildTasks;

    public sealed class HeatProject : HeatTask
    {
        private string[] projectOutputGroups;

        public string Configuration { get; set; }

        public string DirectoryIds { get; set; }

        public bool GenerateWixVariables { get; set; }

        public string GenerateType { get; set; }

        public string MsbuildBinPath { get; set; }

        public string Platform { get; set; }

        [Required]
        public string Project { get; set; }

        public string ProjectName { get; set; }

        public string[] ProjectOutputGroups
        {
            get
            {
                return this.projectOutputGroups;
            }
            set
            {
                this.projectOutputGroups = value;

                // If it's just one string and it contains semicolons, let's
                // split it into separate items.
                if (this.projectOutputGroups.Length == 1)
                {
                    this.projectOutputGroups = this.projectOutputGroups[0].Split(new char[] { ';' });
                }
            }
        }

        public bool UseToolsVersion { get; set; }

        protected override string OperationName => "project";

        protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilder)
        {
            commandLineBuilder.AppendSwitch(this.OperationName);
            commandLineBuilder.AppendFileNameIfNotNull(this.Project);

            commandLineBuilder.AppendSwitchIfNotNull("-configuration ", this.Configuration);
            commandLineBuilder.AppendSwitchIfNotNull("-directoryid ", this.DirectoryIds);
            commandLineBuilder.AppendSwitchIfNotNull("-generate ", this.GenerateType);
            commandLineBuilder.AppendSwitchIfNotNull("-msbuildbinpath ", this.MsbuildBinPath);
            commandLineBuilder.AppendSwitchIfNotNull("-platform ", this.Platform);
            commandLineBuilder.AppendArrayIfNotNull("-pog ", this.ProjectOutputGroups);
            commandLineBuilder.AppendSwitchIfNotNull("-projectname ", this.ProjectName);
            commandLineBuilder.AppendIfTrue("-wixvar", this.GenerateWixVariables);

#if !NETCOREAPP
            commandLineBuilder.AppendIfTrue("-usetoolsversion", this.UseToolsVersion);
#endif

            base.BuildCommandLine(commandLineBuilder);
        }
    }
}