/// <summary> /// Handles a compilation task event. /// </summary> public static void OnCompilationTaskEvent(CompilationTaskEventType type, string?parentTaskName, string taskName) { lock (GlobalLock) { if (!CompilationEventTypeHandlers.TryGetValue(type, out var handler)) { throw new ArgumentException($"No handler for compilation task event type '{type}' exists"); } handler(parentTaskName, taskName); } }
private static void InvokeTaskEvent(CompilationTaskEventType eventType, Task task, string?leafSuffix = null) { if (FailureOccurred) { return; } if (!(leafSuffix is null) && !task.IsLeaf()) { throw new ArgumentException($"Non-leaf Task '{task}' cannot use a suffix"); } try { var parent = GetTaskParent(task); var taskId = task.ToString() + (leafSuffix is null ? string.Empty : $"-{Regex.Replace(leafSuffix, @"\s+", string.Empty)}"); CompilationTaskEvent?.Invoke(eventType, parent?.ToString(), taskId.ToString()); } catch (Exception ex) { FailureException = ex; } }