* mono-api-diff.cs: Fixed line endings.
[mono.git] / mcs / tools / xbuild / Parameters.cs
index 8b4f80a8d3520c197618b03c53fa61ddebf7c15f..4c704007bb6325e4a183b86f6aa1b6bc5fda0281 100644 (file)
@@ -25,6 +25,8 @@
 // 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.IO;
 using System.Collections;
@@ -54,7 +56,7 @@ namespace Mono.XBuild.CommandLine {
                
                string                  responseFile;
        
-               public Parameters (MainClass mc)
+               public Parameters (string binPath)
                {
                        consoleLoggerParameters = "";
                        displayHelp = false;
@@ -66,7 +68,7 @@ namespace Mono.XBuild.CommandLine {
                        properties = new BuildPropertyGroup ();
                        targets = new string [0];
                        
-                       responseFile = Path.Combine (mc.BinPath, "xbuild.rsp");
+                       responseFile = Path.Combine (binPath, "xbuild.rsp");
                }
                
                public void ParseArguments (string[] args)
@@ -86,7 +88,7 @@ namespace Mono.XBuild.CommandLine {
                                }
                                string responseFilename = Path.GetFullPath (s.Substring (1));
                                if (responseFiles.ContainsKey (responseFilename))
-                                       throw new CommandLineException ("We already have " + responseFilename + "file.", 0001);
+                                       ErrorUtilities.ReportError (1, String.Format ("We already have {0} file.", responseFilename));
                                responseFiles [responseFilename] = responseFilename;
                                LoadResponseFile (responseFilename);
                        }
@@ -105,15 +107,15 @@ namespace Mono.XBuild.CommandLine {
                                if (files.Length > 0)
                                        projectFile = files [0];
                                else
-                                       throw new CommandLineException ("No .proj file specified and no found in current directory.", 0003);
+                                       ErrorUtilities.ReportError (3, "No .proj file specified and no found in current directory.");
                        } else if (remainingArguments.Count == 1) {
                                projectFile = (string) remainingArguments [0];
                        } else {
-                               throw new CommandLineException ("Too many project files specified.", 0004);
+                               ErrorUtilities.ReportError (4, "Too many project files specified");
                        }
                }
                
-               private void LoadResponseFile (string filename)
+               void LoadResponseFile (string filename)
                {
                        StreamReader sr = null;
                        string line;
@@ -150,9 +152,10 @@ namespace Mono.XBuild.CommandLine {
                                                 sb.Length = 0;
                                         }
                                 }
-                        } catch (Exception ex) {
-                                throw new CommandLineException ("Error during loading response file.", ex, 0002);
-                        } finally {
+                        } catch (Exception) {
+                               // FIXME: we lose exception message
+                               ErrorUtilities.ReportError (2, "Error during loading response file.");
+                       } finally {
                                 if (sr != null)
                                         sr.Close ();
                         }
@@ -164,13 +167,15 @@ namespace Mono.XBuild.CommandLine {
                        case "/help":
                        case "/h":
                        case "/?":
-                               throw new CommandLineException ("Show usage", 0006);
+                               ErrorUtilities.ShowUsage ();
+                               break;
                        case "/nologo":
                                noLogo = true;
                                break;
                        case "/version":
                        case "/ver":
-                               throw new CommandLineException ("Show version", 0005);
+                               ErrorUtilities.ShowVersion (true);
+                               break;
                        case "/noconsolelogger":
                        case "/noconlog":
                                noConsoleLogger = true;
@@ -215,7 +220,7 @@ namespace Mono.XBuild.CommandLine {
                        splittedProperties = parameter [1].Split (';');
                        foreach (string st in splittedProperties) {
                                property = st.Split ('=');
-                               properties.AddNewProperty (property [0], property [1]);
+                               properties.SetProperty (property [0], property [1]);
                        }
                }
                
@@ -312,4 +317,6 @@ namespace Mono.XBuild.CommandLine {
                }
                
        }
-}
\ No newline at end of file
+}
+
+#endif