ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/embeddor DefaultEmbeddor.java
Date Tue, 21 May 2002 06:52:28 GMT
donaldp     02/05/20 23:52:28

  Modified:    container/src/java/org/apache/myrmidon/interfaces/oldmodel
                        Project.java
               container/src/java/org/apache/myrmidon/interfaces
                        EmbeddedAnt.java
               container/src/java/org/apache/myrmidon/components/builder
                        DefaultProject.java
               container/src/java/org/apache/myrmidon/components/embeddor
                        DefaultEmbeddor.java
  Log:
  Put in an ugly hack so that we can start "faking" that Project is the one responsible for
the building. This is a stepping stone for moving towards the Module interface.
  
  Revision  Changes    Path
  1.7       +7 -1      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/oldmodel/Project.java
  
  Index: Project.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/oldmodel/Project.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Project.java	21 May 2002 05:13:10 -0000	1.6
  +++ Project.java	21 May 2002 06:52:27 -0000	1.7
  @@ -9,13 +9,14 @@
   
   import java.io.File;
   import org.apache.myrmidon.interfaces.model.Module;
  +import org.apache.myrmidon.interfaces.workspace.Workspace;
   
   /**
    * Abstraction used to interact with projects.
    * Implementations may choose to structure it anyway they choose.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.6 $ $Date: 2002/05/21 05:13:10 $
  + * @version $Revision: 1.7 $ $Date: 2002/05/21 06:52:27 $
    */
   public interface Project
       extends Module
  @@ -88,4 +89,9 @@
        * @return the projects base directory
        */
       File getBaseDirectory();
  +
  +    /**
  +     * UGLY HACK!!!! Remove in future.
  +     */
  +    void setWorkspace( Workspace workspace );
   }
  
  
  
  1.11      +18 -10    jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/EmbeddedAnt.java
  
  Index: EmbeddedAnt.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/EmbeddedAnt.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- EmbeddedAnt.java	21 May 2002 05:57:14 -0000	1.10
  +++ EmbeddedAnt.java	21 May 2002 06:52:28 -0000	1.11
  @@ -17,19 +17,20 @@
   import org.apache.avalon.excalibur.io.FileUtil;
   import org.apache.avalon.framework.activity.Initializable;
   import org.apache.avalon.framework.activity.Startable;
  +import org.apache.avalon.framework.container.ContainerUtil;
   import org.apache.avalon.framework.context.Context;
   import org.apache.avalon.framework.context.Contextualizable;
   import org.apache.avalon.framework.context.DefaultContext;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.framework.parameters.Parameters;
  -import org.apache.avalon.framework.container.ContainerUtil;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.api.event.TaskListener;
   import org.apache.myrmidon.interfaces.embeddor.Embeddor;
  +import org.apache.myrmidon.interfaces.event.TaskEventManager;
  +import org.apache.myrmidon.interfaces.executor.ExecutionFrame;
  +import org.apache.myrmidon.interfaces.model.TargetMetaData;
   import org.apache.myrmidon.interfaces.oldmodel.Project;
   import org.apache.myrmidon.interfaces.workspace.Workspace;
  -import org.apache.myrmidon.interfaces.executor.ExecutionFrame;
  -import org.apache.myrmidon.interfaces.event.TaskEventManager;
   
   /**
    * A utility class, that takes care of launching Myrmidon, and building and
  @@ -42,7 +43,7 @@
    *
    * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.10 $ $Date: 2002/05/21 05:57:14 $
  + * @version $Revision: 1.11 $ $Date: 2002/05/21 06:52:28 $
    */
   public class EmbeddedAnt
       extends AbstractLogEnabled
  @@ -196,6 +197,7 @@
   
           // Create a new workspace
           final Workspace workspace = embeddor.createWorkspace();
  +        project.setWorkspace( workspace );
   
           //execute the project
           executeTargets( workspace, frame, project, targets );
  @@ -230,18 +232,21 @@
                                    final String[] targets )
           throws TaskException
       {
  -        //project.execute(frame,);
  +        //HACK: What a huge one!!!
  +        project.setWorkspace( workspace );
   
           //if we didn't specify a target, then choose default
           if( targets == null || targets.length == 0 )
           {
  -            workspace.executeProject( project, frame, project.getDefaultTargetName() );
  +            final TargetMetaData target = project.getTarget( project.getDefaultTargetName()
);
  +            project.execute( frame, target );
           }
           else
           {
               for( int i = 0; i < targets.length; i++ )
               {
  -                workspace.executeProject( project, frame, targets[ i ] );
  +                final TargetMetaData target = project.getTarget( targets[ i ] );
  +                project.execute( frame, target );
               }
           }
       }
  @@ -321,7 +326,6 @@
           return (Embeddor)clazz.newInstance();
       }
   
  -
       /**
        * Prepares and returns the project listener to use.
        */
  @@ -346,12 +350,16 @@
       /**
        * Prepares and returns the project model.
        */
  -    private Project prepareProjectModel( final Embeddor embeddor ) throws Exception
  +    private Project prepareProjectModel( final Embeddor embeddor )
  +        throws Exception
       {
           if( m_project == null )
           {
               final File buildFile = getProjectFile();
  -            m_project = embeddor.createProject( buildFile.toString(), m_projectType, m_builderProps
);
  +            m_project =
  +                embeddor.createProject( buildFile.toString(),
  +                                        m_projectType,
  +                                        m_builderProps );
           }
           return m_project;
       }
  
  
  
  1.11      +9 -2      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/builder/DefaultProject.java
  
  Index: DefaultProject.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/builder/DefaultProject.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DefaultProject.java	21 May 2002 05:13:10 -0000	1.10
  +++ DefaultProject.java	21 May 2002 06:52:28 -0000	1.11
  @@ -17,12 +17,13 @@
   import org.apache.myrmidon.interfaces.model.TargetMetaData;
   import org.apache.myrmidon.interfaces.oldmodel.Project;
   import org.apache.myrmidon.interfaces.oldmodel.Target;
  +import org.apache.myrmidon.interfaces.workspace.Workspace;
   
   /**
    * Default project implementation.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.10 $ $Date: 2002/05/21 05:13:10 $
  + * @version $Revision: 1.11 $ $Date: 2002/05/21 06:52:28 $
    */
   public class DefaultProject
       implements Project, TargetMetaData
  @@ -52,6 +53,7 @@
        * The URI of this project file.
        */
       private String m_uri;
  +    private Workspace m_workspace;
   
       public DefaultProject( final String name,
                              final String uri,
  @@ -249,6 +251,11 @@
                            TargetMetaData target )
           throws TaskException
       {
  -        //DO nothing ... for now
  +        m_workspace.executeProject( this, frame, target.getName() );
  +    }
  +
  +    public void setWorkspace( final Workspace workspace )
  +    {
  +        m_workspace = workspace;
       }
   }
  
  
  
  1.73      +4 -4      jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/embeddor/DefaultEmbeddor.java
  
  Index: DefaultEmbeddor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/embeddor/DefaultEmbeddor.java,v
  retrieving revision 1.72
  retrieving revision 1.73
  diff -u -r1.72 -r1.73
  --- DefaultEmbeddor.java	21 May 2002 05:57:14 -0000	1.72
  +++ DefaultEmbeddor.java	21 May 2002 06:52:28 -0000	1.73
  @@ -62,7 +62,7 @@
    * Instantiate this to embed inside other applications.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.72 $ $Date: 2002/05/21 05:57:14 $
  + * @version $Revision: 1.73 $ $Date: 2002/05/21 06:52:28 $
    */
   public class DefaultEmbeddor
       extends AbstractLogEnabled
  @@ -200,9 +200,9 @@
           m_libraryManager = (LibraryManager)m_serviceManager.lookup( LibraryManager.ROLE
);
   
           // setup a service manager that creates the project services
  -        final ServiceManager projServiceManager
  -            = (ServiceManager)createService( ServiceManager.class,
  -                                             PREFIX + "service.InstantiatingServiceManager"
);
  +        final ServiceManager projServiceManager =
  +            (ServiceManager)createService( ServiceManager.class,
  +                                           PREFIX + "service.InstantiatingServiceManager"
);
           setupObject( projServiceManager, m_serviceManager, null );
           m_components.add( projServiceManager );
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message