コード例 #1
0
ファイル: When.cs プロジェクト: nikson/msbuild
        /// <summary>
        /// Constructor for the When block.  Parses the contents of the When block (property
        /// groups, item groups, and nested chooses) and stores them.
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <owner>DavidLe</owner>
        /// <param name="parentProject"></param>
        /// <param name="parentGroupingCollection"></param>
        /// <param name="whenElement"></param>
        /// <param name="importedFromAnotherProject"></param>
        /// <param name="options"></param>
        /// <param name="nestingDepth">stack overflow guard</param>
        internal When(
            Project parentProject,
            GroupingCollection parentGroupingCollection,
            XmlElement whenElement,
            bool importedFromAnotherProject,
            Options options,
            int nestingDepth
            )
        {
            // Make sure the <When> node has been given to us.
            error.VerifyThrow(whenElement != null, "Need valid (non-null) <When> element.");

            // Make sure this really is the <When> node.
            error.VerifyThrow(whenElement.Name == XMakeElements.when || whenElement.Name == XMakeElements.otherwise,
                "Expected <{0}> or <{1}> element; received <{2}> element.",
                XMakeElements.when, XMakeElements.otherwise, whenElement.Name);

            this.propertyAndItemLists = new GroupingCollection(parentGroupingCollection);
            this.parentProject = parentProject;

            string elementName = ((options == Options.ProcessWhen) ? XMakeElements.when : XMakeElements.otherwise);

            if (options == Options.ProcessWhen)
            {
                conditionAttribute = ProjectXmlUtilities.GetConditionAttribute(whenElement, /*verify sole attribute*/ true);
                ProjectErrorUtilities.VerifyThrowInvalidProject(conditionAttribute != null, whenElement, "MissingCondition", XMakeElements.when);            
            }
            else
            {
                ProjectXmlUtilities.VerifyThrowProjectNoAttributes(whenElement);
            }

            ProcessWhenChildren(whenElement, parentProject, importedFromAnotherProject, nestingDepth);

        }
コード例 #2
0
        public BuildWhen(XmlElement whenElement, Project parentProject)
        {
            //this.parentProject = parentProject;
            this.groupingCollection = new GroupingCollection(parentProject);
            if (whenElement == null)
            {
                throw new ArgumentNullException("whenElement");
            }
            this.whenElement = whenElement;
            foreach (XmlElement xe in whenElement.ChildNodes)
            {
                switch (xe.Name)
                {
                case "ItemGroup":
                    BuildItemGroup big = new BuildItemGroup(xe, parentProject, null, true);
                    //big.BindToXml (xe);
                    groupingCollection.Add(big);
                    break;

                case "PropertyGroup":
                    BuildPropertyGroup bpg = new BuildPropertyGroup(xe, parentProject, null, true);
                    //bpg.BindToXml (xe);
                    groupingCollection.Add(bpg);
                    break;

                case "Choose":
                    BuildChoose bc = new BuildChoose(xe, parentProject);
                    groupingCollection.Add(bc);
                    break;

                default:
                    throw new InvalidProjectFileException(string.Format("Invalid element '{0}' in When.", xe.Name));
                }
            }
        }
コード例 #3
0
ファイル: BuildPropertyGroup.cs プロジェクト: nlhepler/mono
		internal BuildPropertyGroup (XmlElement xmlElement, Project project, ImportedProject importedProject, bool readOnly, bool isDynamic)
		{
			this.importedProject = importedProject;
			this.parentCollection = null;
			this.parentProject = project;
			this.propertyGroup = xmlElement;
			this.read_only = readOnly;
			this.isDynamic = isDynamic;

			if (FromXml) {
				this.properties = new List <BuildProperty> ();
				foreach (XmlNode xn in propertyGroup.ChildNodes) {
					if (!(xn is XmlElement))
						continue;
					
					XmlElement xe = (XmlElement) xn;
					BuildProperty bp = new BuildProperty (parentProject, xe);
					AddProperty (bp);
				} 
			} else
				this.propertiesByName = new Dictionary <string, BuildProperty> (StringComparer.OrdinalIgnoreCase);

			DefinedInFileName = importedProject != null ? importedProject.FullFileName :
						(project != null ? project.FullFileName : null);
		}
コード例 #4
0
        internal BuildPropertyGroup(XmlElement xmlElement, Project project, ImportedProject importedProject, bool readOnly, bool isDynamic)
        {
            this.importedProject  = importedProject;
            this.parentCollection = null;
            this.parentProject    = project;
            this.propertyGroup    = xmlElement;
            this.read_only        = readOnly;
            this.isDynamic        = isDynamic;

            if (FromXml)
            {
                this.properties = new List <BuildProperty> ();
                foreach (XmlNode xn in propertyGroup.ChildNodes)
                {
                    if (!(xn is XmlElement))
                    {
                        continue;
                    }

                    XmlElement    xe = (XmlElement)xn;
                    BuildProperty bp = new BuildProperty(parentProject, xe);
                    AddProperty(bp);
                }
            }
            else
            {
                this.propertiesByName = new Dictionary <string, BuildProperty> (StringComparer.OrdinalIgnoreCase);
            }

            DefinedInFileName = importedProject != null ? importedProject.FullFileName :
                                (project != null ? project.FullFileName : null);
        }
コード例 #5
0
 public BuildWhen(XmlElement whenElement, Project parentProject)
 {
     this.parentProject      = parentProject;
     this.groupingCollection = new GroupingCollection(null);
     if (whenElement == null)
     {
         throw new ArgumentNullException("whenElement");
     }
     this.whenElement = whenElement;
     foreach (XmlElement xe in whenElement.ChildNodes)
     {
         if (xe.Name == "ItemGroup")
         {
             BuildItemGroup big = new BuildItemGroup(xe, parentProject, null, true);
             //big.BindToXml (xe);
             groupingCollection.Add(big);
             // FIXME: add nested chooses
         }
         else if (xe.Name == "PropertyGroup")
         {
             BuildPropertyGroup bpg = new BuildPropertyGroup();
             //bpg.BindToXml (xe);
             groupingCollection.Add(bpg);
         }
         else
         {
             throw new InvalidProjectFileException("Invalid element in When.");
         }
     }
 }
コード例 #6
0
        /// <summary>
        /// Constructor for the When block.  Parses the contents of the When block (property
        /// groups, item groups, and nested chooses) and stores them.
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <owner>DavidLe</owner>
        /// <param name="parentProject"></param>
        /// <param name="parentGroupingCollection"></param>
        /// <param name="whenElement"></param>
        /// <param name="importedFromAnotherProject"></param>
        /// <param name="options"></param>
        /// <param name="nestingDepth">stack overflow guard</param>
        internal When(
            Project parentProject,
            GroupingCollection parentGroupingCollection,
            XmlElement whenElement,
            bool importedFromAnotherProject,
            Options options,
            int nestingDepth
            )
        {
            // Make sure the <When> node has been given to us.
            error.VerifyThrow(whenElement != null, "Need valid (non-null) <When> element.");

            // Make sure this really is the <When> node.
            error.VerifyThrow(whenElement.Name == XMakeElements.when || whenElement.Name == XMakeElements.otherwise,
                              "Expected <{0}> or <{1}> element; received <{2}> element.",
                              XMakeElements.when, XMakeElements.otherwise, whenElement.Name);

            this.propertyAndItemLists = new GroupingCollection(parentGroupingCollection);
            this.parentProject        = parentProject;

            string elementName = ((options == Options.ProcessWhen) ? XMakeElements.when : XMakeElements.otherwise);

            if (options == Options.ProcessWhen)
            {
                conditionAttribute = ProjectXmlUtilities.GetConditionAttribute(whenElement, /*verify sole attribute*/ true);
                ProjectErrorUtilities.VerifyThrowInvalidProject(conditionAttribute != null, whenElement, "MissingCondition", XMakeElements.when);
            }
            else
            {
                ProjectXmlUtilities.VerifyThrowProjectNoAttributes(whenElement);
            }

            ProcessWhenChildren(whenElement, parentProject, importedFromAnotherProject, nestingDepth);
        }
コード例 #7
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="groupingCollection"></param>
 /// <owner>rgoel</owner>
 internal BuildPropertyGroupCollection
     (
     GroupingCollection groupingCollection
     )
 {
     this.groupingCollection = groupingCollection;
 }
コード例 #8
0
ファイル: BuildPropertyGroup.cs プロジェクト: mdae/MonoRT
        internal BuildPropertyGroup(XmlElement xmlElement, Project project, ImportedProject importedProject, bool readOnly)
        {
            this.importedProject  = importedProject;
            this.parentCollection = null;
            this.parentProject    = project;
            this.propertyGroup    = xmlElement;
            this.read_only        = readOnly;

            if (FromXml)
            {
                this.properties = new List <BuildProperty> ();
                foreach (XmlNode xn in propertyGroup.ChildNodes)
                {
                    if (!(xn is XmlElement))
                    {
                        continue;
                    }

                    XmlElement    xe = (XmlElement)xn;
                    BuildProperty bp = new BuildProperty(parentProject, xe);
                    AddProperty(bp);
                }
            }
            else
            {
                this.propertiesByName = new Dictionary <string, BuildProperty> (StringComparer.InvariantCultureIgnoreCase);
            }
        }
コード例 #9
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="groupingCollection"></param>
 /// <owner>rgoel</owner>
 internal BuildPropertyGroupCollection
 (
     GroupingCollection groupingCollection
 )
 {
     this.groupingCollection = groupingCollection;
 }
コード例 #10
0
		public BuildWhen (XmlElement whenElement, Project parentProject)
		{
			this.parentProject = parentProject;
			this.groupingCollection = new GroupingCollection (parentProject);
			if (whenElement == null)
				throw new ArgumentNullException ("whenElement");
			this.whenElement = whenElement;
			foreach (XmlElement xe in whenElement.ChildNodes) {
				switch (xe.Name) {
					case "ItemGroup":
						BuildItemGroup big = new BuildItemGroup (xe, parentProject, null, true);
						//big.BindToXml (xe);
						groupingCollection.Add (big);
						break;
					case "PropertyGroup":
						BuildPropertyGroup bpg = new BuildPropertyGroup (xe, parentProject, null, true);
						//bpg.BindToXml (xe);
						groupingCollection.Add (bpg);
						break;
					case "Choose":
						BuildChoose bc = new BuildChoose (xe, parentProject);
						groupingCollection.Add (bc);
						break;
					default:
						throw new InvalidProjectFileException ( string.Format ("Invalid element '{0}' in When.", xe.Name));
				}
			}
		}
コード例 #11
0
 /// <summary>
 /// GroupingCollection constructor.  Basically just initializes internal
 /// data structures.
 /// </summary>
 /// <remarks>
 /// </remarks>
 /// <param name="parentGroupingCollection">The parent collection of this grouping collection, null for the master collection</param>
 /// <owner>DavidLe</owner>
 /// <returns>IEnumerator</returns>
 internal GroupingCollection
 (
     GroupingCollection parentGroupingCollection
 )
 {
     this.combinedGroupList        = new ArrayList();
     this.parentGroupingCollection = parentGroupingCollection;
 }
コード例 #12
0
ファイル: GroupingCollection.cs プロジェクト: nikson/msbuild
 /// <summary>
 /// GroupingCollection constructor.  Basically just initializes internal
 /// data structures.
 /// </summary>
 /// <remarks>
 /// </remarks>
 /// <param name="parentGroupingCollection">The parent collection of this grouping collection, null for the master collection</param>
 /// <owner>DavidLe</owner>
 /// <returns>IEnumerator</returns>
 internal GroupingCollection
     (
     GroupingCollection parentGroupingCollection
     )
 {
     this.combinedGroupList = new ArrayList();
     this.parentGroupingCollection = parentGroupingCollection;
 }
コード例 #13
0
        /// <summary>
        /// Constructor that takes the GroupingCollection that this sits over.
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <owner>DavidLe</owner>
        /// <param name="groupingCollection"></param>
        internal BuildItemGroupCollection
        (
            GroupingCollection groupingCollection
        )
        {
            error.VerifyThrow(groupingCollection != null, "GroupingCollection is null!");

            this.groupingCollection = groupingCollection;
        }
コード例 #14
0
        /// <summary>
        /// Constructor that takes the GroupingCollection that this sits over.
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <owner>DavidLe</owner>
        /// <param name="groupingCollection"></param>
        internal BuildItemGroupCollection
            (
            GroupingCollection groupingCollection
            )
        {
            error.VerifyThrow(groupingCollection != null, "GroupingCollection is null!");

            this.groupingCollection = groupingCollection;
        }
コード例 #15
0
        /// <summary>
        /// Constructor for the GroupEnumeratorHelper.  At construction
        /// time, you specify the GroupingCollection to use, and the type
        /// of enumerator you wish to get.
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <owner>DavidLe</owner>
        /// <param name="groupingCollection"></param>
        /// <param name="type"></param>
        /// <returns>IEnumerator</returns>
        internal GroupEnumeratorHelper
        (
            GroupingCollection groupingCollection,
            ListType type
        )
        {
            error.VerifyThrow(groupingCollection != null, "GroupingCollection is null");

            this.groupingCollection = groupingCollection;
            this.type = type;
        }
コード例 #16
0
        /// <summary>
        /// Constructor for the GroupEnumeratorHelper.  At construction
        /// time, you specify the GroupingCollection to use, and the type
        /// of enumerator you wish to get.
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <owner>DavidLe</owner>
        /// <param name="groupingCollection"></param>
        /// <param name="type"></param>
        /// <returns>IEnumerator</returns>
        internal GroupEnumeratorHelper
            (
                GroupingCollection groupingCollection,
                ListType type
            )
        {
            error.VerifyThrow(groupingCollection != null, "GroupingCollection is null");

            this.groupingCollection = groupingCollection;
            this.type = type;
        }
コード例 #17
0
 private void AssertNItemGroupsInCollection(GroupingCollection group, int n)
 {
     int count;
     count = 0;
     foreach (IItemPropertyGrouping pg in new GroupEnumeratorHelper(group, GroupEnumeratorHelper.ListType.ItemGroupsAll))
     {
         count++;
     }
     Assertion.AssertEquals(n, count);
     // ItemGroupCount uses a different mechanism to obtain the total count, so verify it as well
     Assertion.AssertEquals(n, group.ItemGroupCount);
 }
コード例 #18
0
ファイル: Choose.cs プロジェクト: xen2/msbuild
        /// <summary>
        /// Constructor for the Choose object.  Parses the contents of the Choose
        /// and sets up list of When blocks
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <owner>DavidLe</owner>
        /// <param name="parentProject"></param>
        /// <param name="parentGroupingCollection"></param>
        /// <param name="chooseElement"></param>
        /// <param name="importedFromAnotherProject"></param>
        /// <param name="nestingDepth">stack overflow guard</param>
        internal Choose
        (
            Project parentProject,
            GroupingCollection parentGroupingCollection,
            XmlElement chooseElement,
            bool importedFromAnotherProject,
            int nestingDepth
        )
        {
            whenClauseList = new ArrayList();

            error.VerifyThrow(chooseElement != null, "Need valid <Choose> element.");

            // Make sure this really is the <Choose> node.
            ProjectXmlUtilities.VerifyThrowElementName(chooseElement, XMakeElements.choose);

            // Stack overflow guard. The only way in the MSBuild file format that MSBuild elements can be
            // legitimately nested without limit is the <Choose> construct. So, enforce a nesting limit
            // to avoid blowing our stack.
            nestingDepth++;
            ProjectErrorUtilities.VerifyThrowInvalidProject(nestingDepth <= maximumChooseNesting, chooseElement, "ChooseOverflow", maximumChooseNesting);

            this.importedFromAnotherProject = importedFromAnotherProject;

            // This <Choose> is coming from an existing XML element, so
            // walk through all the attributes and child elements, creating the
            // necessary When objects.

            // No attributes on the <Choose> element, so don't allow any.
            ProjectXmlUtilities.VerifyThrowProjectNoAttributes(chooseElement);

            bool foundOtherwise = false;

            // Loop through the child nodes of the <Choose> element.
            foreach (XmlNode chooseChildNode in chooseElement)
            {
                switch (chooseChildNode.NodeType)
                {
                // Handle XML comments under the <PropertyGroup> node (just ignore them).
                case XmlNodeType.Comment:
                // fall through
                case XmlNodeType.Whitespace:
                    // ignore whitespace
                    break;

                case XmlNodeType.Element:
                    // The only two types of child nodes that a <Choose> element can contain
                    // is are <When> elements and zero or one <Otherwise> elements.

                    ProjectXmlUtilities.VerifyThrowProjectValidNamespace((XmlElement)chooseChildNode);

                    if (chooseChildNode.Name == XMakeElements.when)
                    {
                        // don't allow <When> to follow <Otherwise>
                        ProjectErrorUtilities.VerifyThrowInvalidProject(!foundOtherwise,
                                                                        chooseChildNode, "WhenNotAllowedAfterOtherwise");
                        When newWhen = new When(parentProject,
                                                parentGroupingCollection,
                                                (XmlElement)chooseChildNode,
                                                importedFromAnotherProject,
                                                When.Options.ProcessWhen,
                                                nestingDepth);
                        this.whenClauseList.Add(newWhen);
                    }
                    else if (chooseChildNode.Name == XMakeElements.otherwise)
                    {
                        ProjectErrorUtilities.VerifyThrowInvalidProject(!foundOtherwise,
                                                                        chooseChildNode, "MultipleOtherwise");
                        When newWhen = new When(parentProject,
                                                parentGroupingCollection,
                                                (XmlElement)chooseChildNode,
                                                importedFromAnotherProject,
                                                When.Options.ProcessOtherwise,
                                                nestingDepth);
                        otherwiseClause = newWhen;
                        foundOtherwise  = true;
                    }
                    else
                    {
                        ProjectXmlUtilities.ThrowProjectInvalidChildElement(chooseChildNode);
                    }
                    break;

                default:
                    // Unrecognized child element.
                    ProjectXmlUtilities.ThrowProjectInvalidChildElement(chooseChildNode);
                    break;
                }
            }
            ProjectErrorUtilities.VerifyThrowInvalidProject(this.whenClauseList.Count != 0,
                                                            chooseElement, "ChooseMustContainWhen");
        }
コード例 #19
0
 internal BuildItemGroupCollection(GroupingCollection groupingCollection)
 {
     this.groupingCollection = groupingCollection;
 }
コード例 #20
0
 BuildItemGroupCollection()
 {
     groupingCollection = new GroupingCollection(null);
 }
コード例 #21
0
		BuildPropertyGroupCollection ()
		{
			groupingCollection = new GroupingCollection (null);
		}
コード例 #22
0
ファイル: Choose.cs プロジェクト: nikson/msbuild
        /// <summary>
        /// Constructor for the Choose object.  Parses the contents of the Choose
        /// and sets up list of When blocks
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <owner>DavidLe</owner>
        /// <param name="parentProject"></param>
        /// <param name="parentGroupingCollection"></param>
        /// <param name="chooseElement"></param>
        /// <param name="importedFromAnotherProject"></param>
        /// <param name="nestingDepth">stack overflow guard</param>
        internal Choose
        (
            Project parentProject,
            GroupingCollection parentGroupingCollection,
            XmlElement chooseElement,
            bool importedFromAnotherProject,
            int nestingDepth
        )
        {
            whenClauseList = new ArrayList();

            error.VerifyThrow(chooseElement != null, "Need valid <Choose> element.");

            // Make sure this really is the <Choose> node.
            ProjectXmlUtilities.VerifyThrowElementName(chooseElement, XMakeElements.choose);

            // Stack overflow guard. The only way in the MSBuild file format that MSBuild elements can be
            // legitimately nested without limit is the <Choose> construct. So, enforce a nesting limit 
            // to avoid blowing our stack.
            nestingDepth++;
            ProjectErrorUtilities.VerifyThrowInvalidProject(nestingDepth <= maximumChooseNesting, chooseElement, "ChooseOverflow", maximumChooseNesting);

            this.importedFromAnotherProject = importedFromAnotherProject;

            // This <Choose> is coming from an existing XML element, so
            // walk through all the attributes and child elements, creating the
            // necessary When objects.

            // No attributes on the <Choose> element, so don't allow any.
            ProjectXmlUtilities.VerifyThrowProjectNoAttributes(chooseElement);

            bool foundOtherwise = false;
            // Loop through the child nodes of the <Choose> element.
            foreach (XmlNode chooseChildNode in chooseElement)
            {
                switch (chooseChildNode.NodeType)
                {
                    // Handle XML comments under the <PropertyGroup> node (just ignore them).
                    case XmlNodeType.Comment:
                    // fall through
                    case XmlNodeType.Whitespace:
                        // ignore whitespace
                        break;

                    case XmlNodeType.Element:
                        // The only two types of child nodes that a <Choose> element can contain
                        // is are <When> elements and zero or one <Otherwise> elements.

                        ProjectXmlUtilities.VerifyThrowProjectValidNamespace((XmlElement)chooseChildNode);

                        if (chooseChildNode.Name == XMakeElements.when)
                        {
                            // don't allow <When> to follow <Otherwise>
                            ProjectErrorUtilities.VerifyThrowInvalidProject(!foundOtherwise,
                                    chooseChildNode, "WhenNotAllowedAfterOtherwise");
                            When newWhen = new When(parentProject,
                                parentGroupingCollection,
                                (XmlElement)chooseChildNode,
                                importedFromAnotherProject,
                                When.Options.ProcessWhen,
                                nestingDepth);
                            this.whenClauseList.Add(newWhen);
                        }
                        else if (chooseChildNode.Name == XMakeElements.otherwise)
                        {
                            ProjectErrorUtilities.VerifyThrowInvalidProject(!foundOtherwise,
                                        chooseChildNode, "MultipleOtherwise");
                            When newWhen = new When(parentProject,
                                parentGroupingCollection,
                                (XmlElement)chooseChildNode,
                                importedFromAnotherProject,
                                When.Options.ProcessOtherwise,
                                nestingDepth);
                            otherwiseClause = newWhen;
                            foundOtherwise = true;
                        }
                        else
                        {
                            ProjectXmlUtilities.ThrowProjectInvalidChildElement(chooseChildNode);
                        }
                        break;

                    default:
                        // Unrecognized child element.
                        ProjectXmlUtilities.ThrowProjectInvalidChildElement(chooseChildNode);
                        break;
                }
            }
            ProjectErrorUtilities.VerifyThrowInvalidProject(this.whenClauseList.Count != 0,
                    chooseElement, "ChooseMustContainWhen");
        }
コード例 #23
0
ファイル: Project.cs プロジェクト: nikson/msbuild
        /// <summary>
        /// Creates an instance of this class for the given engine, specifying a tools version to
        /// use during builds of this project.
        /// </summary>
        /// <owner>RGoel</owner>
        /// <param name="engine">Engine that will build this project. May be null if the global engine is expected.</param>
        /// <param name="toolsVersion">Tools version to use during builds of this project instance. May be null,
        /// in which case we will use the value in the Project's ToolsVersion attribute, or else the engine
        /// default value.</param>
        public Project
        (
            Engine engine,
            string toolsVersion
        )
        {
#if MSBUILDENABLEVSPROFILING 
            try
            {
                DataCollection.CommentMarkProfile(8808, "Construct Project Using Old OM - Start");
#endif 
#if (!STANDALONEBUILD)
            using (new CodeMarkerStartEnd(CodeMarkerEvent.perfMSBuildProjectConstructBegin, CodeMarkerEvent.perfMSBuildProjectConstructEnd))
#endif
            {
                if (engine == null)
                {
                    engine = Engine.GlobalEngine;
                }

                this.parentEngine = engine;
                this.projectId = parentEngine.GetNextProjectId();
                this.projectBuildEventContext = new BuildEventContext(parentEngine.NodeId, BuildEventContext.InvalidTargetId, parentEngine.GetNextProjectId(), BuildEventContext.InvalidTaskId);

                this.isLoadedByHost = true;
                this.buildEnabled = BuildEnabledSetting.UseParentEngineSetting;

                this.isValidated = false;

                // Create a new XML document and add a <Project> element.  This way, the
                // project is always in a valid state from the beginning, and now somebody
                // can start programmatically adding stuff to the <Project>.
                this.mainProjectEntireContents = new XmlDocument();
                this.mainProjectElement = mainProjectEntireContents.CreateElement(XMakeElements.project, XMakeAttributes.defaultXmlNamespace);
                this.mainProjectEntireContents.AppendChild(mainProjectElement);


                // initialize all case-insensitive hash-tables
                this.conditionedPropertiesTable = new Hashtable(StringComparer.OrdinalIgnoreCase);
                this.evaluatedItemsByName = new Hashtable(StringComparer.OrdinalIgnoreCase);
                this.evaluatedItemsByNameIgnoringCondition = new Hashtable(StringComparer.OrdinalIgnoreCase);

                // Create the group collection.  All collection elements are stored here.
                this.rawGroups = new GroupingCollection(null /* null parent means this is the master collection */);

                // Initialize all property-related objects.
                // (see above for initialization of this.conditionedPropertiesTable)
                this.globalProperties = null;
                this.environmentProperties = null;
                this.reservedProperties = null;
                // We still create the rawPropertyGroups collection, but
                // it's just a facade over rawGroups
                this.rawPropertyGroups = new BuildPropertyGroupCollection(this.rawGroups);
                this.evaluatedProperties = new BuildPropertyGroup();

                // Initialize all item-related objects.
                // (see above for initialization of this.evaluatedItemsByName and this.evaluatedItemsByNameIgnoringCondition
                // We still create the rawItemGroups collection, but it's just a facade over rawGroups
                this.rawItemGroups = new BuildItemGroupCollection(this.rawGroups);
                this.evaluatedItems = new BuildItemGroup();
                this.evaluatedItemsIgnoringCondition = new BuildItemGroup();

                this.itemDefinitionLibrary = new ItemDefinitionLibrary(this);

                // Initialize all target- and task-related objects.
                this.usingTasks = new UsingTaskCollection();
                this.imports = new ImportCollection(this);
                this.taskRegistry = new TaskRegistry();
                this.targets = new TargetCollection(this);

                // Initialize the default targets, initial targets, and project file name.
                this.defaultTargetNames = new string[0];
                this.initialTargetNamesInMainProject = new ArrayList();
                this.initialTargetNamesInImportedProjects = new ArrayList();
                this.FullFileName = String.Empty;
                this.projectDirectory = String.Empty;

                this.projectExtensionsNode = null;

                // If the toolsVersion is null, we will use the value specified in
                // the Project element's ToolsVersion attribute, or else the default if that
                // attribute is not present.
                if (null != toolsVersion)
                {
                    this.ToolsVersion = toolsVersion;
                }

                this.MarkProjectAsDirtyForReprocessXml();
                // The project doesn't really need to be saved yet; there's nothing in it!
                this.dirtyNeedToSaveProjectFile = false;
                this.IsReset = false;

                // Grab some initial properties from the Engine.
                // Global properties and reserved properties need to be cloned, because
                // different projects may have different sets of properties or values
                // for these.  Environment properties don't have to be cloned, because
                // the environment is captured once at engine instantiation, and
                // shared by all projects thereafter.
                this.GlobalProperties = this.parentEngine.GlobalProperties;
                this.EnvironmentProperties = this.parentEngine.EnvironmentProperties;
            }
#if MSBUILDENABLEVSPROFILING 
            }
            finally
            {
                DataCollection.CommentMarkProfile(8809, "Construct Project Using Old OM - End");
            }
#endif
        }
コード例 #24
0
		BuildItemGroupCollection ()
		{
			groupingCollection = new GroupingCollection (null);
		}
コード例 #25
0
 private void AssertNPropertyGroupsAndChoosesInCollection(GroupingCollection group, int n)
 {
     int count;
     count = 0;
     foreach (IItemPropertyGrouping pg in new GroupEnumeratorHelper(group, GroupEnumeratorHelper.ListType.PropertyGroupsTopLevelAndChoose))
     {
         count++;
     }
     Assertion.AssertEquals(n, count);
 }
コード例 #26
0
        public void LinkedCount()
        {
            SetupMembers();
            GroupingCollection masterGroup = new GroupingCollection(null);
            GroupingCollection childGroup1 = new GroupingCollection(masterGroup);
            GroupingCollection childGroup2 = new GroupingCollection(masterGroup);
            GroupingCollection nestedGroup = new GroupingCollection(childGroup1);

            nestedGroup.InsertAtEnd(this.ig1);
            nestedGroup.InsertAfter(this.ig2, this.ig1);
            nestedGroup.InsertAtBeginning(this.pg1);

            childGroup1.InsertAtEnd(this.ig1);
            childGroup1.InsertAtBeginning(this.pg1);

            childGroup2.InsertAtBeginning(this.pg1);

            masterGroup.InsertAtEnd(this.ig1);
            masterGroup.InsertAfter(this.ig2, this.ig1);
            masterGroup.InsertAtEnd(this.pg2);

            Assertion.AssertEquals(nestedGroup.ItemGroupCount, 2);
            Assertion.AssertEquals(nestedGroup.PropertyGroupCount, 1);

            Assertion.AssertEquals(childGroup1.ItemGroupCount, 1 + 2);
            Assertion.AssertEquals(childGroup1.PropertyGroupCount, 1 + 1);

            Assertion.AssertEquals(childGroup2.ItemGroupCount, 0);
            Assertion.AssertEquals(childGroup2.PropertyGroupCount, 1);

            Assertion.AssertEquals(masterGroup.ItemGroupCount, 2 + 0 + 1 + 2);
            Assertion.AssertEquals(masterGroup.PropertyGroupCount, 1 + 1 + 1 + 1);

            nestedGroup.Clear();
            nestedGroup.InsertAtEnd(this.ig2);
            nestedGroup.InsertAfter(this.ig3, this.ig2);
            
            childGroup1.RemovePropertyGroup(this.pg1);
            childGroup1.RemoveItemGroup(this.ig1);
            childGroup1.InsertAtEnd(this.ig3);

            childGroup2.RemovePropertyGroup(this.pg1);
            
            masterGroup.RemoveItemGroup(this.ig2);

            Assertion.AssertEquals(nestedGroup.ItemGroupCount, 2);
            Assertion.AssertEquals(nestedGroup.PropertyGroupCount, 0);

            Assertion.AssertEquals(childGroup1.ItemGroupCount, 1 + 2);
            Assertion.AssertEquals(childGroup1.PropertyGroupCount, 0 + 0);

            Assertion.AssertEquals(childGroup2.ItemGroupCount, 0);
            Assertion.AssertEquals(childGroup2.PropertyGroupCount, 0);

            Assertion.AssertEquals(masterGroup.ItemGroupCount, 1 + 0 + 1 + 2);
            Assertion.AssertEquals(masterGroup.PropertyGroupCount, 1 + 0 + 0 + 0);
        }
コード例 #27
0
        public void RemoveTest()
        {
            SetupMembers();
            GroupingCollection group = new GroupingCollection(null);
            group.InsertAtEnd(this.pg1);
            group.InsertAtEnd(this.ig1);
            group.InsertAtBeginning(this.pg2);
            group.InsertAtEnd(this.ig2);
            group.InsertAfter(this.ig3, this.ig2);
            group.InsertAfter(this.pg3, this.pg2);

            AssertNPropertyGroupsInCollection(group, 3);
            AssertNItemGroupsInCollection(group, 3);

            group.RemovePropertyGroup(this.pg3);
            AssertNPropertyGroupsInCollection(group, 2);
            AssertNItemGroupsInCollection(group, 3);

            group.RemovePropertyGroup(this.pg2);
            AssertNPropertyGroupsInCollection(group, 1);
            AssertNItemGroupsInCollection(group, 3);

            group.RemoveItemGroup(this.ig2);
            AssertNPropertyGroupsInCollection(group, 1);
            AssertNItemGroupsInCollection(group, 2);
        }
コード例 #28
0
        public void InsertionTest()
        {
            SetupMembers();
            GroupingCollection group = new GroupingCollection(null);
            group.InsertAtEnd(this.pg1);
            group.InsertAtEnd(this.ig1);
            group.InsertAtBeginning(this.pg2);
            group.InsertAtEnd(this.ig2);
            group.InsertAfter(this.ig3, this.ig2);
            group.InsertAfter(this.pg3, this.pg2);

            AssertNPropertyGroupsInCollection(group, 3);
            Assertion.Assert(group.PropertyGroupCount == 3);
            AssertNItemGroupsInCollection(group, 3);
            Assertion.Assert(group.ItemGroupCount == 3);

            group.InsertAtEnd(this.choose1);
            group.InsertAtEnd(this.choose2);
        }
コード例 #29
0
        public void EnumerationTest()
        {
            SetupMembers();
            GroupingCollection group = new GroupingCollection(null);
            group.InsertAtEnd(this.pg1);
            group.InsertAtEnd(this.ig1);
            group.InsertAtEnd(this.pg2);
            group.InsertAtEnd(this.ig2);
            group.InsertAtEnd(this.ig3);

            AssertNPropertyGroupsInCollection(group, 2);
            Assertion.Assert(group.PropertyGroupCount == 2);
            AssertNItemGroupsInCollection(group, 3);
            Assertion.Assert(group.ItemGroupCount == 3);

            group.InsertAtEnd(this.choose1);
            group.InsertAtEnd(this.choose2);

            AssertNPropertyGroupsInCollection(group, 2);
            Assertion.Assert(group.PropertyGroupCount == 2);
            AssertNItemGroupsInCollection(group, 3);
            Assertion.Assert(group.ItemGroupCount == 3);

            AssertNPropertyGroupsAndChoosesInCollection(group, 4);
            AssertNItemGroupsAndChoosesInCollection(group, 5);
        }
コード例 #30
0
 BuildPropertyGroupCollection()
 {
     groupingCollection = new GroupingCollection(null);
 }
コード例 #31
0
ファイル: ImportCollection.cs プロジェクト: carrie901/mono
		internal ImportCollection (GroupingCollection groupingCollection)
		{
			this.groupingCollection = groupingCollection;
			filenames = new Dictionary <string, Import> ();
		}
コード例 #32
0
 internal ImportCollection(GroupingCollection groupingCollection)
 {
     this.groupingCollection = groupingCollection;
     filenames = new Dictionary <string, Import> ();
 }
コード例 #33
0
		internal BuildItemGroupCollection (GroupingCollection groupingCollection)
		{
			this.groupingCollection = groupingCollection;
		}