Example #1
0
 void eventSource_TargetStarted(object sender, TargetStartedEventArgs e)
 {
     if (Verbosity == LoggerVerbosity.Detailed)
     {
         Console.WriteLine("Target Started: " + e.TargetName);
     }
 }
Example #2
0
        public void VerifyEventType()
        {
            BuildFinishedEventArgs buildFinished = new BuildFinishedEventArgs("Message", "Keyword", true);
            BuildStartedEventArgs buildStarted = new BuildStartedEventArgs("Message", "Help");
            BuildMessageEventArgs lowMessage = new BuildMessageEventArgs("Message", "help", "sender", MessageImportance.Low);
            TaskStartedEventArgs taskStarted = new TaskStartedEventArgs("message", "help", "projectFile", "taskFile", "taskName");
            TaskFinishedEventArgs taskFinished = new TaskFinishedEventArgs("message", "help", "projectFile", "taskFile", "taskName", true);
            TaskCommandLineEventArgs commandLine = new TaskCommandLineEventArgs("commandLine", "taskName", MessageImportance.Low);
            BuildWarningEventArgs warning = new BuildWarningEventArgs("SubCategoryForSchemaValidationErrors", "MSB4000", "file", 1, 2, 3, 4, "message", "help", "sender");
            BuildErrorEventArgs error = new BuildErrorEventArgs("SubCategoryForSchemaValidationErrors", "MSB4000", "file", 1, 2, 3, 4, "message", "help", "sender");
            TargetStartedEventArgs targetStarted = new TargetStartedEventArgs("message", "help", "targetName", "ProjectFile", "targetFile");
            TargetFinishedEventArgs targetFinished = new TargetFinishedEventArgs("message", "help", "targetName", "ProjectFile", "targetFile", true);
            ProjectStartedEventArgs projectStarted = new ProjectStartedEventArgs(-1, "message", "help", "ProjectFile", "targetNames", null, null, null);
            ProjectFinishedEventArgs projectFinished = new ProjectFinishedEventArgs("message", "help", "ProjectFile", true);
            ExternalProjectStartedEventArgs externalStartedEvent = new ExternalProjectStartedEventArgs("message", "help", "senderName", "projectFile", "targetNames");

            VerifyLoggingPacket(buildFinished, LoggingEventType.BuildFinishedEvent);
            VerifyLoggingPacket(buildStarted, LoggingEventType.BuildStartedEvent);
            VerifyLoggingPacket(lowMessage, LoggingEventType.BuildMessageEvent);
            VerifyLoggingPacket(taskStarted, LoggingEventType.TaskStartedEvent);
            VerifyLoggingPacket(taskFinished, LoggingEventType.TaskFinishedEvent);
            VerifyLoggingPacket(commandLine, LoggingEventType.TaskCommandLineEvent);
            VerifyLoggingPacket(warning, LoggingEventType.BuildWarningEvent);
            VerifyLoggingPacket(error, LoggingEventType.BuildErrorEvent);
            VerifyLoggingPacket(targetStarted, LoggingEventType.TargetStartedEvent);
            VerifyLoggingPacket(targetFinished, LoggingEventType.TargetFinishedEvent);
            VerifyLoggingPacket(projectStarted, LoggingEventType.ProjectStartedEvent);
            VerifyLoggingPacket(projectFinished, LoggingEventType.ProjectFinishedEvent);
            VerifyLoggingPacket(externalStartedEvent, LoggingEventType.CustomEvent);
        }
 public void EventArgsCtors()
 {
     TargetStartedEventArgs targetStartedEvent = new TargetStartedEventArgs2();
     targetStartedEvent = new TargetStartedEventArgs("Message", "HelpKeyword", "TargetName", "ProjectFile", "TargetFile");
     targetStartedEvent = new TargetStartedEventArgs("Message", "HelpKeyword", "TargetName", "ProjectFile", "TargetFile", "ParentTarget", DateTime.Now);
     targetStartedEvent = new TargetStartedEventArgs(null, null, null, null, null);
     targetStartedEvent = new TargetStartedEventArgs(null, null, null, null, null, null, DateTime.Now);
 }
 public void eventSource_TargetStarted(object sender, TargetStartedEventArgs e)
 {
     if(e.TargetName.Equals("IceBuilder_Compile") ||IsVerbosityAtLeast(LoggerVerbosity.Detailed))
     {
         WriteMessage(String.Format("{0}:", e.TargetName));
     }
     Indent += IndentLevel;
 }
Example #5
0
 private void eventSource_TargetStarted(object sender, Microsoft.Build.Framework.TargetStartedEventArgs e)
 {
     if (e.TargetName == "CoreCompile")
     {
         this.AddNode(e.Message);
         needToLog = true;
     }
     else
     {
         needToLog = false;
     }
 }
Example #6
0
        /// <summary>
        /// Adds a new target node to the project.
        /// </summary>
        /// <param name="targetStartedEventArgs">The <see cref="TargetStartedEventArgs"/> instance containing the event data.</param>
        public void AddTarget(TargetStartedEventArgs targetStartedEventArgs)
        {
            var target = GetOrAddTargetByName(targetStartedEventArgs.TargetName, targetStartedEventArgs);

            if (!string.IsNullOrEmpty(targetStartedEventArgs.ParentTarget))
            {
                var parentTarget = GetOrAddTargetByName(targetStartedEventArgs.ParentTarget);
                parentTarget.AddChildTarget(target);
            }
            else
            {
                AddChildNode(target);
            }
        }
		public void AssignmentTest ()
		{
			TargetStartedEventArgs tsea;
			string message = "message";
			string helpKeyword = "helpKeyword";
			string targetName = "targetName";
			string projectFile = "projectFile";
			string targetFile = "targetFile";
			
			tsea = new TargetStartedEventArgs (message, helpKeyword, targetName, projectFile, targetFile);
			
			Assert.AreEqual (message, tsea.Message, "Message");
			Assert.AreEqual (helpKeyword, tsea.HelpKeyword, "HelpKeyword");
			Assert.AreEqual (targetName, tsea.TargetName, "TargetName");
			Assert.AreEqual (projectFile, tsea.ProjectFile, "ProjectFile");
			Assert.AreEqual (targetFile, tsea.TargetFile, "TargetFile");
		}
Example #8
0
		void eventSource_TargetStarted(object sender, TargetStartedEventArgs e)
		{
			if (_output == null || String.IsNullOrEmpty(e.ProjectFile) || e.ProjectFile == _current) 
				return;

			CloseTarget();

			_current = e.ProjectFile;
			_output.WriteStartElement("project");

			string filename = e.ProjectFile;
			_output.WriteAttributeString("file", Path.GetFileName(filename));
			_output.WriteAttributeString("location", Path.GetDirectoryName(filename));
			
			if(!String.IsNullOrEmpty(e.TargetFile) )
				_output.WriteAttributeString("target", e.TargetFile);
		}
Example #9
0
		void LogTargetStarted (Target target)
		{
			TargetStartedEventArgs tsea;
			string projectFile = project.FullFileName;
			tsea = new TargetStartedEventArgs (String.Format ("Target {0} started.", target.Name), null,
					target.Name, projectFile, target.TargetFile);
			target.Engine.EventSource.FireTargetStarted (this, tsea);
		}
Example #10
0
 void TargetStarted(object sender, TargetStartedEventArgs e)
 {
 }
Example #11
0
		void TargetStarted (object sender, TargetStartedEventArgs args)
		{
			target_started_events++;
		}
 private void TargetStarted(object sender, Microsoft.Build.Framework.TargetStartedEventArgs e)
 {
     ChromeTracer.AddBeginEvent(e.ThreadId, "Target:" +e.TargetName, GetTimeStamp(e.Timestamp), string.Empty);
 }
Example #13
0
 /// <summary>
 /// This is the delegate for TargetStartedHandler events.
 /// </summary>
 private void TargetStartedHandler(object sender, TargetStartedEventArgs buildEvent)
 {
     if (LogAtImportance(MessageImportance.Normal))
     {
         LogEvent(sender, buildEvent);
     }
     ++this.currentIndent;
 }
Example #14
0
        public void TestLoggingEventCustomerSerialization()
        {
            Hashtable loggingTypeCacheWrites = new Hashtable();
            stream.Position = 0;
            BuildEventContext context = new BuildEventContext(1,3,5,7);
            GenericBuildEventArg genericBuildEvent = new GenericBuildEventArg("Message","Help","Sender");
            genericBuildEvent.BuildEventContext = context;
            NodeLoggingEvent genericBuildEventLoggingEvent = new NodeLoggingEvent(genericBuildEvent);
            genericBuildEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);

            GenericCustomBuildEventArg genericCustomEvent = new GenericCustomBuildEventArg("FooFighter");
            genericCustomEvent.BuildEventContext = context;
            NodeLoggingEvent genericCustomEventLoggingEvent = new NodeLoggingEvent(genericCustomEvent);
            genericCustomEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);

            BuildErrorEventArgs errorEvent = new BuildErrorEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "Message", "HelpKeyword", "SenderName");
            errorEvent.BuildEventContext = context;
            NodeLoggingEvent errorEventLoggingEvent = new NodeLoggingEvent(errorEvent);
            errorEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);

            BuildMessageEventArgs messageEvent = new BuildMessageEventArgs("Message", "HelpKeyword", "SenderName",MessageImportance.High);
            messageEvent.BuildEventContext = context;
            NodeLoggingEvent messageEventLoggingEvent = new NodeLoggingEvent(messageEvent);
            messageEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);

            BuildWarningEventArgs warningEvent = new BuildWarningEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "Message", "HelpKeyword", "SenderName");
            warningEvent.BuildEventContext = context;
            NodeLoggingEvent warningEventLoggingEvent = new NodeLoggingEvent(warningEvent);
            warningEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);

            ProjectStartedEventArgs projectStartedEvent = new ProjectStartedEventArgs( 8,"Message", "HelpKeyword", "ProjectFile", "TargetNames", null, null, new BuildEventContext(7,8,9,10));
            projectStartedEvent.BuildEventContext = context;
            NodeLoggingEvent projectStartedEventLoggingEvent = new NodeLoggingEvent(projectStartedEvent);
            projectStartedEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);

            ProjectFinishedEventArgs projectFinishedEvent = new ProjectFinishedEventArgs("Message", "HelpKeyword","ProjectFile",true);
            projectFinishedEvent.BuildEventContext = context;
            NodeLoggingEvent projectFinishedEventLoggingEvent = new NodeLoggingEvent(projectFinishedEvent);
            projectFinishedEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);

            TargetStartedEventArgs targetStartedEvent = new TargetStartedEventArgs("Message", "HelpKeyword", "TargetName", "ProjectFile", "TargetFile");
            targetStartedEvent.BuildEventContext = context;
            NodeLoggingEvent targetStartedEventLoggingEvent = new NodeLoggingEvent(targetStartedEvent);
            targetStartedEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);

            TargetFinishedEventArgs targetFinished = new TargetFinishedEventArgs("Message", "HelpKeyword","TargetName", "ProjectFile", "TargetFile", true);
            targetFinished.BuildEventContext = context;
            NodeLoggingEvent targetFinishedEventLoggingEvent = new NodeLoggingEvent(targetFinished);
            targetFinishedEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);

            TaskStartedEventArgs taskStartedEvent = new TaskStartedEventArgs("Message", "HelpKeyword", "ProjectFile", "TaskFile", "TaskName");
            taskStartedEvent.BuildEventContext = context;
            NodeLoggingEvent taskStartedEventLoggingEvent = new NodeLoggingEvent(taskStartedEvent);
            taskStartedEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);

            TaskFinishedEventArgs taskFinishedEvent = new TaskFinishedEventArgs("Message", "HelpKeyword", "ProjectFile", "TaskFile", "TaskName", true);
            taskFinishedEvent.BuildEventContext = context;
            NodeLoggingEvent taskFinishedEventLoggingEvent = new NodeLoggingEvent(taskFinishedEvent);
            taskFinishedEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);

            BuildFinishedEventArgs buildFinishedEvent = new BuildFinishedEventArgs("Message","Help",true);
            buildFinishedEvent.BuildEventContext = context;
            NodeLoggingEvent buildFinishedEventEventLoggingEvent = new NodeLoggingEvent(buildFinishedEvent);
            buildFinishedEventEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);

            BuildStartedEventArgs buildStartedEvent = new BuildStartedEventArgs("Message","Help");
            buildStartedEvent.BuildEventContext = context;
            NodeLoggingEvent buildStartedEventLoggingEvent = new NodeLoggingEvent(buildStartedEvent);
            buildStartedEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);

            TaskCommandLineEventArgs commandlineEventArg = new TaskCommandLineEventArgs("CommandLine","TaskName", MessageImportance.High);
            commandlineEventArg.BuildEventContext = context;
            NodeLoggingEvent commandlineEventArgLoggingEvent = new NodeLoggingEvent(commandlineEventArg);
            commandlineEventArgLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);

            Hashtable loggingTypeCacheReads = new Hashtable();
            long streamWriteEndPosition = stream.Position;
            stream.Position = 0;

            NodeLoggingEvent nodeLoggingEvent = new NodeLoggingEvent(null);
            nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
            Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(GenericBuildEventArg));

            nodeLoggingEvent = new NodeLoggingEvent(null);
            nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
            Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(GenericCustomBuildEventArg));

            nodeLoggingEvent = new NodeLoggingEvent(null);
            nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
            Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(BuildErrorEventArgs));

            nodeLoggingEvent = new NodeLoggingEvent(null);
            nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
            Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(BuildMessageEventArgs));

            nodeLoggingEvent = new NodeLoggingEvent(null);
            nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
            Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(BuildWarningEventArgs));

            nodeLoggingEvent = new NodeLoggingEvent(null);
            nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
            Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(ProjectStartedEventArgs));

            nodeLoggingEvent = new NodeLoggingEvent(null);
            nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
            Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(ProjectFinishedEventArgs));

            nodeLoggingEvent = new NodeLoggingEvent(null);
            nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
            Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(TargetStartedEventArgs));


            nodeLoggingEvent = new NodeLoggingEvent(null);
            nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
            Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(TargetFinishedEventArgs));

            nodeLoggingEvent = new NodeLoggingEvent(null);
            nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
            Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(TaskStartedEventArgs));

            nodeLoggingEvent = new NodeLoggingEvent(null);
            nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
            Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(TaskFinishedEventArgs));

            nodeLoggingEvent = new NodeLoggingEvent(null);
            nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
            Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(BuildFinishedEventArgs));

            nodeLoggingEvent = new NodeLoggingEvent(null);
            nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
            Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(BuildStartedEventArgs));

            nodeLoggingEvent = new NodeLoggingEvent(null);
            nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
            Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() ==typeof( TaskCommandLineEventArgs));
            
            long streamReadEndPosition = stream.Position;
            Assert.AreEqual(streamWriteEndPosition, streamReadEndPosition, "Expected Read and Write Positions to match");
        }
Example #15
0
 public BuildMessage(TargetStartedEventArgs args)
 {
     EventType = args.GetType().Name.Replace("EventArgs", "");
     Message = args.Message;
     ParentTarget = args.ParentTarget;
     ProjectFile = args.ProjectFile;
     TargetFile = args.TargetFile;
     TargetName = args.TargetName;
     HelpKeyword = args.HelpKeyword;
     SenderName = args.SenderName;
     Timestamp = args.Timestamp;
     ThreadId = args.ThreadId;
 }
Example #16
0
        /// <summary>
        /// Raises a "target build started" event to all registered loggers.
        /// </summary>
        /// <param name="sender">sender of the event</param>
        /// <param name="buildEvent">TargetStartedEventArgs</param>
        /// <exception cref="LoggerException">When EventHandler raises an logger exception the LoggerException is rethrown</exception>
        /// <exception cref="InternalLoggerException">Any exceptions which are not LoggerExceptions are wrapped in an InternalLoggerException</exception>
        /// <exception cref="Exception">ExceptionHandling.IsCriticalException exceptions will not be wrapped</exception>
        private void RaiseTargetStartedEvent(object sender, TargetStartedEventArgs buildEvent)
        {
            if (TargetStarted != null)
            {
                try
                {
                    TargetStarted(sender, buildEvent);
                }
                catch (LoggerException)
                {
                    // if a logger has failed politely, abort immediately
                    // first unregister all loggers, since other loggers may receive remaining events in unexpected orderings
                    // if a fellow logger is throwing in an event handler.
                    this.UnregisterAllEventHandlers();
                    throw;
                }
                catch (Exception exception)
                {
                    // first unregister all loggers, since other loggers may receive remaining events in unexpected orderings
                    // if a fellow logger is throwing in an event handler.
                    this.UnregisterAllEventHandlers();

                    if (ExceptionHandling.IsCriticalException(exception))
                    {
                        throw;
                    }

                    InternalLoggerException.Throw(exception, buildEvent, "FatalErrorWhileLogging", false);
                }
            }

            RaiseStatusEvent(sender, buildEvent);
        }
Example #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Target"/> class.
 /// </summary>
 /// <param name="targetName">Name of the target.</param>
 /// <param name="targetStartedEvent">The <see cref="TargetStartedEventArgs"/> instance containing the target started event data.</param>
 public Target(string targetName, TargetStartedEventArgs targetStartedEvent)
 {
     Id = -1;
     Name = targetName;
     TryUpdate(targetStartedEvent);
 }
Example #18
0
 /// <summary>
 /// Try to update the target data given a target started event. This is useful if the project
 /// was created (e.g. as a parent) before we saw the started event.
 /// </summary>
 /// <remarks>Does nothing if the data has already been set or the new data is null.</remarks>
 /// <param name="e">The <see cref="TargetStartedEventArgs"/> instance containing the event data.</param>
 public void TryUpdate(TargetStartedEventArgs e)
 {
     if (Id < 0 && e != null)
     {
         // = e.Timestamp;
         Id = e.BuildEventContext.TargetId;
     }
 }
Example #19
0
        /// <summary>
        /// Handler for target started events
        /// </summary>
        /// <param name="sender">sender (should be null)</param>
        /// <param name="e">event arguments</param>
        public void TargetStartedHandler(object sender, TargetStartedEventArgs e)
        {
            InitializeBaseConsoleLogger(); // for compat: see DDB#136924

            _consoleLogger.TargetStartedHandler(sender, e);
        }
 /// <summary>
 /// Compare two targetStarted events
 /// </summary>
 private static void VerifyTargetStarted(TargetStartedEventArgs genericEvent, TargetStartedEventArgs newGenericEvent)
 {
     Assert.IsTrue(string.Compare(genericEvent.TargetFile, newGenericEvent.TargetFile, StringComparison.OrdinalIgnoreCase) == 0, "Expected TargetFile to Match");
     Assert.IsTrue(string.Compare(genericEvent.ProjectFile, newGenericEvent.ProjectFile, StringComparison.OrdinalIgnoreCase) == 0, "Expected ProjectFile to Match");
     Assert.IsTrue(string.Compare(genericEvent.TargetName, newGenericEvent.TargetName, StringComparison.OrdinalIgnoreCase) == 0, "Expected TargetName to Match");
     Assert.IsTrue(string.Compare(genericEvent.ParentTarget, newGenericEvent.ParentTarget, StringComparison.OrdinalIgnoreCase) == 0, "Expected ParentTarget to Match");
 }
Example #21
0
 private void OnTargetStarted(object sender, TargetStartedEventArgs eventArgs)
 {
 }
Example #22
0
 private void eventSource_TargetStarted(object sender, TargetStartedEventArgs e)
 {
     if (stop) {
         return;
     }
     Execute(new BuildMessage(e));
     if (stop) {
         KillThyself();
     }
 }
Example #23
0
 public abstract void TargetStartedHandler(object sender, TargetStartedEventArgs e);
        /// <summary>
        /// Compare this build event context with another object to determine 
        /// equality. This means the values inside the object are identical.
        /// </summary>
        /// <param name="obj">Object to compare to this object</param>
        /// <returns>True if the object values are identical, false if they are not identical</returns>
        public static bool IsEquivalent(TargetStartedEventArgs args, TargetStartedEventArgs other)
        {
            if (!String.Equals(args.ProjectFile, other.ProjectFile, StringComparison.OrdinalIgnoreCase))
            {
                return false;
            }

            if (!String.Equals(args.TargetFile, other.TargetFile, StringComparison.OrdinalIgnoreCase))
            {
                return false;
            }

            if (!String.Equals(args.TargetName, other.TargetName, StringComparison.OrdinalIgnoreCase))
            {
                return false;
            }

            if (!String.Equals(args.ParentTarget, other.ParentTarget, StringComparison.OrdinalIgnoreCase))
            {
                return false;
            }
            return ((BuildEventArgs)args).IsEquivalent(other);
        }
Example #25
0
		private void eventSource_TargetStartedHandler(object sender, TargetStartedEventArgs e)
		{
            LogStageStarted(XmlLoggerElements.Target, e.TargetName, "", e.Timestamp);
		}
 private void TargetStarted(object sender, TargetStartedEventArgs e)
 {
     string line = string.Format(CultureInfo.InvariantCulture, "Target {0}:", e.TargetName);
     this.WriteLine(line);
     this.indent++;
 }
 /// <summary>
 /// Handle a target started event
 /// </summary>
 /// <param name="sender">Who sent the event</param>
 /// <param name="e">Event raised on the event source</param>
 private void Source_TargetStarted(object sender, TargetStartedEventArgs e)
 {
     HandleEvent(e);
 }
 private void TargetStarted(object sender, TargetStartedEventArgs e)
 {
     this.LogStarted("target", e.TargetName, string.Empty);
 }
Example #29
0
 private void eventSource_TargetStarted(object sender, Microsoft.Build.Framework.TargetStartedEventArgs e)
 {
     textBox.Text += Environment.NewLine + e.Message;
 }
		/// <summary>
		/// This is the delegate for TargetStartedHandler events.
		/// </summary>
		private void TargetStartedHandler(object sender, TargetStartedEventArgs buildEvent)
		{
            try
            {
                if (LogAtImportance(MessageImportance.Normal))
                {
                    LogEvent(sender, buildEvent);
                }
            }
            catch (Exception e)
            {
                Debug.Assert(false, "Problem logging targetstarted event: " + e.Message + " at " + e.TargetSite);
                // swallow the exception
            }
            finally
            {
                ++this.currentIndent;
            }
		}
        protected void onTargetStarted(object sender, TargetStartedEventArgs e)
        {
            if(!projects.ContainsKey(e.BuildEventContext.ProjectInstanceId)) {
                return;
            }

            switch(e.TargetName) {
                case "PreBuildEvent": {
                    library.Event.onProjectPre(projects[e.BuildEventContext.ProjectInstanceId].Name);
                    break;
                }
                case "PostBuildEvent": {
                    Project p = projects[e.BuildEventContext.ProjectInstanceId];
                    library.Event.onProjectPost(p.Name, p.HasErrors ? 0 : 1);
                    break;
                }
            }
        }
Example #32
0
 /// <summary>
 /// This is the delegate for TargetStartedHandler events.
 /// </summary>
 protected virtual void TargetStartedHandler(object sender, TargetStartedEventArgs buildEvent)
 {
     // NOTE: This may run on a background thread!
     QueueOutputEvent(MessageImportance.Low, buildEvent);
     IndentOutput();
 }
 /// <summary>
 /// Handles the TargetStarted event.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="TargetStartedEventArgs" /> instance containing the event data.</param>
 private void TargetStartedEventHandler(object sender, TargetStartedEventArgs e)
 {
     if (e.TargetName.StartsWith("__", StringComparison.Ordinal))
     {
         Console.ForegroundColor = ConsoleColor.Cyan;
         Console.WriteLine("Target: {0}", e.TargetName);
         Console.ResetColor();
     }
 }