git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269060 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -311,6 +311,7 @@ public class Main | |||||
| setupLogger( embeddor ); | setupLogger( embeddor ); | ||||
| embeddor.parameterize( parameters ); | embeddor.parameterize( parameters ); | ||||
| embeddor.initialize(); | embeddor.initialize(); | ||||
| embeddor.start(); | |||||
| final ProjectBuilder builder = embeddor.getProjectBuilder(); | final ProjectBuilder builder = embeddor.getProjectBuilder(); | ||||
| @@ -350,6 +351,7 @@ public class Main | |||||
| } | } | ||||
| embeddor.stop(); | |||||
| embeddor.dispose(); | embeddor.dispose(); | ||||
| } | } | ||||
| @@ -138,13 +138,12 @@ public class DefaultProjectEngine | |||||
| done.add( targetName ); | done.add( targetName ); | ||||
| //execute all dependencies | //execute all dependencies | ||||
| final Iterator dependencies = target.getDependencies(); | |||||
| while( dependencies.hasNext() ) | |||||
| final String[] dependencies = target.getDependencies(); | |||||
| for( int i = 0; i < dependencies.length; i++ ) | |||||
| { | { | ||||
| final String dependency = (String)dependencies.next(); | |||||
| if( !done.contains( dependency ) ) | |||||
| if( !done.contains( dependencies[ i ] ) ) | |||||
| { | { | ||||
| execute( project, dependency, context, done ); | |||||
| execute( project, dependencies[ i ], context, done ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -210,11 +209,10 @@ public class DefaultProjectEngine | |||||
| getLogger().debug( "Executing target " + name ); | getLogger().debug( "Executing target " + name ); | ||||
| //execute all tasks assciated with target | //execute all tasks assciated with target | ||||
| final Iterator tasks = target.getTasks(); | |||||
| while( tasks.hasNext() ) | |||||
| final Configuration[] tasks = target.getTasks(); | |||||
| for( int i = 0; i < tasks.length; i++ ) | |||||
| { | { | ||||
| final Configuration task = (Configuration)tasks.next(); | |||||
| executeTask( task, context ); | |||||
| executeTask( tasks[ i ], context ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -10,6 +10,7 @@ package org.apache.myrmidon.components.embeddor; | |||||
| import org.apache.ant.project.ProjectEngine; | import org.apache.ant.project.ProjectEngine; | ||||
| 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; | ||||
| import org.apache.avalon.framework.activity.Startable; | |||||
| import org.apache.avalon.framework.component.Component; | import org.apache.avalon.framework.component.Component; | ||||
| import org.apache.avalon.framework.parameters.Parameterizable; | import org.apache.avalon.framework.parameters.Parameterizable; | ||||
| import org.apache.myrmidon.components.builder.ProjectBuilder; | import org.apache.myrmidon.components.builder.ProjectBuilder; | ||||
| @@ -20,7 +21,7 @@ import org.apache.myrmidon.components.builder.ProjectBuilder; | |||||
| * @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | * @author <a href="mailto:donaldp@apache.org">Peter Donald</a> | ||||
| */ | */ | ||||
| public interface Embeddor | public interface Embeddor | ||||
| extends Component, Parameterizable, Initializable, Disposable | |||||
| extends Component, Parameterizable, Initializable, Startable, Disposable | |||||
| { | { | ||||
| /** | /** | ||||
| * Retrieve builder for runtime. | * Retrieve builder for runtime. | ||||
| @@ -113,10 +113,19 @@ public class MyrmidonEmbeddor | |||||
| setupComponents(); | setupComponents(); | ||||
| setupFiles(); | setupFiles(); | ||||
| } | |||||
| public void start() | |||||
| throws Exception | |||||
| { | |||||
| CamelotUtil.deployFromDirectory( m_deployer, m_taskLibDir, ".tsk" ); | CamelotUtil.deployFromDirectory( m_deployer, m_taskLibDir, ".tsk" ); | ||||
| } | } | ||||
| public void stop() | |||||
| { | |||||
| //Undeploy all the tasks by killing ExecutionFrame??? | |||||
| } | |||||
| /** | /** | ||||
| * Dispose engine. | * Dispose engine. | ||||
| * | * | ||||
| @@ -9,12 +9,8 @@ package org.apache.myrmidon.model; | |||||
| import java.io.File; | import java.io.File; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.util.ArrayList; | |||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| 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; | |||||
| /** | /** | ||||
| * Default project implementation. | * Default project implementation. | ||||
| @@ -8,7 +8,6 @@ | |||||
| package org.apache.myrmidon.model; | package org.apache.myrmidon.model; | ||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import java.util.Iterator; | |||||
| import org.apache.ant.util.Condition; | import org.apache.ant.util.Condition; | ||||
| import org.apache.avalon.framework.configuration.Configuration; | import org.apache.avalon.framework.configuration.Configuration; | ||||
| @@ -20,9 +19,9 @@ import org.apache.avalon.framework.configuration.Configuration; | |||||
| public class DefaultTarget | public class DefaultTarget | ||||
| implements Target | implements Target | ||||
| { | { | ||||
| protected final ArrayList m_dependencies = new ArrayList(); | |||||
| protected final ArrayList m_tasks = new ArrayList(); | |||||
| protected final Condition m_condition; | |||||
| private final ArrayList m_dependencies = new ArrayList(); | |||||
| private final ArrayList m_tasks = new ArrayList(); | |||||
| private final Condition m_condition; | |||||
| /** | /** | ||||
| * Constructor taking condition for target. | * Constructor taking condition for target. | ||||
| @@ -56,9 +55,9 @@ public class DefaultTarget | |||||
| * | * | ||||
| * @return the dependency list | * @return the dependency list | ||||
| */ | */ | ||||
| public Iterator getDependencies() | |||||
| public String[] getDependencies() | |||||
| { | { | ||||
| return m_dependencies.iterator(); | |||||
| return (String[])m_dependencies.toArray( new String[ 0 ] ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -66,9 +65,9 @@ public class DefaultTarget | |||||
| * | * | ||||
| * @return the target list | * @return the target list | ||||
| */ | */ | ||||
| public Iterator getTasks() | |||||
| public Configuration[] getTasks() | |||||
| { | { | ||||
| return m_tasks.iterator(); | |||||
| return (Configuration[])m_tasks.toArray( new Configuration[ 0 ] ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -86,8 +85,8 @@ public class DefaultTarget | |||||
| * | * | ||||
| * @param taskConfiguration the task representation | * @param taskConfiguration the task representation | ||||
| */ | */ | ||||
| public void addTask( final Configuration taskConfiguration ) | |||||
| public void addTask( final Configuration taskData ) | |||||
| { | { | ||||
| m_tasks.add( taskConfiguration ); | |||||
| m_tasks.add( taskData ); | |||||
| } | } | ||||
| } | } | ||||
| @@ -7,9 +7,9 @@ | |||||
| */ | */ | ||||
| package org.apache.myrmidon.model; | package org.apache.myrmidon.model; | ||||
| import java.util.Iterator; | |||||
| import org.apache.ant.util.Condition; | import org.apache.ant.util.Condition; | ||||
| import org.apache.avalon.framework.component.Component; | import org.apache.avalon.framework.component.Component; | ||||
| import org.apache.avalon.framework.configuration.Configuration; | |||||
| /** | /** | ||||
| * Interface to represent targets in build file. | * Interface to represent targets in build file. | ||||
| @@ -24,14 +24,14 @@ public interface Target | |||||
| * | * | ||||
| * @return the dependency list | * @return the dependency list | ||||
| */ | */ | ||||
| Iterator getDependencies(); | |||||
| String[] getDependencies(); | |||||
| /** | /** | ||||
| * Get tasks in target | * Get tasks in target | ||||
| * | * | ||||
| * @return the target list | * @return the target list | ||||
| */ | */ | ||||
| Iterator getTasks(); | |||||
| Configuration[] getTasks(); | |||||
| /** | /** | ||||
| * Get condition under which target is executed. | * Get condition under which target is executed. | ||||