git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269057 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -22,7 +22,7 @@ import java.util.List; | |||||
| import java.util.Map; | import java.util.Map; | ||||
| import org.apache.myrmidon.launcher.LauncherClassLoader; | import org.apache.myrmidon.launcher.LauncherClassLoader; | ||||
| import org.apache.ant.project.LogTargetToListenerAdapter; | import org.apache.ant.project.LogTargetToListenerAdapter; | ||||
| import org.apache.ant.project.Project; | |||||
| import org.apache.myrmidon.model.Project; | |||||
| import org.apache.ant.project.ProjectBuilder; | import org.apache.ant.project.ProjectBuilder; | ||||
| import org.apache.ant.project.ProjectEngine; | import org.apache.ant.project.ProjectEngine; | ||||
| import org.apache.ant.project.ProjectListener; | import org.apache.ant.project.ProjectListener; | ||||
| @@ -9,7 +9,7 @@ package org.apache.ant.modules.basic; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import org.apache.ant.AntException; | import org.apache.ant.AntException; | ||||
| import org.apache.ant.project.Project; | |||||
| import org.apache.myrmidon.model.Project; | |||||
| import org.apache.ant.project.ProjectEngine; | import org.apache.ant.project.ProjectEngine; | ||||
| import org.apache.myrmidon.api.AbstractTask; | import org.apache.myrmidon.api.AbstractTask; | ||||
| import org.apache.myrmidon.api.DefaultTaskContext; | import org.apache.myrmidon.api.DefaultTaskContext; | ||||
| @@ -7,18 +7,23 @@ | |||||
| */ | */ | ||||
| package org.apache.ant.project; | package org.apache.ant.project; | ||||
| import java.io.File; | import java.io.File; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| import org.apache.ant.AntException; | import org.apache.ant.AntException; | ||||
| import org.apache.myrmidon.api.TaskContext; | |||||
| import org.apache.ant.util.Condition; | import org.apache.ant.util.Condition; | ||||
| import org.apache.avalon.framework.ExceptionUtil; | import org.apache.avalon.framework.ExceptionUtil; | ||||
| import org.apache.avalon.framework.configuration.Configuration; | import org.apache.avalon.framework.configuration.Configuration; | ||||
| import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder; | |||||
| import org.apache.avalon.framework.configuration.ConfigurationException; | import org.apache.avalon.framework.configuration.ConfigurationException; | ||||
| import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder; | |||||
| import org.apache.avalon.framework.logger.AbstractLoggable; | import org.apache.avalon.framework.logger.AbstractLoggable; | ||||
| import org.apache.log.Logger; | import org.apache.log.Logger; | ||||
| import org.apache.myrmidon.api.TaskContext; | |||||
| import org.apache.myrmidon.model.DefaultProject; | |||||
| import org.apache.myrmidon.model.DefaultTarget; | |||||
| import org.apache.myrmidon.model.Project; | |||||
| import org.apache.myrmidon.model.Target; | |||||
| import org.xml.sax.InputSource; | import org.xml.sax.InputSource; | ||||
| import org.xml.sax.SAXException; | import org.xml.sax.SAXException; | ||||
| @@ -10,9 +10,6 @@ package org.apache.ant.project; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| import org.apache.ant.AntException; | import org.apache.ant.AntException; | ||||
| import org.apache.myrmidon.api.DefaultTaskContext; | |||||
| import org.apache.myrmidon.api.TaskContext; | |||||
| import org.apache.myrmidon.components.executor.Executor; | |||||
| import org.apache.ant.util.Condition; | import org.apache.ant.util.Condition; | ||||
| import org.apache.avalon.framework.activity.Disposable; | import org.apache.avalon.framework.activity.Disposable; | ||||
| import org.apache.avalon.framework.activity.Initializable; | import org.apache.avalon.framework.activity.Initializable; | ||||
| @@ -24,6 +21,11 @@ import org.apache.avalon.framework.component.DefaultComponentManager; | |||||
| import org.apache.avalon.framework.configuration.Configuration; | import org.apache.avalon.framework.configuration.Configuration; | ||||
| import org.apache.avalon.framework.logger.AbstractLoggable; | import org.apache.avalon.framework.logger.AbstractLoggable; | ||||
| import org.apache.log.Logger; | import org.apache.log.Logger; | ||||
| import org.apache.myrmidon.api.DefaultTaskContext; | |||||
| import org.apache.myrmidon.api.TaskContext; | |||||
| import org.apache.myrmidon.components.executor.Executor; | |||||
| import org.apache.myrmidon.model.Project; | |||||
| import org.apache.myrmidon.model.Target; | |||||
| /** | /** | ||||
| * This is the default implementation of ProjectEngine. | * This is the default implementation of ProjectEngine. | ||||
| @@ -34,9 +36,9 @@ public class DefaultProjectEngine | |||||
| extends AbstractLoggable | extends AbstractLoggable | ||||
| implements ProjectEngine, Composable | implements ProjectEngine, Composable | ||||
| { | { | ||||
| protected Executor m_executor; | |||||
| protected ProjectListenerSupport m_listenerSupport = new ProjectListenerSupport(); | |||||
| protected DefaultComponentManager m_componentManager; | |||||
| private Executor m_executor; | |||||
| private ProjectListenerSupport m_listenerSupport = new ProjectListenerSupport(); | |||||
| private DefaultComponentManager m_componentManager; | |||||
| /** | /** | ||||
| * Add a listener to project events. | * Add a listener to project events. | ||||
| @@ -118,10 +120,10 @@ public class DefaultProjectEngine | |||||
| * @param done the list of targets already executed in current run | * @param done the list of targets already executed in current run | ||||
| * @exception AntException if an error occurs | * @exception AntException if an error occurs | ||||
| */ | */ | ||||
| protected void execute( final Project project, | |||||
| final String targetName, | |||||
| final TaskContext context, | |||||
| final ArrayList done ) | |||||
| private void execute( final Project project, | |||||
| final String targetName, | |||||
| final TaskContext context, | |||||
| final ArrayList done ) | |||||
| throws AntException | throws AntException | ||||
| { | { | ||||
| final Target target = project.getTarget( targetName ); | final Target target = project.getTarget( targetName ); | ||||
| @@ -156,9 +158,9 @@ public class DefaultProjectEngine | |||||
| * @param context the context in which to execute | * @param context the context in which to execute | ||||
| * @exception AntException if an error occurs | * @exception AntException if an error occurs | ||||
| */ | */ | ||||
| protected void executeTarget( final String targetName, | |||||
| final Target target, | |||||
| final TaskContext context ) | |||||
| private void executeTarget( final String targetName, | |||||
| final Target target, | |||||
| final TaskContext context ) | |||||
| throws AntException | throws AntException | ||||
| { | { | ||||
| //is this necessary ? I think not but .... | //is this necessary ? I think not but .... | ||||
| @@ -187,9 +189,9 @@ public class DefaultProjectEngine | |||||
| * @param target the target | * @param target the target | ||||
| * @param context the context | * @param context the context | ||||
| */ | */ | ||||
| protected void executeTargetWork( final String name, | |||||
| final Target target, | |||||
| final TaskContext context ) | |||||
| private void executeTargetWork( final String name, | |||||
| final Target target, | |||||
| final TaskContext context ) | |||||
| { | { | ||||
| //check the condition associated with target. | //check the condition associated with target. | ||||
| //if it is not satisfied then skip target | //if it is not satisfied then skip target | ||||
| @@ -222,7 +224,7 @@ public class DefaultProjectEngine | |||||
| * @param context the context | * @param context the context | ||||
| * @exception AntException if an error occurs | * @exception AntException if an error occurs | ||||
| */ | */ | ||||
| protected void executeTask( final Configuration task, final TaskContext context ) | |||||
| private void executeTask( final Configuration task, final TaskContext context ) | |||||
| throws AntException | throws AntException | ||||
| { | { | ||||
| final String name = task.getName(); | final String name = task.getName(); | ||||
| @@ -11,6 +11,7 @@ import java.io.File; | |||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import org.apache.ant.AntException; | import org.apache.ant.AntException; | ||||
| import org.apache.avalon.framework.component.Component; | import org.apache.avalon.framework.component.Component; | ||||
| import org.apache.myrmidon.model.Project; | |||||
| /** | /** | ||||
| * Interface implemented by components that build projects from sources. | * Interface implemented by components that build projects from sources. | ||||
| @@ -10,6 +10,7 @@ package org.apache.ant.project; | |||||
| import org.apache.ant.AntException; | import org.apache.ant.AntException; | ||||
| import org.apache.myrmidon.api.TaskContext; | import org.apache.myrmidon.api.TaskContext; | ||||
| import org.apache.avalon.framework.component.Component; | import org.apache.avalon.framework.component.Component; | ||||
| import org.apache.myrmidon.model.Project; | |||||
| /** | /** | ||||
| * This is the interface between ProjectEngine and rest of the system. | * This is the interface between ProjectEngine and rest of the system. | ||||
| @@ -5,7 +5,7 @@ | |||||
| * version 1.1, a copy of which has been included with this distribution in | * version 1.1, a copy of which has been included with this distribution in | ||||
| * the LICENSE file. | * the LICENSE file. | ||||
| */ | */ | ||||
| package org.apache.ant.project; | |||||
| package org.apache.myrmidon.model; | |||||
| import java.io.File; | import java.io.File; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| @@ -45,10 +45,10 @@ public class DefaultProject | |||||
| { | { | ||||
| return m_baseDirectory; | return m_baseDirectory; | ||||
| } | } | ||||
| /** | /** | ||||
| * Retrieve implicit target. | |||||
| * The implicit target contains all the top level tasks. | |||||
| * Retrieve implicit target. | |||||
| * The implicit target contains all the top level tasks. | |||||
| * | * | ||||
| * @return the Target | * @return the Target | ||||
| */ | */ | ||||
| @@ -66,7 +66,7 @@ public class DefaultProject | |||||
| { | { | ||||
| m_implicitTarget = target; | m_implicitTarget = target; | ||||
| } | } | ||||
| /** | /** | ||||
| * Retrieve a target by name. | * Retrieve a target by name. | ||||
| * | * | ||||
| @@ -77,7 +77,7 @@ public class DefaultProject | |||||
| { | { | ||||
| return (Target)m_targets.get( targetName ); | return (Target)m_targets.get( targetName ); | ||||
| } | } | ||||
| /** | /** | ||||
| * Get name of default target. | * Get name of default target. | ||||
| * | * | ||||
| @@ -87,7 +87,7 @@ public class DefaultProject | |||||
| { | { | ||||
| return m_defaultTarget; | return m_defaultTarget; | ||||
| } | } | ||||
| /** | /** | ||||
| * Retrieve names of all targets in project. | * Retrieve names of all targets in project. | ||||
| * | * | ||||
| @@ -5,7 +5,7 @@ | |||||
| * version 1.1, a copy of which has been included with this distribution in | * version 1.1, a copy of which has been included with this distribution in | ||||
| * the LICENSE file. | * the LICENSE file. | ||||
| */ | */ | ||||
| package org.apache.ant.project; | |||||
| package org.apache.myrmidon.model; | |||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| @@ -5,7 +5,7 @@ | |||||
| * version 1.1, a copy of which has been included with this distribution in | * version 1.1, a copy of which has been included with this distribution in | ||||
| * the LICENSE file. | * the LICENSE file. | ||||
| */ | */ | ||||
| package org.apache.ant.project; | |||||
| package org.apache.myrmidon.model; | |||||
| import java.io.File; | import java.io.File; | ||||
| import org.apache.avalon.framework.component.Component; | import org.apache.avalon.framework.component.Component; | ||||
| @@ -14,19 +14,22 @@ import org.apache.avalon.framework.component.Component; | |||||
| * Abstraction used to interact with projects. | * Abstraction used to interact with projects. | ||||
| * Implementations may choose to structure it anyway they choose. | * Implementations may choose to structure it anyway they choose. | ||||
| * | * | ||||
| * TODO: Determine if projects should carry their own name. Breaks IOC but | |||||
| * Can be useful as project files embed own name (or should that be description). | |||||
| * | |||||
| * @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | * @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | ||||
| */ | */ | ||||
| public interface Project | public interface Project | ||||
| extends Component | extends Component | ||||
| { | { | ||||
| // the name of currently executing project | // the name of currently executing project | ||||
| String PROJECT = "ant.project.name"; | |||||
| String PROJECT = "ant.project.name"; | |||||
| // the name of currently executing project | // the name of currently executing project | ||||
| String PROJECT_FILE = "ant.project.file"; | |||||
| String PROJECT_FILE = "ant.project.file"; | |||||
| // the name of currently executing target | // the name of currently executing target | ||||
| String TARGET = "ant.target.name"; | |||||
| String TARGET = "ant.target.name"; | |||||
| /** | /** | ||||
| * Get name of default target. | * Get name of default target. | ||||
| @@ -36,8 +39,8 @@ public interface Project | |||||
| String getDefaultTargetName(); | String getDefaultTargetName(); | ||||
| /** | /** | ||||
| * Retrieve implicit target. | |||||
| * The implicit target is top level tasks. | |||||
| * Retrieve implicit target. | |||||
| * The implicit target is top level tasks. | |||||
| * Currently restricted to property tasks. | * Currently restricted to property tasks. | ||||
| * | * | ||||
| * @return the Target | * @return the Target | ||||
| @@ -5,7 +5,7 @@ | |||||
| * version 1.1, a copy of which has been included with this distribution in | * version 1.1, a copy of which has been included with this distribution in | ||||
| * the LICENSE file. | * the LICENSE file. | ||||
| */ | */ | ||||
| package org.apache.ant.project; | |||||
| package org.apache.myrmidon.model; | |||||
| import java.util.Iterator; | import java.util.Iterator; | ||||
| import org.apache.ant.util.Condition; | import org.apache.ant.util.Condition; | ||||