In class/Microsoft.Build.Tasks/Microsoft.Build.Tasks:
[mono.git] / mcs / class / Microsoft.Build.Tasks / Microsoft.Build.Tasks / Vbc.cs
1 //
2 // UpdateManifest.cs
3 //
4 // Author:
5 //      Leszek Ciesielski  <skolima@gmail.com>
6 //      Marek Sieradzki  <marek.sieradzki@gmail.com>
7 //
8 // Copyright (C) 2006 Forcom (http://www.forcom.com.pl/)
9 //
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:
17 // 
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
20 // 
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.
28
29 #if NET_2_0
30
31 using System;
32 using System.IO;
33 using System.Text;
34
35 using Microsoft.Build.Framework;
36 using Microsoft.Build.Utilities;
37
38 namespace Microsoft.Build.Tasks {
39
40         public class Vbc : ManagedCompiler {
41
42                 public Vbc ()
43                 {
44                 }
45
46                 [MonoTODO]
47                 protected internal override void AddResponseFileCommands (
48                                 CommandLineBuilderExtension commandLine )
49                 {
50                         base.AddResponseFileCommands (commandLine);
51
52                         commandLine.AppendSwitchIfNotNull ("/libpath:", AdditionalLibPaths, ",");
53
54                         commandLine.AppendSwitchIfNotNull ("/baseaddress:", BaseAddress);
55
56                         if (DefineConstants != null)
57                                 commandLine.AppendSwitchUnquotedIfNotNull ("/define:",
58                                                 String.Format ("\"{0}\"", EscapeDoubleQuotes (DefineConstants)));
59
60                         // DisabledWarnings
61
62                         commandLine.AppendSwitchIfNotNull ("/doc:", DocumentationFile);
63
64                         // ErrorReport
65                         
66                         // GenerateDocumentation
67                         
68                         if (Imports != null)
69                                 foreach (ITaskItem item in Imports)
70                                         commandLine.AppendSwitchIfNotNull ("/imports:", item.ItemSpec);
71                         
72                         commandLine.AppendSwitchIfNotNull ("/main:", MainEntryPoint);
73
74                         // NoStandardLib
75                         
76                         if (NoWarnings)
77                                 commandLine.AppendSwitch ("/nowarn");
78
79                         commandLine.AppendSwitchIfNotNull ("/optioncompare:", OptionCompare);
80
81                         if (Bag ["OptionExplicit"] != null)
82                                 if (OptionExplicit)
83                                         commandLine.AppendSwitch ("/optionexplicit+");
84                                 else
85                                         commandLine.AppendSwitch ("/optionexplicit-");
86
87                         if (Bag ["OptionStrict"] != null)
88                                 if (OptionStrict)
89                                         commandLine.AppendSwitch ("/optionstrict+");
90                                 else
91                                         commandLine.AppendSwitch ("/optionstrict-");
92
93                         // OptionStrictType
94                         
95                         // Platform
96                         
97                         if (References != null)
98                                 foreach (ITaskItem item in References)
99                                         commandLine.AppendSwitchIfNotNull ("/reference:", item.ItemSpec);
100         
101                         if (Bag ["RemoveIntegerChecks"] != null)
102                                 if (RemoveIntegerChecks)
103                                         commandLine.AppendSwitch ("/removeintchecks+");
104                                 else
105                                         commandLine.AppendSwitch ("/removeintchecks-");
106
107                         if (ResponseFiles != null)
108                                 foreach (ITaskItem item in ResponseFiles)
109                                         commandLine.AppendFileNameIfNotNull (String.Format ("@{0}", item.ItemSpec));
110
111                         commandLine.AppendSwitchIfNotNull ("/rootnamespace:", RootNamespace);
112
113                         commandLine.AppendSwitchIfNotNull ("/sdkpath:", SdkPath);
114
115                         // TargetCompactFramework
116                         
117                         // Verbosity
118
119                         // WarningsAsErrors
120
121                         // WarningsNotAsErrors
122
123                 }
124
125                 string EscapeDoubleQuotes (string text)
126                 {
127                         if (text == null)
128                                 return null;
129
130                         return text.Replace ("\"", "\\\"");
131                 }
132                 
133                 [MonoTODO]
134                 protected override bool CallHostObjectToExecute ()
135                 {
136                         throw new NotImplementedException ();
137                 }
138                 
139                 [MonoTODO]
140                 protected override string GenerateFullPathToTool ()
141                 {
142                         return Path.Combine (ToolPath, ToolExe);
143                 }
144                 
145                 [MonoTODO]
146                 protected override HostObjectInitializationStatus InitializeHostObject ()
147                 {
148                         throw new NotImplementedException ();
149                 }
150
151                 [MonoTODO]
152                 protected override bool ValidateParameters ()
153                 {
154                         throw new NotImplementedException ();
155                 }
156                 
157                 [MonoTODO]
158                 public string BaseAddress {
159                         get { return (string) Bag ["BaseAddress"]; }
160                         set { Bag ["BaseAddress"] = value; }
161                 }
162                 
163                 [MonoTODO]
164                 public string DisabledWarnings  {
165                         get { return (string) Bag ["DisabledWarnings"]; }
166                         set { Bag ["DisabledWarnings"] = value; }
167                 }
168                 
169                 [MonoTODO]
170                 public string DocumentationFile {
171                         get { return (string) Bag ["DocumentationFile"]; }
172                         set { Bag ["DocumentationFile"] = value; }
173                 }
174                 
175                 [MonoTODO]
176                 public string ErrorReport {
177                         get { return (string) Bag ["ErrorReport"]; }
178                         set { Bag ["ErrorReport"] = value; }
179                 }
180                 
181                 [MonoTODO]
182                 public bool GenerateDocumentation {
183                         get { return GetBoolParameterWithDefault ("GenerateDocumentation", false); }
184                         set { Bag ["GenerateDocumentation"] = value; }
185                 }
186                 
187                 [MonoTODO]
188                 public ITaskItem [] Imports {
189                         get { return (ITaskItem []) Bag ["Imports"]; }
190                         set { Bag ["Imports"] = value; }
191                 }
192                 
193                 [MonoTODO]
194                 public bool NoStandardLib {
195                         get { return GetBoolParameterWithDefault ("NoStandardLib", false); }
196                         set { Bag ["NoStandardLib"] = value; }
197                 }
198                 
199                 [MonoTODO]
200                 public bool NoWarnings {
201                         get { return GetBoolParameterWithDefault ("NoWarnings", false); }
202                         set { Bag ["NoWarnings"] = value; }
203                 }
204                 
205                 [MonoTODO]
206                 public string OptionCompare {
207                         get { return (string) Bag ["OptionCompare"]; }
208                         set { Bag ["OptionCompare"] = value; }
209                 }
210                 
211                 [MonoTODO]
212                 public bool OptionExplicit {
213                         get { return GetBoolParameterWithDefault ("OptionExplicit", false); }
214                         set { Bag ["OpExplicit"] = value; }
215                 }
216                 
217                 [MonoTODO]
218                 public bool OptionStrict {
219                         get { return GetBoolParameterWithDefault ("OptionStrict", false); }
220                         set { Bag ["OptionStrict"] = value; }
221                 }
222                 
223                 [MonoTODO]
224                 public string OptionStrictType {
225                         get { return (string) Bag ["OptionStrictType"]; }
226                         set { Bag ["OptionStrictType"] = value; }
227                 }
228                 
229                 [MonoTODO]
230                 public string Platform {
231                         get { return (string) Bag ["Platfrom"]; }
232                         set { Bag ["Platform"] = value; }
233                 }
234                 
235                 [MonoTODO]
236                 public bool RemoveIntegerChecks {
237                         get { return GetBoolParameterWithDefault ("RemoveIntegerChecks", false); }
238                         set { Bag ["RemoveIntegerChecks"] = value; }
239                 }
240
241                 [MonoTODO]
242                 public string RootNamespace {
243                         get { return (string) Bag ["RootNamespace"]; }
244                         set { Bag ["RootNamespace"] = value; }
245                 }
246
247                 [MonoTODO]
248                 public string SdkPath {
249                         get { return (string) Bag ["SdkPath"]; }
250                         set { Bag ["SdkPath"] = value; }
251                 }
252
253                 [MonoTODO]
254                 public bool TargetCompactFramework {
255                         get { return (bool) Bag ["TargetCompactFramework"]; }
256                         set { Bag ["TargetCompactFramework"] = value; }
257                 }
258
259                 [MonoTODO]
260                 protected override string ToolName {
261                         get { return Utilities.RunningOnWindows ? "vbnc.bat" : "vbnc"; }
262                 }
263
264                 [MonoTODO]
265                 public bool UseHostCompilerIfAvailable {
266                         get { return (bool) Bag ["UseHostCompilerIfAvailable"]; }
267                         set { Bag ["UseHostCompilerIfAvailable"] = value; }
268                 }
269
270                 [MonoTODO]
271                 public string Verbosity {
272                         get { return (string) Bag ["Verbosity"]; }
273                         set { Bag ["Verbosity"] = value; }
274                 }
275
276                 [MonoTODO]
277                 public string WarningsAsErrors {
278                         get { return (string) Bag ["WarningsAsErrors"]; }
279                         set { Bag ["WarningsAsErrors"] = value; }
280                 }
281                 
282                 [MonoTODO]
283                 public string WarningsNotAsErrors {
284                         get { return (string) Bag ["WarningsNotAsErrors"]; }
285                         set { Bag ["WarningsNotAsErrors"] = value; }
286                 }
287         }
288 }
289
290 #endif