aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.BuildTasks/TaskBase.cs
blob: 3d58fc06f93e59230ec8faa7fe18044cc66e1407 (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
// 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.Utilities;

    public abstract class TaskBase : Task
    {
        public string ToolPath { get; set; }

        public string AdditionalOptions { get; set; }

        public bool RunAsSeparateProcess { get; set; }

        /// <summary>
        /// Gets or sets whether all warnings should be suppressed.
        /// </summary>
        public bool SuppressAllWarnings { get; set; }

        /// <summary>
        /// Gets or sets a list of specific warnings to be suppressed.
        /// </summary>
        public string[] SuppressSpecificWarnings { get; set; }

        /// <summary>
        /// Gets or sets whether all warnings should be treated as errors.
        /// </summary>
        public bool TreatWarningsAsErrors { get; set; }

        /// <summary>
        /// Gets or sets a list of specific warnings to treat as errors.
        /// </summary>
        public string[] TreatSpecificWarningsAsErrors { get; set; }

        /// <summary>
        /// Gets or sets whether to display verbose output.
        /// </summary>
        public bool VerboseOutput { get; set; }

        /// <summary>
        /// Gets or sets whether to display the logo.
        /// </summary>
        public bool NoLogo { get; set; }

        public override bool Execute()
        {
            try
            {
                this.ExecuteCore();
            }
            catch (BuildException e)
            {
                this.Log.LogErrorFromException(e);
            }
            catch (Data.WixException e)
            {
                this.Log.LogErrorFromException(e);
            }

            return !this.Log.HasLoggedErrors;
        }

        protected abstract void ExecuteCore();
    }
}