예제 #1
0
        public void AddWarning(string text)
        {
            BuildError ce = new BuildError(null, 0, 0, null, text);

            ce.IsWarning = true;
            Append(ce);
        }
예제 #2
0
        public void AddWarning(string file, int line, int col, string errorNum, string text)
        {
            BuildError ce = new BuildError(file, line, col, errorNum, text);

            ce.IsWarning = true;
            Append(ce);
        }
예제 #3
0
 public BuildResult Append(BuildError error)
 {
     if (error == null)
     {
         return(this);
     }
     errors.Add(error);
     if (sourceTarget != null && error.SourceTarget == null)
     {
         error.SourceTarget = sourceTarget;
     }
     if (error.IsWarning)
     {
         warningCount++;
     }
     else
     {
         errorCount++;
         if (failedBuildCount == 0)
         {
             failedBuildCount = 1;
         }
     }
     return(this);
 }
예제 #4
0
        public BuildResult AddWarning(string file, int line, int col, string errorNum, string text)
        {
            var ce = new BuildError(file, line, col, errorNum, text);

            ce.IsWarning = true;
            Append(ce);
            return(this);
        }
		public static void AddTask(string fileName, string message, int column, int line, TaskSeverity taskType)
		{
			// HACK: Use a compiler error since we cannot add an error
			// task otherwise (task type property is read-only and
			// no constructors usable).
			BuildError error = new BuildError ();
			error.Column = column;
			error.Line = line;
			error.ErrorText = message;
			error.FileName = fileName;
			error.IsWarning = false;
			
			//Task task = new Task(fileName, message, column, line);
			TaskListEntry task = new TaskListEntry (error);
			TaskService.Errors.Add(task);
		}
예제 #6
0
		public static void HandleLdOutput(AbstractDProject prj, BuildResult br, string linkerOutput)
		{
			var ctxt = ResolutionContext.Create(DResolverWrapper.CreateParseCacheView(prj), null, null);

			ctxt.ContextIndependentOptions =
				ResolutionOptions.IgnoreAllProtectionAttributes |
				ResolutionOptions.DontResolveBaseTypes |
				ResolutionOptions.DontResolveBaseClasses |
				ResolutionOptions.DontResolveAliases;

			foreach (Match m in ldErrorRegex.Matches(linkerOutput))
			{
				var error = new BuildError();

				var firstSymbolOccurring = ldMangleRegex.Match(m.Groups["err"].Value);

				if(firstSymbolOccurring.Success)
				{
					var mangledString = "_D" + firstSymbolOccurring.Groups["mangle"].Value;
					var associatedSymbol = DResolver.GetResultMember(Demangler.DemangleAndResolve(mangledString, ctxt));
					if(associatedSymbol != null)
					{
						error.FileName = (associatedSymbol.NodeRoot as DModule).FileName;
						error.Line = associatedSymbol.Location.Line;
						error.Column = associatedSymbol.Location.Column;
					}
				}

				error.ErrorText = m.Groups["msg"].Value;
				if (string.IsNullOrWhiteSpace(error.ErrorText))
					error.ErrorText = m.Groups["err"].Value;

				error.ErrorText = DemangleLdOutput(error.ErrorText);

				br.Append(error);
			}
		}
예제 #7
0
        public static BuildError FindError(string errorString, TextReader reader)
        {
            var error = new BuildError();

            var match = dmdCompileRegex.Match(errorString);
            int line = 0;

            if (match.Success)
            {
                error.FileName = match.Groups["file"].Value;
                int.TryParse(match.Groups["line"].Value, out line);
                error.Line = line;
				if(int.TryParse(match.Groups["col"].Value, out line))
					error.Column = line;
				error.IsWarning = IsWarning(match.Groups ["type"].Value);
                error.ErrorText = match.Groups["message"].Value;

                return error;
            }


            match = withColRegex.Match(errorString);

            if (match.Success)
            {
                error.FileName = match.Groups["file"].Value;
                error.Line = int.Parse(match.Groups["line"].Value);
				if(int.TryParse(match.Groups["column"].Value, out line))
					error.Column = line;
				error.IsWarning = IsWarning(match.Groups ["level"].Value);
                error.ErrorText = match.Groups["message"].Value;

				// Skip messages that begin with ( and end with ), since they're generic.
				//Attempt to capture multi-line versions too.
				if (error.ErrorText.StartsWith("("))
				{
					string error_continued = error.ErrorText;
					do
					{
						if (error_continued.EndsWith(")"))
							return null;
					} while ((error_continued = reader.ReadLine()) != null);
				}

                return error;
            }

            match = noColRegex_2.Match(errorString);
            if (match.Success)
            {
                error.FileName = match.Groups["file"].Value;
				int i;
				int.TryParse(match.Groups["line"].Value, out i);
				error.Line = i;
				error.IsWarning = IsWarning(match.Groups ["level"].Value);
                error.ErrorText = match.Groups["message"].Value;

				if(error.FileName.Length > 0 || error.ErrorText.Length > 0)
					return error;
            }

            match = gcclinkerRegex.Match(errorString);
            if (match.Success)
            {
                error.FileName = match.Groups["file"].Value;
                error.Line = int.Parse(match.Groups["line"].Value);
				error.IsWarning = IsWarning(match.Groups ["level"].Value);
                error.ErrorText = match.Groups["message"].Value;
                return error;
            }
            return null;
        }
        static BuildError CreateErrorFromString(string error_string)
        {
            // When IncludeDebugInformation is true, prevents the debug symbols stats from breaking this.
            if (error_string.StartsWith ("WROTE SYMFILE") ||
                error_string.StartsWith ("OffsetTable") ||
                error_string.StartsWith ("Compilation succeeded") ||
                error_string.StartsWith ("Compilation failed"))
                return null;

            Match match = regexError.Match(error_string);
            if (!match.Success)
                return null;

            BuildError error = new BuildError ();
            error.FileName = match.Result ("${file}") ?? "";

            string line = match.Result ("${line}");
            error.Line = !string.IsNullOrEmpty (line) ? Int32.Parse (line) : 0;

            string col = match.Result ("${column}");
            if (!string.IsNullOrEmpty (col))
                error.Column = col == "255+" ? -1 : Int32.Parse (col);

            error.IsWarning   = match.Result ("${level}") == "warning";
            error.ErrorNumber = match.Result ("${number}");
            error.ErrorText   = match.Result ("${message}");
            return error;
        }
예제 #9
0
		public TaskListEntry (BuildError error, object owner)
		{
			parentObject = error.SourceTarget as WorkspaceObject;
			file = error.FileName;
			this.owner = owner;
			description = error.ErrorText;
			column = error.Column;
			line = error.Line;
			if (!string.IsNullOrEmpty (error.ErrorNumber))
				description += " (" + error.ErrorNumber + ")";
			if (error.IsWarning)
				severity = error.ErrorNumber == "COMMENT" ? TaskSeverity.Information : TaskSeverity.Warning;
			else
				severity = TaskSeverity.Error;
			priority = TaskPriority.Normal;
			code = error.ErrorNumber;
			category = error.Subcategory;
			helpKeyword = error.HelpKeyword;
		}
예제 #10
0
		public TaskListEntry (BuildError error)
			: this (error, null)
		{
		}
예제 #11
0
        static BuildError CreateErrorFromString(string text)
        {
            Match match = mErrorIgnore.Match(text);
            if (match.Success)
                return null;

            match = mErrorFull.Match(text);
            if (!match.Success)
                match = mErrorCmdLine.Match(text);
            if (!match.Success)
                match = mErrorFile.Match(text);
            if (!match.Success)
                match = mErrorSimple.Match(text);
            if (!match.Success)
                return null;

            int n;

            BuildError error = new BuildError();
            error.FileName = match.Result("${file}") ?? "";
            error.IsWarning = match.Result("${level}").ToLower() == "warning";
            error.ErrorText = match.Result("${message}");

            if (error.FileName == "${file}")
                error.FileName = "";

            if (Int32.TryParse(match.Result("${line}"), out n))
                error.Line = n;
            else
                error.Line = 0;

            if (Int32.TryParse(match.Result("${column}"), out n))
                error.Column = n;
            else
                error.Column = -1;

            return error;
        }
예제 #12
0
		public void AddWarning (string file, int line, int col, string errorNum, string text)
		{
			BuildError ce = new BuildError (file, line, col, errorNum, text);
			ce.IsWarning = true;
			Append (ce);
		}
예제 #13
0
        private void HandleOptLinkOutput(BuildResult br, string linkerOutput)
        {
            var matches = optlinkRegex.Matches (linkerOutput);

            var ctxt = ResolutionContext.Create(Project == null ?
                                                ParseCacheList.Create(DCompilerService.Instance.GetDefaultCompiler().ParseCache) :
                                                Project.ParseCache, null, null);

            ctxt.ContextIndependentOptions =
                ResolutionOptions.IgnoreAllProtectionAttributes |
                ResolutionOptions.DontResolveBaseTypes |
                ResolutionOptions.DontResolveBaseClasses |
                ResolutionOptions.DontResolveAliases;

            foreach (Match match in matches) {
                var error = new BuildError ();

                // Get associated D source file
                if (match.Groups ["obj"].Success) {
                    var obj = Project.GetAbsoluteChildPath (new FilePath (match.Groups ["obj"].Value)).ChangeExtension (".d");

                    foreach (var pf in Project.Files)
                        if (pf.FilePath == obj) {
                            error.FileName = pf.FilePath;
                            break;
                        }
                }

                var msg = match.Groups ["message"].Value;

                var symUndefMatch = symbolUndefRegex.Match(msg);

                if(symUndefMatch.Success && symUndefMatch.Groups["mangle"].Success)
                {
                    var mangledSymbol = symUndefMatch.Groups["mangle"].Value;
                    ITypeDeclaration qualifier;
                    try{
                        var resSym = D_Parser.Misc.Mangling.Demangler.DemangleAndResolve(mangledSymbol, ctxt, out qualifier);
                        if(resSym is DSymbol)
                        {
                            var ds = resSym as DSymbol;
                            var ast = ds.Definition.NodeRoot as DModule;
                            if(ast!=null)
                                error.FileName = ast.FileName;
                            error.Line = ds.Definition.Location.Line;
                            error.Column = ds.Definition.Location.Column;
                            msg = ds.Definition.ToString(false, true);
                        }
                        else
                            msg = qualifier.ToString();
                    }catch(Exception ex)
                    {
                        msg = "<log analysis error> "+ex.Message;
                    }
                    error.ErrorText = msg + " could not be resolved - library reference missing?";
                }
                else
                    error.ErrorText = "Linker error " + match.Groups ["code"].Value + " - " + msg;

                br.Append (error);
            }
        }
예제 #14
0
		public BuildResult AddWarning (string file, int line, int col, string errorNum, string text)
		{
			var ce = new BuildError (file, line, col, errorNum, text);
			ce.IsWarning = true;
			Append (ce);
			return this;
		}
		public void AddWarning (string text)
		{
			BuildError ce = new BuildError (null, 0, 0, null, text);
			ce.IsWarning = true;
			Append (ce);
		}
예제 #16
0
		public Task (BuildError error, object owner)
		{
			parentObject = error.SourceTarget;
			file = error.FileName;
			description = error.ErrorText;
			column = error.Column;
			line = error.Line;
			if (!string.IsNullOrEmpty (error.ErrorNumber))
				description += " (" + error.ErrorNumber + ")";
			if (error.IsWarning)
				severity = error.ErrorNumber == "COMMENT" ? TaskSeverity.Information : TaskSeverity.Warning;
			else
				severity = TaskSeverity.Error;
			priority = TaskPriority.Normal;
			code = error.ErrorNumber;
		}
예제 #17
0
		public Task (BuildError error)
			: this (error, null)
		{
		}
예제 #18
0
        BuildResult ParseOutput(TypeScriptProject project, string stdOutAndErr)
        {
            BuildResult result = new BuildResult ();

            StringBuilder output = new StringBuilder ();
            bool enteredStackTrace = false;
            string next = string.Empty;
            foreach (var l in stdOutAndErr.Split ('\n').Select (l => l.Trim ()).Concat (new string [] {""})) {
                var line = next;
                next = l;
                output.AppendLine (line);

                if (next == "throw err;") {
                    result.Append (new BuildError () { ErrorText = "Internal compiler error occured. Check build output for details."});
                    enteredStackTrace = true;
                }

                if (enteredStackTrace || line.Length == 0 || line.StartsWith ("\t"))
                    continue;

                var error = new BuildError ();
                var match = error_rex.Match (line);
                if (match.Length > 0) {
                    error.FileName = match.Groups [1].ToString ().TrimEnd (' ');
                    error.Line = int.Parse (match.Groups [2].ToString ());
                    error.Column = int.Parse (match.Groups [3].ToString ());
                    error.ErrorText = match.Groups [4].ToString ();
                }
                else
                    error.ErrorText = line;
                result.Append (error);
            }

            result.CompilerOutput = output.ToString ();

            return result;
        }
예제 #19
0
        private void HandleOptLinkOutput(BuildResult br, string linkerOutput)
        {
            var matches = optlinkRegex.Matches (linkerOutput);

            foreach (Match match in matches) {
                var error = new BuildError ();

                // Get associated D source file
                if (match.Groups ["obj"].Success) {
                    var obj = Project.GetAbsoluteChildPath (new FilePath (match.Groups ["obj"].Value)).ChangeExtension (".d");

                    foreach (var pf in Project.Files)
                        if (pf.FilePath == obj) {
                            error.FileName = pf.FilePath;
                            break;
                        }
                }

                error.ErrorText = "Linker error " + match.Groups ["code"].Value + " - " + match.Groups ["message"].Value;

                br.Append (error);
            }
        }
예제 #20
0
        private static BuildError CreateErrorFromString(HaxeProject project, string text)
        {
            Match match = mErrorIgnore.Match (text);
            if (match.Success)
                return null;

            match = mErrorFull.Match (text);
            if (!match.Success)
                match = mErrorCmdLine.Match (text);
            if (!match.Success)
                match = mErrorFileChar.Match (text);
            if (!match.Success)
                match = mErrorFileChars.Match (text);
            if (!match.Success)
                match = mErrorFile.Match (text);

            if (!match.Success)
                match = mErrorSimple.Match (text);
            if (!match.Success)
                return null;

            int n;

            BuildError error = new BuildError ();
            error.FileName = match.Result ("${file}") ?? "";
            error.IsWarning = match.Result ("${level}").ToLower () == "warning";
            error.ErrorText = match.Result ("${message}");

            if (error.FileName == "${file}")
            {
                error.FileName = "";
            }
            else
            {
                if (!File.Exists (error.FileName))
                {
                    if (File.Exists (Path.GetFullPath (error.FileName)))
                    {
                        error.FileName = Path.GetFullPath (error.FileName);
                    }
                    else
                    {
                        error.FileName = Path.Combine (project.BaseDirectory, error.FileName);
                    }
                }
            }

            if (Int32.TryParse (match.Result ("${line}"), out n))
                error.Line = n;
            else
                error.Line = 0;

            if (Int32.TryParse (match.Result ("${column}"), out n))
                error.Column = n+1; //haxe counts zero based
            else
                error.Column = -1;

            return error;
        }
예제 #21
0
		public BuildResult Append (BuildError error)
		{
			if (error == null)
				return this;
			errors.Add (error);
			if (sourceTarget != null && error.SourceTarget == null)
				error.SourceTarget = sourceTarget;
			if (error.IsWarning)
				warningCount++;
			else {
				errorCount++;
				if (failedBuildCount == 0)
					failedBuildCount = 1;
			}
			return this;
		}