aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.BuildTasks/Lit.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.BuildTasks/Lit.cs')
-rw-r--r--src/WixToolset.BuildTasks/Lit.cs178
1 files changed, 0 insertions, 178 deletions
diff --git a/src/WixToolset.BuildTasks/Lit.cs b/src/WixToolset.BuildTasks/Lit.cs
deleted file mode 100644
index 1df964ae..00000000
--- a/src/WixToolset.BuildTasks/Lit.cs
+++ /dev/null
@@ -1,178 +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
3namespace WixToolset.BuildTasks
4{
5 using System;
6 using System.Collections.Generic;
7 using System.Diagnostics;
8 using System.Globalization;
9 using System.IO;
10 using System.Text;
11
12 using Microsoft.Build.Framework;
13 using Microsoft.Build.Utilities;
14
15 /// <summary>
16 /// An MSBuild task to run the WiX lib tool.
17 /// </summary>
18 public sealed class Lit : WixToolTask
19 {
20 private const string LitToolName = "lit.exe";
21
22 private string[] baseInputPaths;
23 private ITaskItem[] bindInputPaths;
24 private bool bindFiles;
25 private ITaskItem[] extensions;
26 private ITaskItem[] localizationFiles;
27 private ITaskItem[] objectFiles;
28 private ITaskItem outputFile;
29 private bool pedantic;
30 private bool suppressIntermediateFileVersionMatching;
31 private bool suppressSchemaValidation;
32 private string extensionDirectory;
33 private string[] referencePaths;
34
35 // TODO: remove this property entirely in v4.0
36 [Obsolete("Use BindInputPaths instead of BaseInputPaths.")]
37 public string[] BaseInputPaths
38 {
39 get { return this.baseInputPaths; }
40 set { this.baseInputPaths = value; }
41 }
42
43 public ITaskItem[] BindInputPaths
44 {
45 get { return this.bindInputPaths; }
46 set { this.bindInputPaths = value; }
47 }
48
49 public bool BindFiles
50 {
51 get { return this.bindFiles; }
52 set { this.bindFiles = value; }
53 }
54
55 public ITaskItem[] Extensions
56 {
57 get { return this.extensions; }
58 set { this.extensions = value; }
59 }
60
61 public ITaskItem[] LocalizationFiles
62 {
63 get { return this.localizationFiles; }
64 set { this.localizationFiles = value; }
65 }
66
67 [Required]
68 public ITaskItem[] ObjectFiles
69 {
70 get { return this.objectFiles; }
71 set { this.objectFiles = value; }
72 }
73
74 [Required]
75 [Output]
76 public ITaskItem OutputFile
77 {
78 get { return this.outputFile; }
79 set { this.outputFile = value; }
80 }
81
82 public bool Pedantic
83 {
84 get { return this.pedantic; }
85 set { this.pedantic = value; }
86 }
87
88 public bool SuppressIntermediateFileVersionMatching
89 {
90 get { return this.suppressIntermediateFileVersionMatching; }
91 set { this.suppressIntermediateFileVersionMatching = value; }
92 }
93
94 public bool SuppressSchemaValidation
95 {
96 get { return this.suppressSchemaValidation; }
97 set { this.suppressSchemaValidation = value; }
98 }
99
100 public string ExtensionDirectory
101 {
102 get { return this.extensionDirectory; }
103 set { this.extensionDirectory = value; }
104 }
105
106 public string[] ReferencePaths
107 {
108 get { return this.referencePaths; }
109 set { this.referencePaths = value; }
110 }
111
112 /// <summary>
113 /// Get the name of the executable.
114 /// </summary>
115 /// <remarks>The ToolName is used with the ToolPath to get the location of lit.exe</remarks>
116 /// <value>The name of the executable.</value>
117 protected override string ToolName
118 {
119 get { return LitToolName; }
120 }
121
122 /// <summary>
123 /// Get the path to the executable.
124 /// </summary>
125 /// <remarks>GetFullPathToTool is only called when the ToolPath property is not set (see the ToolName remarks above).</remarks>
126 /// <returns>The full path to the executable or simply lit.exe if it's expected to be in the system path.</returns>
127 protected override string GenerateFullPathToTool()
128 {
129 // If there's not a ToolPath specified, it has to be in the system path.
130 if (String.IsNullOrEmpty(this.ToolPath))
131 {
132 return LitToolName;
133 }
134
135 return Path.Combine(Path.GetFullPath(this.ToolPath), LitToolName);
136 }
137
138 /// <summary>
139 /// Builds a command line from options in this task.
140 /// </summary>
141 protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilder)
142 {
143 base.BuildCommandLine(commandLineBuilder);
144
145 commandLineBuilder.AppendSwitchIfNotNull("-out ", this.OutputFile);
146 commandLineBuilder.AppendArrayIfNotNull("-b ", this.baseInputPaths);
147 if (null != this.BindInputPaths)
148 {
149 Queue<String> formattedBindInputPaths = new Queue<String>();
150 foreach (ITaskItem item in this.BindInputPaths)
151 {
152 String formattedPath = string.Empty;
153 String bindName = item.GetMetadata("BindName");
154 if (!String.IsNullOrEmpty(item.GetMetadata("BindName")))
155 {
156 formattedPath = String.Concat(bindName, "=", item.GetMetadata("FullPath"));
157 }
158 else
159 {
160 formattedPath = item.GetMetadata("FullPath");
161 }
162 formattedBindInputPaths.Enqueue(formattedPath);
163 }
164 commandLineBuilder.AppendArrayIfNotNull("-b ", formattedBindInputPaths.ToArray());
165 }
166 commandLineBuilder.AppendIfTrue("-bf", this.BindFiles);
167 commandLineBuilder.AppendExtensions(this.extensions, this.ExtensionDirectory, this.referencePaths);
168 commandLineBuilder.AppendArrayIfNotNull("-loc ", this.LocalizationFiles);
169 commandLineBuilder.AppendIfTrue("-pedantic", this.Pedantic);
170 commandLineBuilder.AppendIfTrue("-ss", this.SuppressSchemaValidation);
171 commandLineBuilder.AppendIfTrue("-sv", this.SuppressIntermediateFileVersionMatching);
172 commandLineBuilder.AppendTextIfNotNull(this.AdditionalOptions);
173
174 List<string> objectFilePaths = AdjustFilePaths(this.objectFiles, this.ReferencePaths);
175 commandLineBuilder.AppendFileNamesIfNotNull(objectFilePaths.ToArray(), " ");
176 }
177 }
178}