示例#1
0
        private static bool EvaluateCondition(
            string condition,
            ProjectElement element,
            ExpanderOptions expanderOptions,
            ParserOptions parserOptions,
            Expander <P, I> expander,
            LazyItemEvaluator <P, I, M, D> lazyEvaluator
            )
        {
            if (condition?.Length == 0)
            {
                return(true);
            }
            MSBuildEventSource.Log.EvaluateConditionStart(condition);

            using (lazyEvaluator._evaluationProfiler.TrackCondition(element.ConditionLocation, condition))
            {
                bool result = ConditionEvaluator.EvaluateCondition
                              (
                    condition,
                    parserOptions,
                    expander,
                    expanderOptions,
                    GetCurrentDirectoryForConditionEvaluation(element, lazyEvaluator),
                    element.ConditionLocation,
                    lazyEvaluator._loggingContext.LoggingService,
                    lazyEvaluator._loggingContext.BuildEventContext,
                    lazyEvaluator.FileSystem
                              );
                MSBuildEventSource.Log.EvaluateConditionStop(condition, result);

                return(result);
            }
        }
示例#2
0
            public IncludeOperation(IncludeOperationBuilder builder, LazyItemEvaluator <P, I, M, D> lazyEvaluator)
                : base(builder, lazyEvaluator)
            {
                _elementOrder  = builder.ElementOrder;
                _rootDirectory = builder.RootDirectory;

                _excludes = builder.Excludes.ToImmutable();
                _metadata = builder.Metadata.ToImmutable();
            }
示例#3
0
 private static bool EvaluateCondition(
     ProjectElement element,
     ExpanderOptions expanderOptions,
     ParserOptions parserOptions,
     Expander <P, I> expander,
     LazyItemEvaluator <P, I, M, D> lazyEvaluator
     )
 {
     return(EvaluateCondition(element.Condition, element, expanderOptions, parserOptions, expander, lazyEvaluator));
 }
示例#4
0
            protected LazyItemOperation(OperationBuilder builder, LazyItemEvaluator <P, I, M, D> lazyEvaluator)
            {
                _itemElement         = builder.ItemElement;
                _itemType            = builder.ItemType;
                _itemSpec            = builder.ItemSpec;
                _referencedItemLists = builder.ReferencedItemLists.ToImmutable();
                _conditionResult     = builder.ConditionResult;

                _lazyEvaluator = lazyEvaluator;

                _evaluatorData = new EvaluatorData(_lazyEvaluator._outerEvaluatorData, itemType => GetReferencedItems(itemType, ImmutableHashSet <string> .Empty));
                _itemFactory   = new ItemFactoryWrapper(_itemElement, _lazyEvaluator._itemFactory);
                _expander      = new Expander <P, I>(_evaluatorData, _evaluatorData, _lazyEvaluator.FileSystem);

                _itemSpec.Expander = _expander;
            }
示例#5
0
 /// <summary>
 /// COMPAT: Whidbey used the "current project file/targets" directory for evaluating Import and PropertyGroup conditions
 /// Orcas broke this by using the current root project file for all conditions
 /// For Dev10+, we'll fix this, and use the current project file/targets directory for Import, ImportGroup and PropertyGroup
 /// but the root project file for the rest. Inside of targets will use the root project file as always.
 /// </summary>
 private static string GetCurrentDirectoryForConditionEvaluation(ProjectElement element, LazyItemEvaluator <P, I, M, D> lazyEvaluator)
 {
     if (element is ProjectPropertyGroupElement || element is ProjectImportElement || element is ProjectImportGroupElement)
     {
         return(element.ContainingProject.DirectoryPath);
     }
     else
     {
         return(lazyEvaluator._outerEvaluatorData.Directory);
     }
 }
示例#6
0
 public RemoveOperation(RemoveOperationBuilder builder, LazyItemEvaluator <P, I, M, D> lazyEvaluator)
     : base(builder, lazyEvaluator)
 {
     _matchOnMetadata        = builder.MatchOnMetadata.ToImmutable();
     _matchOnMetadataOptions = builder.MatchOnMetadataOptions;
 }
示例#7
0
 public UpdateOperation(OperationBuilderWithMetadata builder, LazyItemEvaluator<P, I, M, D> lazyEvaluator)
     : base(builder, lazyEvaluator)
 {
     _metadata = builder.Metadata.ToImmutable();
 }