예제 #1
0
        /// <summary>
        /// Handles a compilation task end event.
        /// </summary>
        private static void CompilationEventEndHandler(string?parentTaskName, string taskName)
        {
            Debug.Assert(Monitor.IsEntered(GlobalLock));
            var key = CompilationTask.GenerateKey(parentTaskName, taskName);

            if (!CompilationTasks.TryGetValue(key, out var task))
            {
                throw new InvalidOperationException($"Attempt to stop task '{key}' which does not exist");
            }

            task.Stop();
        }
예제 #2
0
        /// <summary>
        /// Handles a compilation task start event.
        /// </summary>
        private static void CompilationEventStartHandler(CompilationLoader.CompilationTaskEventArgs eventArgs)
        {
            Debug.Assert(Monitor.IsEntered(GlobalLock));
            string key = CompilationTask.GenerateKey(eventArgs.ParentTaskName, eventArgs.TaskName);

            if (CompilationTasks.ContainsKey(key))
            {
                Warnings.Add(new Warning(WarningType.TaskAlreadyExists, key));
                return;
            }

            CompilationTasks.Add(key, new CompilationTask(eventArgs.ParentTaskName, eventArgs.TaskName));
        }
예제 #3
0
        /// <summary>
        /// Handles a compilation task start event.
        /// </summary>
        private static void CompilationEventStartHandler(string?parentTaskName, string taskName)
        {
            Debug.Assert(Monitor.IsEntered(GlobalLock));
            string key = CompilationTask.GenerateKey(parentTaskName, taskName);

            if (!CompilationTasks.TryGetValue(key, out var task))
            {
                task = new CompilationTask(parentTaskName, taskName);
                CompilationTasks.Add(key, task);
            }

            task.Start();
        }
예제 #4
0
        /// <summary>
        /// Handles a compilation task end event.
        /// </summary>
        private static void CompilationEventEndHandler(CompilationLoader.CompilationTaskEventArgs eventArgs)
        {
            Debug.Assert(Monitor.IsEntered(GlobalLock));
            var key = CompilationTask.GenerateKey(eventArgs.ParentTaskName, eventArgs.TaskName);

            if (!CompilationTasks.TryGetValue(key, out var task))
            {
                Warnings.Add(new Warning(WarningType.TaskDoesNotExist, key));
                return;
            }

            if (!task.IsInProgress())
            {
                Warnings.Add(new Warning(WarningType.TaskAlreadyEnded, key));
                return;
            }

            task.End();
        }