/// <summary> /// Initializes a new instance of the <see cref="Project"/> class. /// </summary> /// <param name="projectId">The project identifier.</param> /// <param name="e">The <see cref="ProjectStartedEventArgs"/> instance containing the event data.</param> /// <param name="parentPropertyBag">The parent property bag (to check for inherited properties).</param> public Project(int projectId, ProjectStartedEventArgs e, PropertyBag parentPropertyBag) { Properties = new PropertyBag(parentPropertyBag); Id = projectId; TryUpdate(e); }
void eventSource_ProjectStarted(object sender, ProjectStartedEventArgs e) { // ProjectStartedEventArgs adds ProjectFile, TargetNames // Just the regular message string is good enough here, so just display that. WriteLine(String.Empty, e); indent++; }
void ProjectStarted(object sender, ProjectStartedEventArgs e) { string directoryName = Path.GetDirectoryName(e.ProjectFile); if (null != directoryName) this.ProjectDirectory = directoryName; // Console.WriteLine("Project Started: " + e.ProjectFile); }
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); }
/// <summary> /// Handler for the ProjectStarted event. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void eventSource_ProjectStarted(object sender, ProjectStartedEventArgs e) { // Clone and store the properties so we can inspect the values later on foreach (DictionaryEntry property in e.Properties) { projectStartedProperties[(string) property.Key] = (string) property.Value; } }
public ProjectState(ProjectStartedEventArgs args) { GlobalProperties = args.GlobalProperties; ProjectFile = args.ProjectFile; ContextId = args.BuildEventContext.ProjectContextId; ParentContextId = args.ParentProjectBuildEventContext.ProjectContextId; TargetPath = (string)args.Properties?.Cast<DictionaryEntry>().FirstOrDefault(p => ((string)p.Key).Equals("TargetPath")).Value; }
public void EventArgsCtors() { ProjectStartedEventArgs projectStartedEvent = new ProjectStartedEventArgs2(); Assert.IsNotNull(projectStartedEvent); projectStartedEvent = new ProjectStartedEventArgs("Message", "HelpKeyword", "ProjecFile", "TargetNames", null, null); projectStartedEvent = new ProjectStartedEventArgs("Message", "HelpKeyword", "ProjecFile", "TargetNames", null, null, DateTime.Now); projectStartedEvent = new ProjectStartedEventArgs(1, "Message", "HelpKeyword", "ProjecFile", "TargetNames", null, null, null); projectStartedEvent = new ProjectStartedEventArgs(1, "Message", "HelpKeyword", "ProjecFile", "TargetNames", null, null, null, DateTime.Now); projectStartedEvent = new ProjectStartedEventArgs(null, null, null, null, null, null); projectStartedEvent = new ProjectStartedEventArgs(null, null, null, null, null, null, DateTime.Now); projectStartedEvent = new ProjectStartedEventArgs(1, null, null, null, null, null, null, null); projectStartedEvent = new ProjectStartedEventArgs(1, null, null, null, null, null, null, null, DateTime.Now); }
public void ItemsAndPropertiesDifferentEquals() { ArrayList itemsList = new ArrayList(); ArrayList propertiesList = new ArrayList(); ProjectStartedEventArgs differentItemsAndProperties = new ProjectStartedEventArgs ( s_baseProjectStartedEvent.ProjectId, s_baseProjectStartedEvent.Message, s_baseProjectStartedEvent.HelpKeyword, s_baseProjectStartedEvent.ProjectFile, s_baseProjectStartedEvent.TargetNames, propertiesList, itemsList, s_baseProjectStartedEvent.ParentProjectBuildEventContext, s_baseProjectStartedEvent.Timestamp ); Assert.IsFalse(propertiesList == s_baseProjectStartedEvent.Properties); Assert.IsFalse(itemsList == s_baseProjectStartedEvent.Items); }
public void AssignmentTest () { ProjectStartedEventArgs psea; string message = "message"; string helpKeyword = "helpKeyword"; string projectFile = "projectFile"; string targetNames = "targetNames"; string [] properties = new string [2] { "a", "b" }; string [] items = new string [2] { "c", "d" }; psea = new ProjectStartedEventArgs (message, helpKeyword, projectFile, targetNames, properties, items); Assert.AreEqual (message, psea.Message, "A1"); Assert.AreEqual (helpKeyword, psea.HelpKeyword, "A2"); Assert.AreEqual (projectFile, psea.ProjectFile, "A3"); Assert.AreEqual (targetNames, psea.TargetNames, "A4"); Assert.AreEqual (properties, psea.Properties, "A5"); Assert.AreEqual (items, psea.Items, "A6"); }
private void eventSource_ProjectStarted(object sender, Microsoft.Build.Framework.ProjectStartedEventArgs e) { this.AddNode(e.Message); }
/// <summary> /// This is the delegate for ProjectStartedHandler events. /// </summary> private void ProjectStartedHandler(object sender, ProjectStartedEventArgs buildEvent) { try { if (LogAtImportance(MessageImportance.Low)) { LogEvent(sender, buildEvent); } } catch (Exception e) { Debug.Assert(false, "Problem logging projectstarted event: " + e.Message + " at " + e.TargetSite); // swallow the exception } }
private void eventSource_ProjectStartedHandler(object sender, ProjectStartedEventArgs e) { LogStageStarted(XmlLoggerElements.Project, e.TargetNames, e.ProjectFile, e.Timestamp); }
private void eventSource_ProjectStarted(object sender, Microsoft.Build.Framework.ProjectStartedEventArgs e) { textBox.Text += Environment.NewLine + e.Message; }
private void ProjectStarted(object sender, Microsoft.Build.Framework.ProjectStartedEventArgs e) { ChromeTracer.AddBeginEvent(e.ThreadId, "Project:" + Path.GetFileName(e.ProjectFile), GetTimeStamp(e.Timestamp), string.Empty); }
private void ProjectStarted(object sender, ProjectStartedEventArgs e) { string targets = string.IsNullOrEmpty(e.TargetNames) ? "default" : e.TargetNames; string line = string.Format(CultureInfo.InvariantCulture, "Project \"{0}\" ({1} target(s)):", e.ProjectFile, targets); this.WriteLine(line + Environment.NewLine); if (this.IsVerbosityAtLeast(LoggerVerbosity.Diagnostic)) { this.WriteLine("Initial Properties:"); SortedDictionary<string, string> sortedProperties = new SortedDictionary<string, string>(); foreach (DictionaryEntry k in e.Properties.Cast<DictionaryEntry>()) { sortedProperties.Add(k.Key.ToString(), k.Value.ToString()); } foreach (var p in sortedProperties) { bool matched = this.regExRules.Select(s => new Regex(s)).Select(r => r.Match(p.Key)).Any(m => m.Success); if (matched) { this.WriteLine(p.Key + "\t = " + SecureChar.Repeat(p.Value.Length)); } else { this.WriteLine(p.Key + "\t = " + p.Value); } } } }
/// <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(ProjectStartedEventArgs args, ProjectStartedEventArgs other) { if (!String.Equals(args.ProjectFile, other.ProjectFile, StringComparison.OrdinalIgnoreCase)) { return false; } if (!String.Equals(args.TargetNames, other.TargetNames, StringComparison.OrdinalIgnoreCase)) { return false; } return ((BuildEventArgs)args).IsEquivalent(other); }
public BuildMessage(ProjectStartedEventArgs args) { EventType = args.GetType().Name.Replace("EventArgs", ""); Message = args.Message; ProjectFile = args.ProjectFile; ProjectId = args.ProjectId; TargetNames = args.TargetNames; HelpKeyword = args.HelpKeyword; SenderName = args.SenderName; Timestamp = args.Timestamp; ThreadId = args.ThreadId; }
private void eventSource_ProjectStarted(object sender, ProjectStartedEventArgs e) { if (stop) { return; } Execute(new BuildMessage(e)); if (stop) { KillThyself(); } }
private void eventSource_ProjectStarted(object sender, ProjectStartedEventArgs e) { Console.WriteLine("project started: file=\"{0}\"", e.ProjectFile); }
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"); }
/// <summary> /// Event handler which signals the event. /// </summary> private void ProjectStarted(object sender, ProjectStartedEventArgs e) { _projectStartedEvent.Set(); }
/// <summary> /// This is the delegate for ProjectStartedHandler events. /// </summary> private void ProjectStartedHandler(object sender, ProjectStartedEventArgs buildEvent) { if (LogAtImportance(MessageImportance.Low)) { LogEvent(sender, buildEvent); } }
private void OnProjectStarted(object sender, ProjectStartedEventArgs e) { _projects.Add(new BuildProjectContextEntry( e.BuildEventContext.ProjectInstanceId, e.BuildEventContext.ProjectContextId, e.ProjectFile, e.GlobalProperties)); }
//void OnMessageRaised(object sender, BuildMessageEventArgs e) //{ // traceSource.TraceInformation(e.Message); //} void OnProjectStarted(object sender, ProjectStartedEventArgs e) { TraceSource.TraceInformation(e.Message); }
protected void onProjectStarted(object sender, ProjectStartedEventArgs e) { termination(); // This is first place where we can use it if(e.ProjectFile.EndsWith(".metaproj", StringComparison.OrdinalIgnoreCase)) { debug(".metaproj has been ignored for '{0}'", e.ProjectFile); return; } if(projects.ContainsKey(e.ProjectId)) { // already pushed return; } //updateBuildType(e.TargetNames); if(e.Properties == null) { debug("onProjectStarted: e.Properties is null :: '{0}' ({1})", e.ProjectFile, e.Message); return; } Dictionary<object, string> properties = e.Properties.OfType<DictionaryEntry>().ToDictionary(k => k.Key, v => v.Value.ToString()); if(properties.ContainsKey("ProjectName")) { projects[e.ProjectId] = new Project() { Name = properties["ProjectName"], File = e.ProjectFile, Properties = properties }; } }
public abstract void ProjectStartedHandler(object sender, ProjectStartedEventArgs e);
void EventSource_ProjectStarted(object sender, ProjectStartedEventArgs e) { if (projectFilename == null) projectFilename = e.ProjectFile; }
void LogProjectStarted(Project project, string [] target_names) { string targets; if (target_names == null || target_names.Length == 0) targets = String.Empty; else targets = String.Join (";", target_names); ProjectStartedEventArgs psea = new ProjectStartedEventArgs ("Project started.", null, project.FullFileName, targets, project.EvaluatedPropertiesAsDictionaryEntries, project.EvaluatedItemsByNameAsDictionaryEntries); eventSource.FireProjectStarted (this, psea); }
/// <summary> /// Handles the ProjectStarted event. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="ProjectStartedEventArgs" /> instance containing the event data.</param> private void ProjectStartedEventHandler(object sender, ProjectStartedEventArgs e) { if (string.IsNullOrWhiteSpace(e.TargetNames) && !_projects.Contains(e.ProjectFile)) { _projects.Add(e.ProjectFile); Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("Project: {0}", e.ProjectFile); Console.ResetColor(); } }
/// <summary> /// This is the delegate for ProjectStartedHandler events. /// </summary> protected virtual void ProjectStartedHandler(object sender, ProjectStartedEventArgs buildEvent) { // NOTE: This may run on a background thread! QueueOutputEvent(MessageImportance.Low, buildEvent); }
/// <summary> /// Handle a project started event /// </summary> /// <param name="sender">Who sent the event</param> /// <param name="e">Event raised on the event source</param> private void Source_ProjectStarted(object sender, ProjectStartedEventArgs e) { HandleEvent(e); }
void ProjectStarted(object sender, ProjectStartedEventArgs e) { ProjectDirectory = Path.GetDirectoryName(e.ProjectFile); }
void ProjectStarted(object sender, ProjectStartedEventArgs e) { }