aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.BuildTasks/Candle.cs
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2018-07-19 00:58:00 -0700
committerRob Mensching <rob@firegiant.com>2018-07-21 07:36:59 -0700
commit2724cfee4c163f3297ee25edfd2372767cfd4945 (patch)
tree8cdda34c83bea014a586a491e3b4b187ad8f16da /src/WixToolset.BuildTasks/Candle.cs
parent4d40bef9cf51b8cff7e1f6a73fdf68b9722eb8a0 (diff)
downloadwix-2724cfee4c163f3297ee25edfd2372767cfd4945.tar.gz
wix-2724cfee4c163f3297ee25edfd2372767cfd4945.tar.bz2
wix-2724cfee4c163f3297ee25edfd2372767cfd4945.zip
Move tool projects to Tools repo
Diffstat (limited to 'src/WixToolset.BuildTasks/Candle.cs')
-rw-r--r--src/WixToolset.BuildTasks/Candle.cs199
1 files changed, 0 insertions, 199 deletions
diff --git a/src/WixToolset.BuildTasks/Candle.cs b/src/WixToolset.BuildTasks/Candle.cs
deleted file mode 100644
index 82b15838..00000000
--- a/src/WixToolset.BuildTasks/Candle.cs
+++ /dev/null
@@ -1,199 +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 compiler.
17 /// </summary>
18 public sealed class CandleOld : WixToolTask
19 {
20 private const string CandleToolName = "candle.exe";
21
22 private string[] defineConstants;
23 private ITaskItem[] extensions;
24 private string[] includeSearchPaths;
25 private ITaskItem outputFile;
26 private bool pedantic;
27 private string installerPlatform;
28 private string preprocessToFile;
29 private bool preprocessToStdOut;
30 private ITaskItem[] sourceFiles;
31 private string extensionDirectory;
32 private string[] referencePaths;
33
34 public string[] DefineConstants
35 {
36 get { return this.defineConstants; }
37 set { this.defineConstants = value; }
38 }
39
40 public ITaskItem[] Extensions
41 {
42 get { return this.extensions; }
43 set { this.extensions = value; }
44 }
45
46 public string[] IncludeSearchPaths
47 {
48 get { return this.includeSearchPaths; }
49 set { this.includeSearchPaths = value; }
50 }
51
52 public string InstallerPlatform
53 {
54 get { return this.installerPlatform; }
55 set { this.installerPlatform = value; }
56 }
57
58 [Output]
59 [Required]
60 public ITaskItem OutputFile
61 {
62 get { return this.outputFile; }
63 set { this.outputFile = value; }
64 }
65
66 public bool Pedantic
67 {
68 get { return this.pedantic; }
69 set { this.pedantic = value; }
70 }
71
72 public string PreprocessToFile
73 {
74 get { return this.preprocessToFile; }
75 set { this.preprocessToFile = value; }
76 }
77
78 public bool PreprocessToStdOut
79 {
80 get { return this.preprocessToStdOut; }
81 set { this.preprocessToStdOut = value; }
82 }
83
84 [Required]
85 public ITaskItem[] SourceFiles
86 {
87 get { return this.sourceFiles; }
88 set { this.sourceFiles = value; }
89 }
90
91 public string ExtensionDirectory
92 {
93 get { return this.extensionDirectory; }
94 set { this.extensionDirectory = value; }
95 }
96
97 public string[] ReferencePaths
98 {
99 get { return this.referencePaths; }
100 set { this.referencePaths = value; }
101 }
102
103 /// <summary>
104 /// Get the name of the executable.
105 /// </summary>
106 /// <remarks>The ToolName is used with the ToolPath to get the location of candle.exe.</remarks>
107 /// <value>The name of the executable.</value>
108 protected override string ToolName
109 {
110 get { return CandleToolName; }
111 }
112
113 /// <summary>
114 /// Get the path to the executable.
115 /// </summary>
116 /// <remarks>GetFullPathToTool is only called when the ToolPath property is not set (see the ToolName remarks above).</remarks>
117 /// <returns>The full path to the executable or simply candle.exe if it's expected to be in the system path.</returns>
118 protected override string GenerateFullPathToTool()
119 {
120 // If there's not a ToolPath specified, it has to be in the system path.
121 if (String.IsNullOrEmpty(this.ToolPath))
122 {
123 return CandleToolName;
124 }
125
126 return Path.Combine(Path.GetFullPath(this.ToolPath), CandleToolName);
127 }
128
129 /// <summary>
130 /// Builds a command line from options in this task.
131 /// </summary>
132 protected override void BuildCommandLine(WixCommandLineBuilder commandLineBuilder)
133 {
134 base.BuildCommandLine(commandLineBuilder);
135
136 commandLineBuilder.AppendIfTrue("-p", this.PreprocessToStdOut);
137 commandLineBuilder.AppendSwitchIfNotNull("-p", this.PreprocessToFile);
138 commandLineBuilder.AppendSwitchIfNotNull("-out ", this.OutputFile);
139 commandLineBuilder.AppendArrayIfNotNull("-d", this.DefineConstants);
140 commandLineBuilder.AppendArrayIfNotNull("-I", this.IncludeSearchPaths);
141 commandLineBuilder.AppendIfTrue("-pedantic", this.Pedantic);
142 commandLineBuilder.AppendSwitchIfNotNull("-arch ", this.InstallerPlatform);
143 commandLineBuilder.AppendExtensions(this.Extensions, this.ExtensionDirectory, this.referencePaths);
144 commandLineBuilder.AppendTextIfNotNull(this.AdditionalOptions);
145
146 // Support per-source-file output by looking at the SourceFiles items to
147 // see if there is any "CandleOutput" metadata. If there is, we do our own
148 // appending, otherwise we fall back to the built-in "append file names" code.
149 // Note also that the wix.targets "Compile" target does *not* automagically
150 // fix the "@(CompileObjOutput)" list to include these new output names.
151 // If you really want to use this, you're going to have to clone the target
152 // in your own .targets file and create the output list yourself.
153 bool usePerSourceOutput = false;
154 if (this.SourceFiles != null)
155 {
156 foreach (ITaskItem item in this.SourceFiles)
157 {
158 if (!String.IsNullOrEmpty(item.GetMetadata("CandleOutput")))
159 {
160 usePerSourceOutput = true;
161 break;
162 }
163 }
164 }
165
166 if (usePerSourceOutput)
167 {
168 string[] newSourceNames = new string[this.SourceFiles.Length];
169 for (int iSource = 0; iSource < this.SourceFiles.Length; ++iSource)
170 {
171 ITaskItem item = this.SourceFiles[iSource];
172 if (null == item)
173 {
174 newSourceNames[iSource] = null;
175 }
176 else
177 {
178 string output = item.GetMetadata("CandleOutput");
179
180 if (!String.IsNullOrEmpty(output))
181 {
182 newSourceNames[iSource] = String.Concat(item.ItemSpec, ";", output);
183 }
184 else
185 {
186 newSourceNames[iSource] = item.ItemSpec;
187 }
188 }
189 }
190
191 commandLineBuilder.AppendFileNamesIfNotNull(newSourceNames, " ");
192 }
193 else
194 {
195 commandLineBuilder.AppendFileNamesIfNotNull(this.SourceFiles, " ");
196 }
197 }
198 }
199}