5 // Leszek Ciesielski <skolima@gmail.com>
6 // Marek Sieradzki <marek.sieradzki@gmail.com>
8 // Copyright (C) 2006 Forcom (http://www.forcom.com.pl/)
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 using Microsoft.Build.Framework;
34 using Microsoft.Build.Utilities;
36 namespace Microsoft.Build.Tasks {
38 public class Vbc : ManagedCompiler {
45 protected internal override void AddResponseFileCommands (
46 CommandLineBuilderExtension commandLine )
48 base.AddResponseFileCommands (commandLine);
50 commandLine.AppendSwitchIfNotNull ("/libpath:", AdditionalLibPaths, ",");
52 commandLine.AppendSwitchIfNotNull ("/baseaddress:", BaseAddress);
54 commandLine.AppendSwitchIfNotNull ("/define:", DefineConstants);
58 commandLine.AppendSwitchIfNotNull ("/doc", DocumentationFile);
62 // GenerateDocumentation
65 foreach (ITaskItem item in Imports)
66 commandLine.AppendSwitchIfNotNull ("/imports:", item.ItemSpec);
68 commandLine.AppendSwitchIfNotNull ("/main:", MainEntryPoint);
73 commandLine.AppendSwitch ("/nowarn");
75 commandLine.AppendSwitchIfNotNull ("/optioncompare:", OptionCompare);
77 if (Bag ["OptionExplicit"] != null)
79 commandLine.AppendSwitch ("/optionexplicit+");
81 commandLine.AppendSwitch ("/optionexplicit-");
83 if (Bag ["OptionStrict"] != null)
85 commandLine.AppendSwitch ("/optionstrict+");
87 commandLine.AppendSwitch ("/optionstrict-");
93 if (References != null)
94 foreach (ITaskItem item in References)
95 commandLine.AppendSwitchIfNotNull ("/reference:", item.ItemSpec);
97 if (Bag ["RemoveIntegerChecks"] != null)
98 if (RemoveIntegerChecks)
99 commandLine.AppendSwitch ("/removeintchecks+");
101 commandLine.AppendSwitch ("/removeintchecks-");
103 if (ResponseFiles != null)
104 foreach (ITaskItem item in ResponseFiles)
105 commandLine.AppendFileNameIfNotNull (String.Format ("@{0}", item.ItemSpec));
107 commandLine.AppendSwitchIfNotNull ("/rootnamespace:", RootNamespace);
109 commandLine.AppendSwitchIfNotNull ("/sdkpath:", SdkPath);
111 // TargetCompactFramework
117 // WarningsNotAsErrors
122 protected override bool CallHostObjectToExecute ()
124 throw new NotImplementedException ();
128 protected override string GenerateFullPathToTool ()
130 return Path.Combine (ToolPath, ToolName);
134 protected override HostObjectInitializationStatus InitializeHostObject ()
136 throw new NotImplementedException ();
140 protected override bool ValidateParameters ()
142 throw new NotImplementedException ();
146 public string BaseAddress {
147 get { return (string) Bag ["BaseAddress"]; }
148 set { Bag ["BaseAddress"] = value; }
152 public string DisabledWarnings {
153 get { return (string) Bag ["DisabledWarnings"]; }
154 set { Bag ["DisabledWarnings"] = value; }
158 public string DocumentationFile {
159 get { return (string) Bag ["DocumentationFile"]; }
160 set { Bag ["DocumentationFile"] = value; }
164 public string ErrorReport {
165 get { return (string) Bag ["ErrorReport"]; }
166 set { Bag ["ErrorReport"] = value; }
170 public bool GenerateDocumentation {
171 get { return GetBoolParameterWithDefault ("GenerateDocumentation", false); }
172 set { Bag ["GenerateDocumentation"] = value; }
176 public ITaskItem [] Imports {
177 get { return (ITaskItem []) Bag ["Imports"]; }
178 set { Bag ["Imports"] = value; }
182 public bool NoStandardLib {
183 get { return GetBoolParameterWithDefault ("NoStandardLib", false); }
184 set { Bag ["NoStandardLib"] = value; }
188 public bool NoWarnings {
189 get { return GetBoolParameterWithDefault ("NoWarnings", false); }
190 set { Bag ["NoWarnings"] = value; }
194 public string OptionCompare {
195 get { return (string) Bag ["OptionCompare"]; }
196 set { Bag ["OptionCompare"] = value; }
200 public bool OptionExplicit {
201 get { return GetBoolParameterWithDefault ("OptionExplicit", false); }
202 set { Bag ["OpExplicit"] = value; }
206 public bool OptionStrict {
207 get { return GetBoolParameterWithDefault ("OptionStrict", false); }
208 set { Bag ["OptionStrict"] = value; }
212 public string OptionStrictType {
213 get { return (string) Bag ["OptionStrictType"]; }
214 set { Bag ["OptionStrictType"] = value; }
218 public string Platform {
219 get { return (string) Bag ["Platfrom"]; }
220 set { Bag ["Platform"] = value; }
224 public bool RemoveIntegerChecks {
225 get { return GetBoolParameterWithDefault ("RemoveIntegerChecks", false); }
226 set { Bag ["RemoveIntegerChecks"] = value; }
230 public string RootNamespace {
231 get { return (string) Bag ["RootNamespace"]; }
232 set { Bag ["RootNamespace"] = value; }
236 public string SdkPath {
237 get { return (string) Bag ["SdkPath"]; }
238 set { Bag ["SdkPath"] = value; }
242 public bool TargetCompactFramework {
243 get { return (bool) Bag ["TargetCompactFramework"]; }
244 set { Bag ["TargetCompactFramework"] = value; }
248 protected override string ToolName {
249 get { return "vbnc"; }
253 public bool UseHostCompilerIfAvailable {
254 get { return (bool) Bag ["UseHostCompilerIfAvailable"]; }
255 set { Bag ["UseHostCompilerIfAvailable"] = value; }
259 public string Verbosity {
260 get { return (string) Bag ["Verbosity"]; }
261 set { Bag ["Verbosity"] = value; }
265 public string WarningsAsErrors {
266 get { return (string) Bag ["WarningsAsErrors"]; }
267 set { Bag ["WarningsAsErrors"] = value; }
271 public string WarningsNotAsErrors {
272 get { return (string) Bag ["WarningsNotAsErrors"]; }
273 set { Bag ["WarningsNotAsErrors"] = value; }