diff options
author | Rob Mensching <rob@firegiant.com> | 2018-07-19 00:58:00 -0700 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2018-07-21 07:36:59 -0700 |
commit | 2724cfee4c163f3297ee25edfd2372767cfd4945 (patch) | |
tree | 8cdda34c83bea014a586a491e3b4b187ad8f16da /src/WixToolset.BuildTasks/Light.cs | |
parent | 4d40bef9cf51b8cff7e1f6a73fdf68b9722eb8a0 (diff) | |
download | wix-2724cfee4c163f3297ee25edfd2372767cfd4945.tar.gz wix-2724cfee4c163f3297ee25edfd2372767cfd4945.tar.bz2 wix-2724cfee4c163f3297ee25edfd2372767cfd4945.zip |
Move tool projects to Tools repo
Diffstat (limited to 'src/WixToolset.BuildTasks/Light.cs')
-rw-r--r-- | src/WixToolset.BuildTasks/Light.cs | 488 |
1 files changed, 0 insertions, 488 deletions
diff --git a/src/WixToolset.BuildTasks/Light.cs b/src/WixToolset.BuildTasks/Light.cs deleted file mode 100644 index b7d0b4f7..00000000 --- a/src/WixToolset.BuildTasks/Light.cs +++ /dev/null | |||
@@ -1,488 +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.Collections.Generic; | ||
7 | using System.Diagnostics; | ||
8 | using System.Diagnostics.CodeAnalysis; | ||
9 | using System.Globalization; | ||
10 | using System.IO; | ||
11 | using System.Text; | ||
12 | |||
13 | using Microsoft.Build.Framework; | ||
14 | using Microsoft.Build.Utilities; | ||
15 | |||
16 | /// <summary> | ||
17 | /// An MSBuild task to run the WiX linker. | ||
18 | /// </summary> | ||
19 | public sealed class Light : WixToolTask | ||
20 | { | ||
21 | private const string LightToolName = "Light.exe"; | ||
22 | |||
23 | private string additionalCub; | ||
24 | private bool allowIdenticalRows; | ||
25 | private bool allowUnresolvedReferences; | ||
26 | private string[] baseInputPaths; | ||
27 | private ITaskItem[] bindInputPaths; | ||
28 | private bool backwardsCompatibleGuidGeneration; | ||
29 | private bool bindFiles; | ||
30 | private ITaskItem builtOutputsFile; | ||
31 | private string cabinetCachePath; | ||
32 | private int cabinetCreationThreadCount = WixCommandLineBuilder.Unspecified; | ||
33 | private ITaskItem contentsFile; | ||
34 | private string cultures; | ||
35 | private string customBinder; | ||
36 | private string defaultCompressionLevel; | ||
37 | private ITaskItem[] extensions; | ||
38 | private string[] ices; | ||
39 | private bool leaveTemporaryFiles; | ||
40 | private ITaskItem[] localizationFiles; | ||
41 | private ITaskItem[] objectFiles; | ||
42 | private bool outputAsXml; | ||
43 | private ITaskItem outputsFile; | ||
44 | private ITaskItem outputFile; | ||
45 | private ITaskItem pdbOutputFile; | ||
46 | private ITaskItem wixProjectFile; | ||
47 | private bool pedantic; | ||
48 | private bool reuseCabinetCache; | ||
49 | private bool suppressAclReset; | ||
50 | private bool suppressAssemblies; | ||
51 | private bool suppressDefaultAdminSequenceActions; | ||
52 | private bool suppressDefaultAdvSequenceActions; | ||
53 | private bool suppressDefaultUISequenceActions; | ||
54 | private bool dropUnrealTables; | ||
55 | private bool exactAssemblyVersions; | ||
56 | private bool suppressFileHashAndInfo; | ||
57 | private bool suppressFiles; | ||
58 | private bool suppressIntermediateFileVersionMatching; | ||
59 | private string[] suppressIces; | ||
60 | private bool suppressLayout; | ||
61 | private bool suppressLocalization; | ||
62 | private bool suppressMsiAssemblyTableProcessing; | ||
63 | private bool suppressPdbOutput; | ||
64 | private bool suppressSchemaValidation; | ||
65 | private bool suppressValidation; | ||
66 | private bool suppressTagSectionIdAttributeOnTuples; | ||
67 | private ITaskItem unreferencedSymbolsFile; | ||
68 | private string[] wixVariables; | ||
69 | private string extensionDirectory; | ||
70 | private string[] referencePaths; | ||
71 | |||
72 | /// <summary> | ||
73 | /// Creates a new light task. | ||
74 | /// </summary> | ||
75 | /// <remarks> | ||
76 | /// Defaults to running the task as a separate process, instead of in-proc | ||
77 | /// which is the default for WixToolTasks. This allows the Win32 manifest file | ||
78 | /// embedded in light.exe to enable reg-free COM interop with mergemod.dll. | ||
79 | /// </remarks> | ||
80 | public Light() | ||
81 | { | ||
82 | } | ||
83 | |||
84 | public string AdditionalCub | ||
85 | { | ||
86 | get { return this.additionalCub; } | ||
87 | set { this.additionalCub = value; } | ||
88 | } | ||
89 | |||
90 | public bool AllowIdenticalRows | ||
91 | { | ||
92 | get { return this.allowIdenticalRows; } | ||
93 | set { this.allowIdenticalRows = value; } | ||
94 | } | ||
95 | |||
96 | public bool AllowUnresolvedReferences | ||
97 | { | ||
98 | get { return this.allowUnresolvedReferences; } | ||
99 | set { this.allowUnresolvedReferences = value; } | ||
100 | } | ||
101 | |||
102 | // TODO: remove this property entirely in v4.0 | ||
103 | [Obsolete("Use BindInputPaths instead of BaseInputPaths.")] | ||
104 | public string[] BaseInputPaths | ||
105 | { | ||
106 | get { return this.baseInputPaths; } | ||
107 | set { this.baseInputPaths = value; } | ||
108 | } | ||
109 | |||
110 | public ITaskItem[] BindInputPaths | ||
111 | { | ||
112 | get { return this.bindInputPaths; } | ||
113 | set { this.bindInputPaths = value; } | ||
114 | } | ||
115 | |||
116 | public bool BackwardsCompatibleGuidGeneration | ||
117 | { | ||
118 | get { return this.backwardsCompatibleGuidGeneration; } | ||
119 | set { this.backwardsCompatibleGuidGeneration = value; } | ||
120 | } | ||
121 | |||
122 | public bool BindFiles | ||
123 | { | ||
124 | get { return this.bindFiles; } | ||
125 | set { this.bindFiles = value; } | ||
126 | } | ||
127 | |||
128 | public string CabinetCachePath | ||
129 | { | ||
130 | get { return this.cabinetCachePath; } | ||
131 | set { this.cabinetCachePath = value; } | ||
132 | } | ||
133 | |||
134 | public int CabinetCreationThreadCount | ||
135 | { | ||
136 | get { return this.cabinetCreationThreadCount; } | ||
137 | set { this.cabinetCreationThreadCount = value; } | ||
138 | } | ||
139 | |||
140 | public ITaskItem BindBuiltOutputsFile | ||
141 | { | ||
142 | get { return this.builtOutputsFile; } | ||
143 | set { this.builtOutputsFile = value; } | ||
144 | } | ||
145 | |||
146 | public ITaskItem BindContentsFile | ||
147 | { | ||
148 | get { return this.contentsFile; } | ||
149 | set { this.contentsFile = value; } | ||
150 | } | ||
151 | |||
152 | public ITaskItem BindOutputsFile | ||
153 | { | ||
154 | get { return this.outputsFile; } | ||
155 | set { this.outputsFile = value; } | ||
156 | } | ||
157 | |||
158 | public string Cultures | ||
159 | { | ||
160 | get { return this.cultures; } | ||
161 | set { this.cultures = value; } | ||
162 | } | ||
163 | |||
164 | public string CustomBinder | ||
165 | { | ||
166 | get { return this.customBinder; } | ||
167 | set { this.customBinder = value; } | ||
168 | } | ||
169 | |||
170 | public string DefaultCompressionLevel | ||
171 | { | ||
172 | get { return this.defaultCompressionLevel; } | ||
173 | set { this.defaultCompressionLevel = value; } | ||
174 | } | ||
175 | |||
176 | public bool DropUnrealTables | ||
177 | { | ||
178 | get { return this.dropUnrealTables; } | ||
179 | set { this.dropUnrealTables = value; } | ||
180 | } | ||
181 | |||
182 | public bool ExactAssemblyVersions | ||
183 | { | ||
184 | get { return this.exactAssemblyVersions; } | ||
185 | set { this.exactAssemblyVersions = value; } | ||
186 | } | ||
187 | |||
188 | public ITaskItem[] Extensions | ||
189 | { | ||
190 | get { return this.extensions; } | ||
191 | set { this.extensions = value; } | ||
192 | } | ||
193 | |||
194 | public string[] Ices | ||
195 | { | ||
196 | get { return this.ices; } | ||
197 | set { this.ices = value; } | ||
198 | } | ||
199 | |||
200 | public bool LeaveTemporaryFiles | ||
201 | { | ||
202 | get { return this.leaveTemporaryFiles; } | ||
203 | set { this.leaveTemporaryFiles = value; } | ||
204 | } | ||
205 | |||
206 | public ITaskItem[] LocalizationFiles | ||
207 | { | ||
208 | get { return this.localizationFiles; } | ||
209 | set { this.localizationFiles = value; } | ||
210 | } | ||
211 | |||
212 | [Required] | ||
213 | public ITaskItem[] ObjectFiles | ||
214 | { | ||
215 | get { return this.objectFiles; } | ||
216 | set { this.objectFiles = value; } | ||
217 | } | ||
218 | |||
219 | public bool OutputAsXml | ||
220 | { | ||
221 | get { return this.outputAsXml; } | ||
222 | set { this.outputAsXml = value; } | ||
223 | } | ||
224 | |||
225 | [Required] | ||
226 | [Output] | ||
227 | public ITaskItem OutputFile | ||
228 | { | ||
229 | get { return this.outputFile; } | ||
230 | set { this.outputFile = value; } | ||
231 | } | ||
232 | |||
233 | [Output] | ||
234 | public ITaskItem PdbOutputFile | ||
235 | { | ||
236 | get { return this.pdbOutputFile; } | ||
237 | set { this.pdbOutputFile = value; } | ||
238 | } | ||
239 | |||
240 | public bool Pedantic | ||
241 | { | ||
242 | get { return this.pedantic; } | ||
243 | set { this.pedantic = value; } | ||
244 | } | ||
245 | |||
246 | public bool ReuseCabinetCache | ||
247 | { | ||
248 | get { return this.reuseCabinetCache; } | ||
249 | set { this.reuseCabinetCache = value; } | ||
250 | } | ||
251 | |||
252 | public bool SuppressAclReset | ||
253 | { | ||
254 | get { return this.suppressAclReset; } | ||
255 | set { this.suppressAclReset = value; } | ||
256 | } | ||
257 | |||
258 | public bool SuppressAssemblies | ||
259 | { | ||
260 | get { return this.suppressAssemblies; } | ||
261 | set { this.suppressAssemblies = value; } | ||
262 | } | ||
263 | |||
264 | public bool SuppressDefaultAdminSequenceActions | ||
265 | { | ||
266 | get { return this.suppressDefaultAdminSequenceActions; } | ||
267 | set { this.suppressDefaultAdminSequenceActions = value; } | ||
268 | } | ||
269 | |||
270 | public bool SuppressDefaultAdvSequenceActions | ||
271 | { | ||
272 | get { return this.suppressDefaultAdvSequenceActions; } | ||
273 | set { this.suppressDefaultAdvSequenceActions = value; } | ||
274 | } | ||
275 | |||
276 | public bool SuppressDefaultUISequenceActions | ||
277 | { | ||
278 | get { return this.suppressDefaultUISequenceActions; } | ||
279 | set { this.suppressDefaultUISequenceActions = value; } | ||
280 | } | ||
281 | |||
282 | public bool SuppressFileHashAndInfo | ||
283 | { | ||
284 | get { return this.suppressFileHashAndInfo; } | ||
285 | set { this.suppressFileHashAndInfo = value; } | ||
286 | } | ||
287 | |||
288 | public bool SuppressFiles | ||
289 | { | ||
290 | get { return this.suppressFiles; } | ||
291 | set { this.suppressFiles = value; } | ||
292 | } | ||
293 | |||
294 | public bool SuppressIntermediateFileVersionMatching | ||
295 | { | ||
296 | get { return this.suppressIntermediateFileVersionMatching; } | ||
297 | set { this.suppressIntermediateFileVersionMatching = value; } | ||
298 | } | ||
299 | |||
300 | public string[] SuppressIces | ||
301 | { | ||
302 | get { return this.suppressIces; } | ||
303 | set { this.suppressIces = value; } | ||
304 | } | ||
305 | |||
306 | public bool SuppressLayout | ||
307 | { | ||
308 | get { return this.suppressLayout; } | ||
309 | set { this.suppressLayout = value; } | ||
310 | } | ||
311 | |||
312 | public bool SuppressLocalization | ||
313 | { | ||
314 | get { return this.suppressLocalization; } | ||
315 | set { this.suppressLocalization = value; } | ||
316 | } | ||
317 | |||
318 | [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")] | ||
319 | public bool SuppressMsiAssemblyTableProcessing | ||
320 | { | ||
321 | get { return this.suppressMsiAssemblyTableProcessing; } | ||
322 | set { this.suppressMsiAssemblyTableProcessing = value; } | ||
323 | } | ||
324 | |||
325 | public bool SuppressPdbOutput | ||
326 | { | ||
327 | get { return this.suppressPdbOutput; } | ||
328 | set { this.suppressPdbOutput = value; } | ||
329 | } | ||
330 | |||
331 | public bool SuppressSchemaValidation | ||
332 | { | ||
333 | get { return this.suppressSchemaValidation; } | ||
334 | set { this.suppressSchemaValidation = value; } | ||
335 | } | ||
336 | |||
337 | public bool SuppressValidation | ||
338 | { | ||
339 | get { return this.suppressValidation; } | ||
340 | set { this.suppressValidation = value; } | ||
341 | } | ||
342 | |||
343 | public bool SuppressTagSectionIdAttributeOnTuples | ||
344 | { | ||
345 | get { return this.suppressTagSectionIdAttributeOnTuples; } | ||
346 | set { this.suppressTagSectionIdAttributeOnTuples = value; } | ||
347 | } | ||
348 | |||
349 | [Output] | ||
350 | public ITaskItem UnreferencedSymbolsFile | ||
351 | { | ||
352 | get { return this.unreferencedSymbolsFile; } | ||
353 | set { this.unreferencedSymbolsFile = value; } | ||
354 | } | ||
355 | |||
356 | [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")] | ||
357 | public ITaskItem WixProjectFile | ||
358 | { | ||
359 | get { return this.wixProjectFile; } | ||
360 | set { this.wixProjectFile = value; } | ||
361 | } | ||
362 | |||
363 | [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")] | ||
364 | public string[] WixVariables | ||
365 | { | ||
366 | get { return this.wixVariables; } | ||
367 | set { this.wixVariables = value; } | ||
368 | } | ||
369 | |||
370 | public string ExtensionDirectory | ||
371 | { | ||
372 | get { return this.extensionDirectory; } | ||
373 | set { this.extensionDirectory = value; } | ||
374 | } | ||
375 | |||
376 | public string[] ReferencePaths | ||
377 | { | ||
378 | get { return this.referencePaths; } | ||
379 | set { this.referencePaths = value; } | ||
380 | } | ||
381 | |||
382 | /// <summary> | ||
383 | /// Get the name of the executable. | ||
384 | /// </summary> | ||
385 | /// <remarks>The ToolName is used with the ToolPath to get the location of light.exe.</remarks> | ||
386 | /// <value>The name of the executable.</value> | ||
387 | protected override string ToolName | ||
388 | { | ||
389 | get { return LightToolName; } | ||
390 | } | ||
391 | |||
392 | /// <summary> | ||
393 | /// Get the path to the executable. | ||
394 | /// </summary> | ||
395 | /// <remarks>GetFullPathToTool is only called when the ToolPath property is not set (see the ToolName remarks above).</remarks> | ||
396 | /// <returns>The full path to the executable or simply light.exe if it's expected to be in the system path.</returns> | ||
397 | protected override string GenerateFullPathToTool() | ||
398 | { | ||
399 | // If there's not a ToolPath specified, it has to be in the system path. | ||
400 | if (String.IsNullOrEmpty(this.ToolPath)) | ||
401 | { | ||
402 | return LightToolName; | ||
403 | } | ||
404 | |||
405 | return Path.Combine(Path.GetFullPath(this.ToolPath), LightToolName); | ||
406 | } | ||
407 | |||
408 | /// <summary> | ||
409 | /// Builds a command line from options in this task. | ||
410 | /// </summary> | ||
411 | protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilder) | ||
412 | { | ||
413 | // Always put the output first so it is easy to find in the log. | ||
414 | commandLineBuilder.AppendSwitchIfNotNull("-out ", this.OutputFile); | ||
415 | commandLineBuilder.AppendSwitchIfNotNull("-pdbout ", this.PdbOutputFile); | ||
416 | |||
417 | base.BuildCommandLine(commandLineBuilder); | ||
418 | |||
419 | commandLineBuilder.AppendIfTrue("-ai", this.AllowIdenticalRows); | ||
420 | commandLineBuilder.AppendIfTrue("-au", this.AllowUnresolvedReferences); | ||
421 | commandLineBuilder.AppendArrayIfNotNull("-b ", this.baseInputPaths); | ||
422 | |||
423 | if (null != this.BindInputPaths) | ||
424 | { | ||
425 | Queue<String> formattedBindInputPaths = new Queue<String>(); | ||
426 | foreach (ITaskItem item in this.BindInputPaths) | ||
427 | { | ||
428 | String formattedPath = string.Empty; | ||
429 | String bindName = item.GetMetadata("BindName"); | ||
430 | if (!String.IsNullOrEmpty(bindName)) | ||
431 | { | ||
432 | formattedPath = String.Concat(bindName, "=", item.GetMetadata("FullPath")); | ||
433 | } | ||
434 | else | ||
435 | { | ||
436 | formattedPath = item.GetMetadata("FullPath"); | ||
437 | } | ||
438 | formattedBindInputPaths.Enqueue(formattedPath); | ||
439 | } | ||
440 | commandLineBuilder.AppendArrayIfNotNull("-b ", formattedBindInputPaths.ToArray()); | ||
441 | } | ||
442 | |||
443 | commandLineBuilder.AppendIfTrue("-bcgg", this.BackwardsCompatibleGuidGeneration); | ||
444 | commandLineBuilder.AppendIfTrue("-bf", this.BindFiles); | ||
445 | commandLineBuilder.AppendSwitchIfNotNull("-cc ", this.CabinetCachePath); | ||
446 | commandLineBuilder.AppendIfSpecified("-ct ", this.CabinetCreationThreadCount); | ||
447 | commandLineBuilder.AppendSwitchIfNotNull("-cub ", this.AdditionalCub); | ||
448 | commandLineBuilder.AppendSwitchIfNotNull("-cultures:", this.Cultures); | ||
449 | commandLineBuilder.AppendSwitchIfNotNull("-binder ", this.CustomBinder); | ||
450 | commandLineBuilder.AppendArrayIfNotNull("-d", this.WixVariables); | ||
451 | commandLineBuilder.AppendSwitchIfNotNull("-dcl:", this.DefaultCompressionLevel); | ||
452 | commandLineBuilder.AppendIfTrue("-dut", this.DropUnrealTables); | ||
453 | commandLineBuilder.AppendIfTrue("-eav", this.ExactAssemblyVersions); | ||
454 | commandLineBuilder.AppendExtensions(this.Extensions, this.ExtensionDirectory, this.referencePaths); | ||
455 | commandLineBuilder.AppendArrayIfNotNull("-ice:", this.Ices); | ||
456 | commandLineBuilder.AppendArrayIfNotNull("-loc ", this.LocalizationFiles); | ||
457 | commandLineBuilder.AppendIfTrue("-notidy", this.LeaveTemporaryFiles); | ||
458 | commandLineBuilder.AppendIfTrue("-pedantic", this.Pedantic); | ||
459 | commandLineBuilder.AppendIfTrue("-reusecab", this.ReuseCabinetCache); | ||
460 | commandLineBuilder.AppendIfTrue("-sa", this.SuppressAssemblies); | ||
461 | commandLineBuilder.AppendIfTrue("-sacl", this.SuppressAclReset); | ||
462 | commandLineBuilder.AppendIfTrue("-sadmin", this.SuppressDefaultAdminSequenceActions); | ||
463 | commandLineBuilder.AppendIfTrue("-sadv", this.SuppressDefaultAdvSequenceActions); | ||
464 | commandLineBuilder.AppendArrayIfNotNull("-sice:", this.SuppressIces); | ||
465 | commandLineBuilder.AppendIfTrue("-sma", this.SuppressMsiAssemblyTableProcessing); | ||
466 | commandLineBuilder.AppendIfTrue("-sf", this.SuppressFiles); | ||
467 | commandLineBuilder.AppendIfTrue("-sh", this.SuppressFileHashAndInfo); | ||
468 | commandLineBuilder.AppendIfTrue("-sl", this.SuppressLayout); | ||
469 | commandLineBuilder.AppendIfTrue("-sloc", this.SuppressLocalization); | ||
470 | commandLineBuilder.AppendIfTrue("-spdb", this.SuppressPdbOutput); | ||
471 | commandLineBuilder.AppendIfTrue("-ss", this.SuppressSchemaValidation); | ||
472 | commandLineBuilder.AppendIfTrue("-sts", this.SuppressTagSectionIdAttributeOnTuples); | ||
473 | commandLineBuilder.AppendIfTrue("-sui", this.SuppressDefaultUISequenceActions); | ||
474 | commandLineBuilder.AppendIfTrue("-sv", this.SuppressIntermediateFileVersionMatching); | ||
475 | commandLineBuilder.AppendIfTrue("-sval", this.SuppressValidation); | ||
476 | commandLineBuilder.AppendSwitchIfNotNull("-usf ", this.UnreferencedSymbolsFile); | ||
477 | commandLineBuilder.AppendIfTrue("-xo", this.OutputAsXml); | ||
478 | commandLineBuilder.AppendSwitchIfNotNull("-contentsfile ", this.BindContentsFile); | ||
479 | commandLineBuilder.AppendSwitchIfNotNull("-outputsfile ", this.BindOutputsFile); | ||
480 | commandLineBuilder.AppendSwitchIfNotNull("-builtoutputsfile ", this.BindBuiltOutputsFile); | ||
481 | commandLineBuilder.AppendSwitchIfNotNull("-wixprojectfile ", this.WixProjectFile); | ||
482 | commandLineBuilder.AppendTextIfNotNull(this.AdditionalOptions); | ||
483 | |||
484 | List<string> objectFilePaths = AdjustFilePaths(this.objectFiles, this.ReferencePaths); | ||
485 | commandLineBuilder.AppendFileNamesIfNotNull(objectFilePaths.ToArray(), " "); | ||
486 | } | ||
487 | } | ||
488 | } | ||