New test.
[mono.git] / mcs / class / Microsoft.Build.Tasks / Microsoft.Build.Tasks / ManagedCompiler.cs
index a454de71646b131bab50d2c3c6ad346143f214d1..f2c11375b71ddff95653b4199b7988161f7a6eb9 100644 (file)
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
+#if NET_2_0
+
 using System;
+using System.Collections;
 using System.IO;
 using System.Text;
 using Microsoft.Build.Framework;
@@ -37,16 +40,69 @@ namespace Microsoft.Build.Tasks {
                {
                }
 
+               [MonoTODO]
                protected internal override void AddCommandLineCommands (
                                                 CommandLineBuilderExtension commandLine)
                {
                }
 
+               [MonoTODO]
                protected internal override void AddResponseFileCommands (
                                                 CommandLineBuilderExtension commandLine)
                {
-               }
-
+                       commandLine.AppendSwitchIfNotNull ("/lib:", AdditionalLibPaths, ",");
+                       commandLine.AppendSwitchIfNotNull ("/addmodule:", AddModules, ",");
+                       //commandLine.AppendSwitchIfNotNull ("/codepage:", CodePage.ToString ());
+                       //debugType
+                       commandLine.AppendSwitchIfNotNull ("/define:", DefineConstants);
+                       //delaySign
+                       if (EmitDebugInformation)
+                               commandLine.AppendSwitch ("/debug");
+                       //fileAlignment
+                       commandLine.AppendSwitchIfNotNull ("/keycontainer:", KeyContainer);
+                       commandLine.AppendSwitchIfNotNull ("/keyfile:", KeyFile);
+                       // FIXME: add ids from metadata
+                       if (LinkResources != null) {
+                               foreach (ITaskItem item in LinkResources) {
+                                               commandLine.AppendSwitchIfNotNull ("/linkresource:", item.ItemSpec);
+                               }
+                       }
+                       commandLine.AppendSwitchIfNotNull ("/main:", MainEntryPoint);
+                       if (NoConfig)
+                               commandLine.AppendSwitch ("/noconfig");
+                       if (Optimize)
+                               commandLine.AppendSwitch ("/optimize");
+                       if (OutputAssembly != null)
+                               commandLine.AppendSwitchIfNotNull ("/out:", OutputAssembly.ItemSpec);
+                       if (References != null) {
+                               foreach (ITaskItem item in References) {
+                                       commandLine.AppendSwitchIfNotNull ("/reference:", item.ItemSpec);
+                               }
+                       }
+                       if (Resources != null) {
+                               foreach (ITaskItem item in Resources) {
+                                               commandLine.AppendSwitchIfNotNull ("/resource:", item.ItemSpec);
+                               }
+                       }
+                       if (ResponseFiles != null) {
+                               foreach (ITaskItem item in ResponseFiles) {
+                                               commandLine.AppendFileNameIfNotNull (String.Format ("@{0}",item.ItemSpec));
+                               }
+                       }
+                       if (Sources != null) {
+                               foreach (ITaskItem item in Sources) {
+                                               commandLine.AppendFileNameIfNotNull (item.ItemSpec);
+                               }
+                       }
+                       if (TargetType != null)
+                               commandLine.AppendSwitchIfNotNull ("/target:", TargetType);
+                       if (TreatWarningsAsErrors)
+                               commandLine.AppendSwitch ("/warnaserror");
+                       commandLine.AppendSwitchIfNotNull ("/win32icon:", Win32Icon);
+                       commandLine.AppendSwitchIfNotNull ("/win32res:", Win32Resource);
+               }
+
+               [MonoTODO]
                protected bool CheckAllReferencesExistOnDisk ()
                {
                        foreach (ITaskItem item in (ITaskItem[])Bag ["References"]) 
@@ -55,17 +111,35 @@ namespace Microsoft.Build.Tasks {
                        return true;
                }
 
+               [MonoTODO]
                protected void CheckHostObjectSupport (string parameterName,
                                                       bool resultFromHostObjectSetOperation)
                {
                }
                
-               protected override bool HandleTaskExecutionErrors (int exitCode,
-                                                                  bool taskLoggedErrors)
+               [MonoTODO]
+               protected override bool HandleTaskExecutionErrors ()
                {
                        return true;
                }
+               
+               [MonoTODO]
+               protected bool ListHasNoDuplicateItems (ITaskItem[] itemList,
+                                                       string parameterName)
+               {
+                       Hashtable items = new Hashtable ();
+                       
+                       foreach (ITaskItem item in itemList) {
+                               if (items.Contains (item.ItemSpec))
+                                       items.Add (item.ItemSpec, null);
+                               else
+                                       return false;
+                       }
+                       
+                       return true;
+               }
 
+               [MonoTODO]
                protected override bool ValidateParameters ()
                {
                        return true;
@@ -151,6 +225,7 @@ namespace Microsoft.Build.Tasks {
                        set { Bag ["Optimize"] = value; }
                }
 
+               [Output]
                public ITaskItem OutputAssembly {
                        get { return (ITaskItem) Bag ["OutputAssembly"]; }
                        set { Bag ["OutputAssembly"] = value; }
@@ -180,8 +255,11 @@ namespace Microsoft.Build.Tasks {
                        get { return Console.Error.Encoding; }
                }
 
+               // FIXME: hack to get build of hello world working
                public string TargetType {
-                       get { return (string) Bag ["TargetType"]; }
+                       get {
+                               return  (Bag.Contains ("TargetType")) ? (((string) Bag ["TargetType"]).ToLower ()) : null;
+                       }
                        set { Bag ["TargetType"] = value; }
                }
 
@@ -206,3 +284,5 @@ namespace Microsoft.Build.Tasks {
                }
        }
 }
+
+#endif