diff options
Diffstat (limited to 'src/WixToolset.BuildTasks/Insignia.cs')
-rw-r--r-- | src/WixToolset.BuildTasks/Insignia.cs | 118 |
1 files changed, 0 insertions, 118 deletions
diff --git a/src/WixToolset.BuildTasks/Insignia.cs b/src/WixToolset.BuildTasks/Insignia.cs deleted file mode 100644 index ba30963a..00000000 --- a/src/WixToolset.BuildTasks/Insignia.cs +++ /dev/null | |||
@@ -1,118 +0,0 @@ | |||
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.BuildTasks | ||
4 | { | ||
5 | using System; | ||
6 | using System.Diagnostics; | ||
7 | using System.Globalization; | ||
8 | using System.IO; | ||
9 | using System.Text; | ||
10 | |||
11 | using Microsoft.Build.Framework; | ||
12 | using Microsoft.Build.Utilities; | ||
13 | |||
14 | /// <summary> | ||
15 | /// An MSBuild task to run the WiX transform generator. | ||
16 | /// </summary> | ||
17 | public sealed class Insignia : WixToolTask | ||
18 | { | ||
19 | private const string InsigniaToolName = "insignia.exe"; | ||
20 | |||
21 | /// <summary> | ||
22 | /// Gets or sets the path to the database to inscribe. | ||
23 | /// </summary> | ||
24 | public ITaskItem DatabaseFile { get; set; } | ||
25 | |||
26 | /// <summary> | ||
27 | /// Gets or sets the path to the bundle to inscribe. | ||
28 | /// </summary> | ||
29 | public ITaskItem BundleFile { get; set; } | ||
30 | |||
31 | /// <summary> | ||
32 | /// Gets or sets the path to the original bundle that contains the attached container. | ||
33 | /// </summary> | ||
34 | public ITaskItem OriginalBundleFile { get; set; } | ||
35 | |||
36 | /// <summary> | ||
37 | /// Gets or sets the path to output the inscribed result. | ||
38 | /// </summary> | ||
39 | [Required] | ||
40 | public ITaskItem OutputFile { get; set; } | ||
41 | |||
42 | /// <summary> | ||
43 | /// Gets or sets the output. Only set if insignia does work. | ||
44 | /// </summary> | ||
45 | [Output] | ||
46 | public ITaskItem Output { get; set; } | ||
47 | |||
48 | /// <summary> | ||
49 | /// Get the name of the executable. | ||
50 | /// </summary> | ||
51 | /// <remarks>The ToolName is used with the ToolPath to get the location of Insignia.exe.</remarks> | ||
52 | /// <value>The name of the executable.</value> | ||
53 | protected override string ToolName | ||
54 | { | ||
55 | get { return InsigniaToolName; } | ||
56 | } | ||
57 | |||
58 | /// <summary> | ||
59 | /// Get the path to the executable. | ||
60 | /// </summary> | ||
61 | /// <remarks>GetFullPathToTool is only called when the ToolPath property is not set (see the ToolName remarks above).</remarks> | ||
62 | /// <returns>The full path to the executable or simply Insignia.exe if it's expected to be in the system path.</returns> | ||
63 | protected override string GenerateFullPathToTool() | ||
64 | { | ||
65 | // If there's not a ToolPath specified, it has to be in the system path. | ||
66 | if (String.IsNullOrEmpty(this.ToolPath)) | ||
67 | { | ||
68 | return InsigniaToolName; | ||
69 | } | ||
70 | |||
71 | return Path.Combine(Path.GetFullPath(this.ToolPath), InsigniaToolName); | ||
72 | } | ||
73 | |||
74 | /// <summary> | ||
75 | /// Builds a command line from options in this task. | ||
76 | /// </summary> | ||
77 | protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilder) | ||
78 | { | ||
79 | base.BuildCommandLine(commandLineBuilder); | ||
80 | |||
81 | commandLineBuilder.AppendSwitchIfNotNull("-im ", this.DatabaseFile); | ||
82 | if (null != this.OriginalBundleFile) | ||
83 | { | ||
84 | commandLineBuilder.AppendSwitchIfNotNull("-ab ", this.BundleFile); | ||
85 | commandLineBuilder.AppendFileNameIfNotNull(this.OriginalBundleFile); | ||
86 | } | ||
87 | else | ||
88 | { | ||
89 | commandLineBuilder.AppendSwitchIfNotNull("-ib ", this.BundleFile); | ||
90 | } | ||
91 | |||
92 | commandLineBuilder.AppendSwitchIfNotNull("-out ", this.OutputFile); | ||
93 | commandLineBuilder.AppendTextIfNotNull(this.AdditionalOptions); | ||
94 | } | ||
95 | |||
96 | /// <summary> | ||
97 | /// Executes a tool in-process by loading the tool assembly and invoking its entrypoint. | ||
98 | /// </summary> | ||
99 | /// <param name="pathToTool">Path to the tool to be executed; must be a managed executable.</param> | ||
100 | /// <param name="responseFileCommands">Commands to be written to a response file.</param> | ||
101 | /// <param name="commandLineCommands">Commands to be passed directly on the command-line.</param> | ||
102 | /// <returns>The tool exit code.</returns> | ||
103 | protected override int ExecuteTool(string pathToTool, string responseFileCommands, string commandLineCommands) | ||
104 | { | ||
105 | int returnCode = base.ExecuteTool(pathToTool, responseFileCommands, commandLineCommands); | ||
106 | if (0 == returnCode) // successfully did work. | ||
107 | { | ||
108 | this.Output = this.OutputFile; | ||
109 | } | ||
110 | else if (-1 == returnCode) // no work done. | ||
111 | { | ||
112 | returnCode = 0; | ||
113 | } | ||
114 | |||
115 | return returnCode; | ||
116 | } | ||
117 | } | ||
118 | } | ||