Fix tarball package build broken by 8f130a6e17c3729f32c3bf930941ab6587f6fe38
[mono.git] / mcs / tools / xbuild / Parameters.cs
index 0dab523418c62c2fab0e00b8373bb19d98088be4..8ecaeccd42a9447c54ad5b6cbf336dc0e8a74da3 100644 (file)
@@ -25,7 +25,6 @@
 // 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;
@@ -43,7 +42,6 @@ namespace Mono.XBuild.CommandLine {
        
                string                  consoleLoggerParameters;
                bool                    displayHelp;
-               bool                    displayVersion;
                IList                   flatArguments;
                IList                   loggers;
                LoggerVerbosity         loggerVerbosity;
@@ -56,14 +54,14 @@ namespace Mono.XBuild.CommandLine {
                string[]                targets;
                bool                    validate;
                string                  validationSchema;
+               string                  toolsVersion;
                
                string                  responseFile;
        
-               public Parameters (string binPath)
+               public Parameters ()
                {
                        consoleLoggerParameters = "";
                        displayHelp = false;
-                       displayVersion = true;
                        loggers = new ArrayList ();
                        loggerVerbosity = LoggerVerbosity.Normal;
                        noConsoleLogger = false;
@@ -82,6 +80,7 @@ namespace Mono.XBuild.CommandLine {
                        flatArguments = new ArrayList ();
                        remainingArguments = new ArrayList ();
                        responseFiles = new Hashtable ();
+                       FileLoggerParameters = new string[10];
                        foreach (string s in args) {
                                if (s.StartsWith ("/noautoresponse") || s.StartsWith ("/noautorsp")) {
                                        autoResponse = false;
@@ -223,8 +222,19 @@ namespace Mono.XBuild.CommandLine {
                        case "/val":
                                validate = true;
                                break;
+                       case "/fl":
+                       case "/filelogger":
+                               if (FileLoggerParameters [0] == null)
+                                       FileLoggerParameters [0] = String.Empty;
+                               break;
                        default:
-                               if (s.StartsWith ("/target:") || s.StartsWith ("/t:")) {
+                               if (s.StartsWith ("/fl") && s.Length == 4 && Char.IsDigit (s[3])) {
+                                       int index = Int32.Parse (s[3].ToString ());
+                                       if (FileLoggerParameters [index] == null)
+                                               FileLoggerParameters [index] = String.Empty;
+                               } else if (s.StartsWith ("/fileloggerparameters") || s.StartsWith ("/flp")) {
+                                       ProcessFileLoggerParameters (s);
+                               } else if (s.StartsWith ("/target:") || s.StartsWith ("/t:")) {
                                        ProcessTarget (s);
                                } else if (s.StartsWith ("/property:") || s.StartsWith ("/p:")) {
                                        if (!ProcessProperty (s))
@@ -237,6 +247,8 @@ namespace Mono.XBuild.CommandLine {
                                        ProcessConsoleLoggerParameters (s);
                                } else if (s.StartsWith ("/validate:") || s.StartsWith ("/val:")) {
                                        ProcessValidate (s);
+                               } else if (s.StartsWith ("/toolsversion:") || s.StartsWith ("/tv:")) {
+                                       ToolsVersion = s.Split (':') [1];
                                } else
                                        return false;
                                break;
@@ -326,10 +338,29 @@ namespace Mono.XBuild.CommandLine {
                                break;
                        }
                }
-               
+
+               void ProcessFileLoggerParameters (string s)
+               {
+                       int colon = s.IndexOf (':');
+                       if (colon + 1 == s.Length)
+                               ReportError (5, "Invalid syntax, specify parameters as /fileloggerparameters[n]:parameters");
+
+                       int index = 0;
+                       string key = s.Substring (0, colon);
+                       if (Char.IsDigit (key [key.Length - 1]))
+                       //if (key.Length == 22 && Char.IsDigit (key [21]))
+                               index = Int32.Parse (key [key.Length - 1].ToString ());
+
+                       FileLoggerParameters [index] = s.Substring (colon + 1);
+               }
+
                internal void ProcessConsoleLoggerParameters (string s)
                {
-                       consoleLoggerParameters = s; 
+                       int colon = s.IndexOf (':');
+                       if (colon + 1 == s.Length)
+                               ReportError (5, "Invalid syntax, specify parameters as /clp:parameters");
+
+                       consoleLoggerParameters = s.Substring (colon + 1);
                }
                
                internal void ProcessValidate (string s)
@@ -347,10 +378,6 @@ namespace Mono.XBuild.CommandLine {
                        get { return noLogo; }
                }
                
-               public bool DisplayVersion {
-                       get { return displayVersion; }
-               }
-               
                public string ProjectFile {
                        get { return projectFile; }
                }
@@ -378,6 +405,8 @@ namespace Mono.XBuild.CommandLine {
                public bool NoConsoleLogger {
                        get { return noConsoleLogger; }
                }
+
+               public string[] FileLoggerParameters { get; set; }
                
                public bool Validate {
                        get { return validate; }
@@ -386,8 +415,12 @@ namespace Mono.XBuild.CommandLine {
                public string ValidationSchema {
                        get { return validationSchema; }
                }
+
+               public string ToolsVersion {
+                       get { return toolsVersion; }
+                       private set { toolsVersion = value; }
+               }
                
        }
 }
 
-#endif