Пример #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 <BuildTask> ();
			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.");
					else
						buildTasks.Add (new BuildTask (xe, this));
				}
			}
		}
Пример #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));
                    }
                }
            }
        }
Пример #3
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 <BuildTask> ();
            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")
                    {
                        //don't blow up for ItemGroups inside Targets in >= 3.5
                        // TODO: evaluate them (see https://bugzilla.xamarin.com/show_bug.cgi?id=1862 and test in TargetTest.cs )
                        continue;
                    }
#endif
                    else
                    {
                        buildTasks.Add(new BuildTask(xe, this));
                    }
                }
            }
        }
Пример #4
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 <BuildTask> ();
			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") {
						//don't blow up for ItemGroups inside Targets in >= 3.5
						// TODO: evaluate them (see https://bugzilla.xamarin.com/show_bug.cgi?id=1862 and test in TargetTest.cs )
						continue;
					}
#endif
					else
						buildTasks.Add (new BuildTask (xe, this));
				}
			}
		}