Example #1
0
        public void MessageRaised(object sender, BuildMessageEventArgs args)
        {
            try
            {
                lock (syncLock)
                {
                    if (args.GetType().Name == "TargetSkippedEventArgs")
                    {
                        if (args is TargetSkippedEventArgs targetSkipped)
                        {
                            TargetSkipped(targetSkipped);
                        }
                        else
                        {
                            targetSkipped = new TargetSkippedEventArgs();
                            targetSkipped.BuildEventContext = args.BuildEventContext;
                            targetSkipped.TargetName        = Reflector.GetTargetNameFromTargetSkipped(args);
                            targetSkipped.TargetFile        = Reflector.GetTargetFileFromTargetSkipped(args);
                            targetSkipped.ParentTarget      = Reflector.GetParentTargetFromTargetSkipped(args);
                            targetSkipped.BuildReason       = Reflector.GetBuildReasonFromTargetSkipped(args);
                            TargetSkipped(targetSkipped);
                        }

                        return;
                    }

                    messageProcessor.Process(args);
                }
            }
            catch (Exception ex)
            {
                HandleException(ex);
            }
        }
Example #2
0
        void eventSource_MessageRaised(object sender, BuildMessageEventArgs e)
        {
            if (e.GetType() == typeof(TaskCommandLineEventArgs))
            {
                TaskCommandLineEventArgs cl = (TaskCommandLineEventArgs)e;

                MFuVisionGenerator.EnqueueItem(cl.Message, Directory.GetCurrentDirectory(), this.ProjectBuildContext);
            }
        }
 public BuildMessage(BuildMessageEventArgs args)
 {
     EventType   = args.GetType().Name.Replace("EventArgs", "");
     Importance  = (int)args.Importance;
     Message     = args.Message;
     HelpKeyword = args.HelpKeyword;
     SenderName  = args.SenderName;
     Timestamp   = args.Timestamp;
     ThreadId    = args.ThreadId;
 }
Example #4
0
        /// <summary>
        /// Stub implementation -- forwards to engine being proxied.
        /// </summary>
        public void LogMessageEvent(BuildMessageEventArgs e)
        {
            ErrorUtilities.VerifyThrowArgumentNull(e, "e");
            ErrorUtilities.VerifyThrowInvalidOperation(activeProxy == true, "AttemptingToLogFromInactiveTask");

            if (parentModule.IsRunningMultipleNodes && !e.GetType().IsSerializable)
            {
                loggingServices.LogWarning(buildEventContext, new BuildEventFileInfo(string.Empty), "ExpectedEventToBeSerializable", e.GetType().Name);
                return;
            }
            e.BuildEventContext = buildEventContext;
            loggingServices.LogMessageEvent(e);
        }
Example #5
0
        public void LogMessageEvent(BuildMessageEventArgs e)
        {
            if (e.Importance != MessageImportance.High)
            {
                var interesting = new[]
                { "Unified primary", "chosen", "conflict", "Unified Dependency", "Could not resolve this reference" };

                if (interesting.Any(i => e.Message.Contains(i)) ||

                    (lastInterestingMessageIndent != null && e.Message.StartsWith(lastInterestingMessageIndent)) || lastInterestingMessageIndent == string.Empty)
                {
                    var importanceField = e.GetType()
                                          .GetField("importance", BindingFlags.NonPublic | BindingFlags.Instance);
                    Debug.WriteLine("^" + e.Message);
                    //_buildEngine.LogMessageEvent(new BuildMessageEventArgs("about to bump importance of message:" + e.Message, "B", e.SenderName,MessageImportance.High));

                    importanceField.SetValue(e, MessageImportance.High);
                    var indents = Regex.Match(e.Message, @"^(\s+)");
                    if (lastInterestingMessageIndent == null && indents.Success == false) //special condition, last message was interesting but had no indentation
                    {
                        lastInterestingMessageIndent = string.Empty;
                    }
                    else if (string.IsNullOrEmpty(lastInterestingMessageIndent) && indents.Success)
                    {
                        lastInterestingMessageIndent = indents.Groups[1].Value;
                        _buildEngine.LogMessageEvent(
                            new BuildMessageEventArgs(
                                "Setting indent bumping to length:" + indents.Groups[1].Value.Length.ToString(), "B",
                                "B", MessageImportance.High));
                    }
                }
                else
                {
                    Debug.WriteLine("_" + e.Message);
                    lastInterestingMessageIndent = null;
                }
            }

            _buildEngine.LogMessageEvent(e);
        }
        void eventSource_MessageRaised(object sender, BuildMessageEventArgs e)
        {
            //if ((e.Importance == MessageImportance.High && IsVerbosityAtLeast(LoggerVerbosity.Minimal))
            //    || (e.Importance == MessageImportance.Normal && IsVerbosityAtLeast(LoggerVerbosity.Normal))
            //    || (e.Importance == MessageImportance.Low && IsVerbosityAtLeast(LoggerVerbosity.Detailed))
            //    )
            //{
            //WriteLineWithSenderAndMessage(String.Empty, e);
            //}

            //WriteLineWithIntent(e.Message);
            //this.OnMessage(e.Message);
            MessInfo Messinfo = new MessInfo(e.Message);

            if (Messinfo.Success)
            {
                WEMessage message = new WEMessage();
                message.Code = Messinfo.Error;
                FileMessageObject FMO = new FileMessageObject();
                message.MessageObject = FMO;
                FMO.ColumnNumber      = 0;
                FMO.EndColumnNumber   = 0;
                FMO.LineNumber        = Messinfo.Line;
                FMO.EndLineNumber     = 0;
                FMO.File        = Messinfo.File;
                message.Message = Messinfo.Message;

                //string line = string.Empty;

                switch (Messinfo.Cond)
                {
                case MessInfo.Level.Error:
                    //line = message.File + "(" + message.LineNumber + "," + message.ColumnNumber + "): " + Strings.Error + " " + message.Code + ": " + message.Message;
                    if (mEWList.AddError(message))
                    {
                        WriteIntent();
                        this.OnError(message);
                    }
                    break;

                case MessInfo.Level.Warning:
                    //line = message.File + "(" + message.LineNumber + "," + message.ColumnNumber + "): " + Strings.Warning + " " + message.Code + ": " + message.Message;
                    if (mEWList.AddWarning(message))
                    {
                        WriteIntent();
                        this.OnWarning(message);
                    }
                    break;
                }

                //if(line != string.Empty)
                //WriteLineWithIntent(line);
            }


            //if (e.Message.ToLower().Contains("error:"))
            //{

            //}

            //if (e.Message.ToLower().Contains("warning:"))
            //{
            //    WriteLineWithIntent(e.Message);
            //}

            if (e.GetType() == typeof(TaskCommandLineEventArgs))
            {
                if (e.Message.ToLower().Contains("error:"))
                {
                    WriteLineWithIntent(Strings.ConsoleError + ":   " + e.Message);
                }

                if (e.Message.ToLower().Contains("warning:"))
                {
                    WriteLineWithIntent(Strings.ConsoleError + ":   " + e.Message);
                }
            }
        }