aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.BuildTasks/HeatTask.cs
blob: 18c083423ccfd0b0097d21ccfedd6b83b7c5489c (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// 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.BuildTasks
{
    using Microsoft.Build.Framework;

    /// <summary>
    /// A base MSBuild task to run the WiX harvester.
    /// Specific harvester tasks should extend this class.
    /// </summary>
    public abstract partial class HeatTask : ToolsetTask
    {
        private bool autogenerageGuids;
        private bool generateGuidsNow;
        private ITaskItem outputFile;
        private bool suppressFragments;
        private bool suppressUniqueIds;
        private string[] transforms;

        public HeatTask()
        {
            this.RunAsSeparateProcess = true;
        }

        public bool AutogenerateGuids
        {
            get { return this.autogenerageGuids; }
            set { this.autogenerageGuids = value; }
        }

        public bool GenerateGuidsNow
        {
            get { return this.generateGuidsNow; }
            set { this.generateGuidsNow = value; }
        }

        [Required]
        [Output]
        public ITaskItem OutputFile
        {
            get { return this.outputFile; }
            set { this.outputFile = value; }
        }

        public bool SuppressFragments
        {
            get { return this.suppressFragments; }
            set { this.suppressFragments = value; }
        }

        public bool SuppressUniqueIds
        {
            get { return this.suppressUniqueIds; }
            set { this.suppressUniqueIds = value; }
        }

        public string[] Transforms
        {
            get { return this.transforms; }
            set { this.transforms = value; }
        }

        protected sealed override string ToolName => "heat.exe";

        /// <summary>
        /// Gets the name of the heat operation performed by the task.
        /// </summary>
        /// <remarks>This is the first parameter passed on the heat.exe command-line.</remarks>
        /// <value>The name of the heat operation performed by the task.</value>
        protected abstract string OperationName
        {
            get;
        }

        /// <summary>
        /// Builds a command line from options in this task.
        /// </summary>
        protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilder)
        {
            base.BuildCommandLine(commandLineBuilder);

            commandLineBuilder.AppendIfTrue("-ag", this.AutogenerateGuids);
            commandLineBuilder.AppendIfTrue("-gg", this.GenerateGuidsNow);
            commandLineBuilder.AppendIfTrue("-sfrag", this.SuppressFragments);
            commandLineBuilder.AppendIfTrue("-suid", this.SuppressUniqueIds);
            commandLineBuilder.AppendArrayIfNotNull("-t ", this.Transforms);
            commandLineBuilder.AppendTextIfNotNull(this.AdditionalOptions);
            commandLineBuilder.AppendSwitchIfNotNull("-out ", this.OutputFile);
        }
    }
}