Exemplo n.º 1
0
        internal Target(XmlElement targetElement, Project project, ImportedProject importedProject)
        {
            if (project == null)
            {
                throw new ArgumentNullException("project");
            }
            if (targetElement == null)
            {
                throw new ArgumentNullException("targetElement");
            }

            this.targetElement = targetElement;
            this.name          = targetElement.GetAttribute("Name");

            this.project         = project;
            this.engine          = project.ParentEngine;
            this.importedProject = importedProject;

            this.onErrorElements = new List <XmlElement> ();
            this.buildState      = BuildState.NotStarted;
            this.buildTasks      = new List <IBuildTask> ();
            this.batchingImpl    = new TargetBatchingImpl(project, this.targetElement);

            bool onErrorFound = false;

            foreach (XmlNode xn in targetElement.ChildNodes)
            {
                if (xn is XmlElement)
                {
                    XmlElement xe = (XmlElement)xn;
                    if (xe.Name == "OnError")
                    {
                        onErrorElements.Add(xe);
                        onErrorFound = true;
                    }
                    else if (onErrorFound)
                    {
                        throw new InvalidProjectFileException(
                                  "The element <OnError> must be last under element <Target>. Found element <Error> instead.");
                    }
#if NET_3_5
                    else if (xe.Name == "ItemGroup")
                    {
                        var group = new BuildTaskItemGroup(xe, this);
                        buildTasks.AddRange(group.Items);
                        continue;
                    }
                    else if (xe.Name == "PropertyGroup")
                    {
                        buildTasks.Add(new BuildTaskPropertyGroup(xe, this));
                        continue;
                    }
#endif
                    else
                    {
                        buildTasks.Add(new BuildTask(xe, this));
                    }
                }
            }
        }
Exemplo n.º 2
0
		internal Target (XmlElement targetElement, Project project, ImportedProject importedProject)
		{
			if (project == null)
				throw new ArgumentNullException ("project");
			if (targetElement == null)
				throw new ArgumentNullException ("targetElement");

			this.targetElement = targetElement;
			this.name = targetElement.GetAttribute ("Name");

			this.project = project;
			this.engine = project.ParentEngine;
			this.importedProject = importedProject;

			this.onErrorElements  = new List <XmlElement> ();
			this.buildState = BuildState.NotStarted;
			this.buildTasks = new List <IBuildTask> ();
			this.batchingImpl = new TargetBatchingImpl (project, this.targetElement);

			bool onErrorFound = false;
			foreach (XmlNode xn in targetElement.ChildNodes) {
				if (xn is XmlElement) {
					XmlElement xe = (XmlElement) xn;
					if (xe.Name == "OnError") {
						onErrorElements.Add (xe);
						onErrorFound = true;
					} else if (onErrorFound)
						throw new InvalidProjectFileException (
							"The element <OnError> must be last under element <Target>. Found element <Error> instead.");
#if NET_3_5
					else if (xe.Name == "ItemGroup") {
						var group = new BuildTaskItemGroup (xe, this);
						buildTasks.AddRange (group.Items);
						continue;
					} else if (xe.Name == "PropertyGroup") {
						buildTasks.Add (new BuildTaskPropertyGroup (xe, this));
						continue;
					}
#endif
					else
						buildTasks.Add (new BuildTask (xe, this));
				}
			}
		}
Exemplo n.º 3
0
 internal BuildTaskItem(Project project, XmlElement itemElement, BuildTaskItemGroup parentItemGroup)
     : base(itemElement, parentItemGroup)
 {
     this.parent  = parentItemGroup;
     this.project = project;
 }
Exemplo n.º 4
0
		internal BuildTaskItem (Project project, XmlElement itemElement, BuildTaskItemGroup parentItemGroup)
			: base (itemElement, parentItemGroup)
		{
			this.parent = parentItemGroup;
			this.project = project;
		}