Ejemplo n.º 1
0
        public void AddPropertySet(PropertySetInfo propertySetInfo)
        {
            if (_propertySetInfos == null)
            {
                _propertySetInfos = new List <PropertySetInfo>();
            }

            _propertySetInfos.Add(propertySetInfo);
        }
Ejemplo n.º 2
0
 private static PropertySet ConstructPropertySet(PropertySetInfo propertySetInfo) =>
 new PropertySet(
     propertySetInfo.Name,
     propertySetInfo.Value,
     propertySetInfo.Time);
Ejemplo n.º 3
0
        private void ProcessTargetMessage(BuildEventArgs args)
        {
            const string itemGroupIncludeMessagePrefix = @"Added Item(s): ";
            const string itemGroupRemoveMessagePrefix  = @"Removed Item(s): ";
            const string propertyGroupMessagePrefix    = @"Set Property: ";

            var message    = args.Message;
            var targetInfo = FindTargetContext(args);

            if (message.StartsWith("Using"))
            {
                // A task from assembly message (parses out the task name and assembly path).
                var match = UsingTaskRegex.Match(args.Message);
                if (match.Success)
                {
                    var taskName = Intern(match.Groups["task"].Value);
                    var assembly = Intern(match.Groups["assembly"].Value);
                    _assemblies.GetOrAdd(taskName, t => assembly);
                }
            }

            if (message.StartsWith(itemGroupIncludeMessagePrefix))
            {
                var itemGroupInfo  = ParseItemGroupInfo(args.Message, itemGroupIncludeMessagePrefix);
                var itemActionInfo = new ItemActionInfo(true, itemGroupInfo, args.Timestamp);
                AddMessage(itemActionInfo, args);
                targetInfo.AddItemAction(itemActionInfo);
                return;
            }

            if (message.StartsWith(itemGroupRemoveMessagePrefix))
            {
                var itemGroupInfo  = ParseItemGroupInfo(args.Message, itemGroupRemoveMessagePrefix);
                var itemActionInfo = new ItemActionInfo(false, itemGroupInfo, args.Timestamp);
                AddMessage(itemActionInfo, args);
                targetInfo.AddItemAction(itemActionInfo);
                return;
            }

            if (message.StartsWith(propertyGroupMessagePrefix))
            {
                message = args.Message.Substring(propertyGroupMessagePrefix.Length);

                var kvp             = ParseNameValue(message);
                var propertySetInfo = new PropertySetInfo(kvp.Key, kvp.Value, args.Timestamp);
                AddMessage(propertySetInfo, args);
                targetInfo.AddPropertySet(propertySetInfo);
                return;
            }

            if (message.StartsWith("Task") && message.Contains("skipped"))
            {
                var taskName = Intern(ParseQuotedSubstring(message));
                if (taskName == null)
                {
                    throw new LoggerException(Resources.UnexpectedMessage);
                }

                var taskInfo = new TaskInfo(taskName, args.Timestamp);
                AddMessage(taskInfo, args);
                targetInfo.AddExecutedTask(taskInfo);
                return;
            }

            AddMessage(targetInfo, args);
        }