aboutsummaryrefslogtreecommitdiff
path: root/src/tools/WixToolset.HeatTasks/HeatDirectory.cs
blob: 14a8acfaa1be07b1f40e51abdaa44402df82064c (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
// 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 HeatDirectory : HeatTask
    {
        public string ComponentGroupName { get; set; }

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

        public string DirectoryRefId { get; set; }

        public bool KeepEmptyDirectories { get; set; }

        public string PreprocessorVariable { get; set; }

        public bool SuppressCom { get; set; }

        public bool SuppressRootDirectory { get; set; }

        public bool SuppressRegistry { get; set; }

        public string Template { get; set; }

        protected override string OperationName => "dir";

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

            commandLineBuilder.AppendSwitchIfNotNull("-cg ", this.ComponentGroupName);
            commandLineBuilder.AppendSwitchIfNotNull("-dr ", this.DirectoryRefId);
            commandLineBuilder.AppendIfTrue("-ke", this.KeepEmptyDirectories);
            commandLineBuilder.AppendIfTrue("-scom", this.SuppressCom);
            commandLineBuilder.AppendIfTrue("-sreg", this.SuppressRegistry);
            commandLineBuilder.AppendIfTrue("-srd", this.SuppressRootDirectory);
            commandLineBuilder.AppendSwitchIfNotNull("-template ", this.Template);
            commandLineBuilder.AppendSwitchIfNotNull("-var ", this.PreprocessorVariable);

            base.BuildCommandLine(commandLineBuilder);
        }
    }
}