Пример #1
0
        /// <summary>
        /// Execute an ItemGroup element, including each child item expression
        /// </summary>
        private void ExecuteItemGroup(Lookup lookup)
        {
            foreach (BuildItemGroupChildXml child in backingBuildItemGroupChildren)
            {
                ArrayList buckets = null;

                try
                {
                    List <string> parameterValues = new List <string>();
                    GetBatchableValuesFromBuildItemGroupChild(parameterValues, child);
                    buckets = BatchingEngine.PrepareBatchingBuckets(taskNodeXmlElement, parameterValues, lookup, child.Name);

                    // "Execute" each bucket
                    foreach (ItemBucket bucket in buckets)
                    {
                        // Gather the outputs, but don't make them visible to other buckets
                        switch (child.ChildType)
                        {
                        case ChildType.BuildItemAdd:
                            // It's an item -- we're "adding" items to the world
                            ExecuteAdd(child, bucket);
                            break;

                        case ChildType.BuildItemRemove:
                            // It's a remove -- we're "removing" items from the world
                            ExecuteRemove(child, bucket);
                            break;

                        case ChildType.BuildItemModify:
                            // It's a modify -- changing existing items
                            ExecuteModify(child, bucket);
                            break;
                        }
                    }
                }
                finally
                {
                    if (buckets != null)
                    {
                        // Propagate the item changes to the bucket above
                        foreach (ItemBucket bucket in buckets)
                        {
                            bucket.Lookup.LeaveScope();
                        }
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Execute a PropertyGroup element, including each child property
        /// </summary>
        private void ExecutePropertyGroup(Lookup lookup)
        {
            foreach (BuildProperty property in backingPropertyGroup)
            {
                ArrayList buckets = null;

                try
                {
                    // Find all the metadata references in order to create buckets
                    List <string> parameterValues = new List <string>();
                    GetBatchableValuesFromProperty(parameterValues, property);
                    buckets = BatchingEngine.PrepareBatchingBuckets(taskNodeXmlElement, parameterValues, lookup);

                    // "Execute" each bucket
                    foreach (ItemBucket bucket in buckets)
                    {
                        if (Utilities.EvaluateCondition(property.Condition, property.ConditionAttribute,
                                                        bucket.Expander, null, ParserOptions.AllowAll, loggingServices, buildEventContext))
                        {
                            // Check for a reserved name now, so it fails right here instead of later when the property eventually reaches
                            // the outer scope.
                            ProjectErrorUtilities.VerifyThrowInvalidProject(!ReservedPropertyNames.IsReservedProperty(property.Name), property.PropertyElement,
                                                                            "CannotModifyReservedProperty", property.Name);

                            property.Evaluate(bucket.Expander);
                            bucket.Lookup.SetProperty(property);
                        }
                    }
                }
                finally
                {
                    if (buckets != null)
                    {
                        // Propagate the property changes to the bucket above
                        foreach (ItemBucket bucket in buckets)
                        {
                            bucket.Lookup.LeaveScope();
                        }
                    }
                }
            }
        }