Beispiel #1
0
        public virtual IEnumerable <CompilerMessage> Parse(string[] errorOutput, string[] standardOutput, bool compilationHadFailure)
        {
            bool flag = false;
            List <CompilerMessage> compilerMessageList = new List <CompilerMessage>();
            Regex outputRegex = this.GetOutputRegex();

            foreach (string line in errorOutput)
            {
                string input = line.Length <= 1000 ? line : line.Substring(0, 100);
                Match  match = outputRegex.Match(input);
                if (match.Success)
                {
                    CompilerMessage fromMatchedRegex = CompilerOutputParserBase.CreateCompilerMessageFromMatchedRegex(line, match, this.GetErrorIdentifier());
                    fromMatchedRegex.normalizedStatus = this.NormalizedStatusFor(match);
                    if (fromMatchedRegex.type == CompilerMessageType.Error)
                    {
                        flag = true;
                    }
                    compilerMessageList.Add(fromMatchedRegex);
                }
            }
            if (compilationHadFailure && !flag)
            {
                compilerMessageList.Add(CompilerOutputParserBase.CreateInternalCompilerErrorMessage(errorOutput));
            }
            return((IEnumerable <CompilerMessage>)compilerMessageList);
        }
        protected override NormalizedCompilerStatus NormalizedStatusFor(Match match)
        {
            string arg_29_1 = "0018";
            Regex  arg_29_2 = UnityScriptCompilerOutputParser.sUnknownTypeOrNamespace;

            if (UnityScriptCompilerOutputParser.< > f__mg$cache0 == null)
            {
                UnityScriptCompilerOutputParser.< > f__mg$cache0 = new Func <Match, Regex, NormalizedCompilerStatus>(CompilerOutputParserBase.NormalizeSimpleUnknownTypeOfNamespaceError);
            }
            NormalizedCompilerStatus normalizedCompilerStatus = CompilerOutputParserBase.TryNormalizeCompilerStatus(match, arg_29_1, arg_29_2, UnityScriptCompilerOutputParser.< > f__mg$cache0);
            NormalizedCompilerStatus result;

            if (normalizedCompilerStatus.code != NormalizedCompilerStatusCode.NotNormalized)
            {
                result = normalizedCompilerStatus;
            }
            else
            {
                string arg_6A_1 = "0005";
                Regex  arg_6A_2 = UnityScriptCompilerOutputParser.sUnknownTypeOrNamespace;
                if (UnityScriptCompilerOutputParser.< > f__mg$cache1 == null)
                {
                    UnityScriptCompilerOutputParser.< > f__mg$cache1 = new Func <Match, Regex, NormalizedCompilerStatus>(CompilerOutputParserBase.NormalizeSimpleUnknownTypeOfNamespaceError);
                }
                result = CompilerOutputParserBase.TryNormalizeCompilerStatus(match, arg_6A_1, arg_6A_2, UnityScriptCompilerOutputParser.< > f__mg$cache1);
            }
            return(result);
        }
Beispiel #3
0
		internal static void RunManagedProgram(string exe, string args, string workingDirectory, CompilerOutputParserBase parser)
		{
			using (ManagedProgram managedProgram = new ManagedProgram(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), "4.0", exe, args))
			{
				managedProgram.GetProcessStartInfo().WorkingDirectory = workingDirectory;
				managedProgram.Start();
				managedProgram.WaitForExit();
				if (managedProgram.ExitCode != 0)
				{
					if (parser != null)
					{
						string[] errorOutput = managedProgram.GetErrorOutput();
						string[] standardOutput = managedProgram.GetStandardOutput();
						IEnumerable<CompilerMessage> enumerable = parser.Parse(errorOutput, standardOutput, true);
						foreach (CompilerMessage current in enumerable)
						{
							Debug.LogPlayerBuildError(current.message, current.file, current.line, current.column);
						}
					}
					Debug.LogError(string.Concat(new string[]
					{
						"Failed running ",
						exe,
						" ",
						args,
						"\n\n",
						managedProgram.GetAllOutput()
					}));
					throw new Exception(string.Format("{0} did not run properly!", exe));
				}
			}
		}
Beispiel #4
0
 internal static void RunManagedProgram(string exe, string args, string workingDirectory, CompilerOutputParserBase parser)
 {
   Stopwatch stopwatch = new Stopwatch();
   stopwatch.Start();
   Program program;
   if (Application.platform == RuntimePlatform.WindowsEditor)
     program = new Program(new ProcessStartInfo()
     {
       Arguments = args,
       CreateNoWindow = true,
       FileName = exe
     });
   else
     program = (Program) new ManagedProgram(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), "4.0", exe, args);
   using (program)
   {
     program.GetProcessStartInfo().WorkingDirectory = workingDirectory;
     program.Start();
     program.WaitForExit();
     stopwatch.Stop();
     Console.WriteLine("{0} exited after {1} ms.", (object) exe, (object) stopwatch.ElapsedMilliseconds);
     if (program.ExitCode != 0)
     {
       if (parser != null)
       {
         string[] errorOutput = program.GetErrorOutput();
         string[] standardOutput = program.GetStandardOutput();
         foreach (CompilerMessage compilerMessage in parser.Parse(errorOutput, standardOutput, true))
           UnityEngine.Debug.LogPlayerBuildError(compilerMessage.message, compilerMessage.file, compilerMessage.line, compilerMessage.column);
       }
       UnityEngine.Debug.LogError((object) ("Failed running " + exe + " " + args + "\n\n" + program.GetAllOutput()));
       throw new Exception(string.Format("{0} did not run properly!", (object) exe));
     }
   }
 }
Beispiel #5
0
 internal static void RunManagedProgram(string exe, string args, string workingDirectory, CompilerOutputParserBase parser)
 {
     using (ManagedProgram program = new ManagedProgram(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), "4.0", exe, args))
     {
         program.GetProcessStartInfo().WorkingDirectory = workingDirectory;
         program.Start();
         program.WaitForExit();
         if (program.ExitCode != 0)
         {
             if (parser != null)
             {
                 string[] errorOutput = program.GetErrorOutput();
                 string[] standardOutput = program.GetStandardOutput();
                 IEnumerator<CompilerMessage> enumerator = parser.Parse(errorOutput, standardOutput, true).GetEnumerator();
                 try
                 {
                     while (enumerator.MoveNext())
                     {
                         CompilerMessage current = enumerator.Current;
                         Debug.LogPlayerBuildError(current.message, current.file, current.line, current.column);
                     }
                 }
                 finally
                 {
                     if (enumerator == null)
                     {
                     }
                     enumerator.Dispose();
                 }
             }
             Debug.LogError("Failed running " + exe + " " + args + "\n\n" + program.GetAllOutput());
             throw new Exception(string.Format("{0} did not run properly!", exe));
         }
     }
 }
        public virtual IEnumerable <CompilerMessage> Parse(string[] errorOutput, string[] standardOutput, bool compilationHadFailure)
        {
            bool flag = false;
            List <CompilerMessage> list = new List <CompilerMessage>();
            Regex outputRegex           = this.GetOutputRegex();

            for (int i = 0; i < errorOutput.Length; i++)
            {
                string text  = errorOutput[i];
                string input = (text.Length <= 1000) ? text : text.Substring(0, 100);
                Match  match = outputRegex.Match(input);
                if (match.Success)
                {
                    CompilerMessage item = CompilerOutputParserBase.CreateCompilerMessageFromMatchedRegex(text, match, this.GetErrorIdentifier());
                    item.normalizedStatus = this.NormalizedStatusFor(match);
                    if (item.type == CompilerMessageType.Error)
                    {
                        flag = true;
                    }
                    list.Add(item);
                }
            }
            if (compilationHadFailure && !flag)
            {
                list.Add(CompilerOutputParserBase.CreateInternalCompilerErrorMessage(errorOutput));
            }
            return(list);
        }
        protected override NormalizedCompilerStatus NormalizedStatusFor(Match match)
        {
            string arg_29_1 = "CS0117";
            Regex  arg_29_2 = MonoCSharpCompilerOutputParser.sMissingMember;

            if (MonoCSharpCompilerOutputParser.< > f__mg$cache0 == null)
            {
                MonoCSharpCompilerOutputParser.< > f__mg$cache0 = new Func <Match, Regex, NormalizedCompilerStatus>(CompilerOutputParserBase.NormalizeMemberNotFoundError);
            }
            NormalizedCompilerStatus normalizedCompilerStatus = CompilerOutputParserBase.TryNormalizeCompilerStatus(match, arg_29_1, arg_29_2, MonoCSharpCompilerOutputParser.< > f__mg$cache0);
            NormalizedCompilerStatus result;

            if (normalizedCompilerStatus.code != NormalizedCompilerStatusCode.NotNormalized)
            {
                result = normalizedCompilerStatus;
            }
            else
            {
                string arg_6A_1 = "CS0246";
                Regex  arg_6A_2 = MonoCSharpCompilerOutputParser.sUnknownTypeOrNamespace;
                if (MonoCSharpCompilerOutputParser.< > f__mg$cache1 == null)
                {
                    MonoCSharpCompilerOutputParser.< > f__mg$cache1 = new Func <Match, Regex, NormalizedCompilerStatus>(CompilerOutputParserBase.NormalizeSimpleUnknownTypeOfNamespaceError);
                }
                normalizedCompilerStatus = CompilerOutputParserBase.TryNormalizeCompilerStatus(match, arg_6A_1, arg_6A_2, MonoCSharpCompilerOutputParser.< > f__mg$cache1);
                if (normalizedCompilerStatus.code != NormalizedCompilerStatusCode.NotNormalized)
                {
                    result = normalizedCompilerStatus;
                }
                else
                {
                    string arg_AB_1 = "CS0234";
                    Regex  arg_AB_2 = MonoCSharpCompilerOutputParser.sMissingType;
                    if (MonoCSharpCompilerOutputParser.< > f__mg$cache2 == null)
                    {
                        MonoCSharpCompilerOutputParser.< > f__mg$cache2 = new Func <Match, Regex, NormalizedCompilerStatus>(CompilerOutputParserBase.NormalizeUnknownTypeMemberOfNamespaceError);
                    }
                    normalizedCompilerStatus = CompilerOutputParserBase.TryNormalizeCompilerStatus(match, arg_AB_1, arg_AB_2, MonoCSharpCompilerOutputParser.< > f__mg$cache2);
                    if (normalizedCompilerStatus.code != NormalizedCompilerStatusCode.NotNormalized)
                    {
                        result = normalizedCompilerStatus;
                    }
                    else
                    {
                        string arg_EC_1 = "CS0103";
                        Regex  arg_EC_2 = MonoCSharpCompilerOutputParser.sUnknownTypeOrNamespace;
                        if (MonoCSharpCompilerOutputParser.< > f__mg$cache3 == null)
                        {
                            MonoCSharpCompilerOutputParser.< > f__mg$cache3 = new Func <Match, Regex, NormalizedCompilerStatus>(CompilerOutputParserBase.NormalizeSimpleUnknownTypeOfNamespaceError);
                        }
                        result = CompilerOutputParserBase.TryNormalizeCompilerStatus(match, arg_EC_1, arg_EC_2, MonoCSharpCompilerOutputParser.< > f__mg$cache3);
                    }
                }
            }
            return(result);
        }
        protected override NormalizedCompilerStatus NormalizedStatusFor(Match match)
        {
            string arg_29_1 = "0018";
            Regex  arg_29_2 = UnityScriptCompilerOutputParser.sUnknownTypeOrNamespace;

            if (UnityScriptCompilerOutputParser.< > f__mg$cache0 == null)
            {
                UnityScriptCompilerOutputParser.< > f__mg$cache0 = new Func <string, Regex, NormalizedCompilerStatus>(CompilerOutputParserBase.NormalizeSimpleUnknownTypeOfNamespaceError);
            }
            return(CompilerOutputParserBase.TryNormalizeCompilerStatus(match, arg_29_1, arg_29_2, UnityScriptCompilerOutputParser.< > f__mg$cache0));
        }
Beispiel #9
0
 internal static void RunManagedProgram(string exe, string args, string workingDirectory, CompilerOutputParserBase parser, Action<ProcessStartInfo> setupStartInfo)
 {
     Program program;
     Stopwatch stopwatch = new Stopwatch();
     stopwatch.Start();
     if (Application.platform == RuntimePlatform.WindowsEditor)
     {
         ProcessStartInfo info = new ProcessStartInfo {
             Arguments = args,
             CreateNoWindow = true,
             FileName = exe
         };
         if (setupStartInfo != null)
         {
             setupStartInfo(info);
         }
         program = new Program(info);
     }
     else
     {
         program = new ManagedProgram(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), null, exe, args, false, setupStartInfo);
     }
     using (program)
     {
         program.GetProcessStartInfo().WorkingDirectory = workingDirectory;
         program.Start();
         program.WaitForExit();
         stopwatch.Stop();
         Console.WriteLine("{0} exited after {1} ms.", exe, stopwatch.ElapsedMilliseconds);
         if (program.ExitCode != 0)
         {
             if (parser != null)
             {
                 string[] errorOutput = program.GetErrorOutput();
                 string[] standardOutput = program.GetStandardOutput();
                 IEnumerable<CompilerMessage> enumerable = parser.Parse(errorOutput, standardOutput, true);
                 foreach (CompilerMessage message in enumerable)
                 {
                     Debug.LogPlayerBuildError(message.message, message.file, message.line, message.column);
                 }
             }
             Debug.LogError("Failed running " + exe + " " + args + "\n\n" + program.GetAllOutput());
             throw new Exception(string.Format("{0} did not run properly!", exe));
         }
     }
 }
 private static bool StartManagedProgram(string exe, string arguments, CompilerOutputParserBase parser, ref IEnumerable<CompilerMessage> compilerMessages)
 {
   using (ManagedProgram managedProgram = GendarmeValidationRule.ManagedProgramFor(exe, arguments))
   {
     managedProgram.LogProcessStartInfo();
     try
     {
       managedProgram.Start();
     }
     catch
     {
       throw new Exception("Could not start " + exe);
     }
     managedProgram.WaitForExit();
     if (managedProgram.ExitCode == 0)
       return true;
     compilerMessages = parser.Parse(managedProgram.GetErrorOutput(), managedProgram.GetStandardOutput(), true);
   }
   return false;
 }
 protected override NormalizedCompilerStatus NormalizedStatusFor(Match match)
 {
     return(CompilerOutputParserBase.TryNormalizeCompilerStatus(match, "0019", BooCompilerOutputParser.sMissingMember));
 }
 protected override NormalizedCompilerStatus NormalizedStatusFor(Match match)
 {
     return(CompilerOutputParserBase.TryNormalizeCompilerStatus(match, "CS0117", MonoCSharpCompilerOutputParser.sMissingMember));
 }