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/proposal/myrmidon/src/java/org/apache/myrmidon/model DefaultProject.java DefaultTarget.java Project.java Target.java
Date Tue, 29 May 2001 06:17:05 GMT
donaldp     01/05/28 23:17:04

  Modified:    proposal/myrmidon/src/java/org/apache/ant Main.java
               proposal/myrmidon/src/java/org/apache/ant/modules/basic
                        AntCall.java
               proposal/myrmidon/src/java/org/apache/ant/project
                        DefaultProjectBuilder.java
                        DefaultProjectEngine.java ProjectBuilder.java
                        ProjectEngine.java
  Added:       proposal/myrmidon/src/java/org/apache/myrmidon/model
                        DefaultProject.java DefaultTarget.java Project.java
                        Target.java
  Removed:     proposal/myrmidon/src/java/org/apache/ant/project
                        DefaultProject.java DefaultTarget.java Project.java
                        Target.java
  Log:
  Created separate package to contain project model as per mutant.
  
  Revision  Changes    Path
  1.17      +1 -1      jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/Main.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Main.java	2001/05/29 06:00:46	1.16
  +++ Main.java	2001/05/29 06:16:56	1.17
  @@ -22,7 +22,7 @@
   import java.util.Map;
   import org.apache.myrmidon.launcher.LauncherClassLoader;
   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.ProjectEngine;
   import org.apache.ant.project.ProjectListener;
  
  
  
  1.5       +1 -1      jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/basic/AntCall.java
  
  Index: AntCall.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/modules/basic/AntCall.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AntCall.java	2001/05/28 09:06:46	1.4
  +++ AntCall.java	2001/05/29 06:16:57	1.5
  @@ -9,7 +9,7 @@
   
   import java.util.ArrayList;
   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.myrmidon.api.AbstractTask;
   import org.apache.myrmidon.api.DefaultTaskContext;
  
  
  
  1.7       +7 -2      jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/project/DefaultProjectBuilder.java
  
  Index: DefaultProjectBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/project/DefaultProjectBuilder.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DefaultProjectBuilder.java	2001/05/28 09:06:47	1.6
  +++ DefaultProjectBuilder.java	2001/05/29 06:16:59	1.7
  @@ -7,18 +7,23 @@
    */
   package org.apache.ant.project;
   
  +
   import java.io.File;
   import java.io.IOException;
   import java.util.Iterator;
   import org.apache.ant.AntException;
  -import org.apache.myrmidon.api.TaskContext;
   import org.apache.ant.util.Condition;
   import org.apache.avalon.framework.ExceptionUtil;
   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.DefaultConfigurationBuilder;
   import org.apache.avalon.framework.logger.AbstractLoggable;
   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.SAXException;
   
  
  
  
  1.12      +19 -17    jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/project/DefaultProjectEngine.java
  
  Index: DefaultProjectEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/project/DefaultProjectEngine.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- DefaultProjectEngine.java	2001/05/29 06:00:47	1.11
  +++ DefaultProjectEngine.java	2001/05/29 06:17:00	1.12
  @@ -10,9 +10,6 @@
   import java.util.ArrayList;
   import java.util.Iterator;
   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.avalon.framework.activity.Disposable;
   import org.apache.avalon.framework.activity.Initializable;
  @@ -24,6 +21,11 @@
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.logger.AbstractLoggable;
   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.
  @@ -34,9 +36,9 @@
       extends AbstractLoggable
       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.
  @@ -118,10 +120,10 @@
        * @param done the list of targets already executed in current run
        * @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
       {
           final Target target = project.getTarget( targetName );
  @@ -156,9 +158,9 @@
        * @param context the context in which to execute
        * @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
       {
           //is this necessary ? I think not but ....
  @@ -187,9 +189,9 @@
        * @param target the target
        * @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.
           //if it is not satisfied then skip target
  @@ -222,7 +224,7 @@
        * @param context the context
        * @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
       {
           final String name = task.getName();
  
  
  
  1.5       +1 -0      jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/project/ProjectBuilder.java
  
  Index: ProjectBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/project/ProjectBuilder.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ProjectBuilder.java	2001/05/28 10:27:55	1.4
  +++ ProjectBuilder.java	2001/05/29 06:17:01	1.5
  @@ -11,6 +11,7 @@
   import java.io.IOException;
   import org.apache.ant.AntException;
   import org.apache.avalon.framework.component.Component;
  +import org.apache.myrmidon.model.Project;
   
   /**
    * Interface implemented by components that build projects from sources.
  
  
  
  1.9       +1 -0      jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/project/ProjectEngine.java
  
  Index: ProjectEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/ant/project/ProjectEngine.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ProjectEngine.java	2001/05/29 06:00:48	1.8
  +++ ProjectEngine.java	2001/05/29 06:17:01	1.9
  @@ -10,6 +10,7 @@
   import org.apache.ant.AntException;
   import org.apache.myrmidon.api.TaskContext;
   import org.apache.avalon.framework.component.Component;
  +import org.apache.myrmidon.model.Project;
   
   /**
    * This is the interface between ProjectEngine and rest of the system.
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/model/DefaultProject.java
  
  Index: DefaultProject.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.myrmidon.model;
  
  import java.io.File;
  import java.io.IOException;
  import java.util.ArrayList;
  import java.util.HashMap;
  import java.util.Iterator;
  import org.apache.ant.AntException;
  import org.apache.myrmidon.api.DefaultTaskContext;
  import org.apache.myrmidon.api.TaskContext;
  
  /**
   * Default project implementation.
   *
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   */
  public class DefaultProject
      implements Project
  {
      ///The targets contained by this project
      private final HashMap   m_targets         = new HashMap();
  
      ///The implicit target (not present in m_targets)
      private Target          m_implicitTarget;
  
      ///The name of the default target
      private String          m_defaultTarget;
  
      ///The base directory of project
      private File            m_baseDirectory;
  
      /**
       * Retrieve base directory of project.
       *
       * @return the projects base directory
       */
      public final File getBaseDirectory()
      {
          return m_baseDirectory;
      }
  
      /**
       * Retrieve implicit target.
       * The implicit target contains all the top level tasks.
       *
       * @return the Target
       */
      public final Target getImplicitTarget()
      {
          return m_implicitTarget;
      }
  
      /**
       * Set ImplicitTarget.
       *
       * @param target the implicit target
       */
      public final void setImplicitTarget( final Target target )
      {
          m_implicitTarget = target;
      }
  
      /**
       * Retrieve a target by name.
       *
       * @param name the name of target
       * @return the Target or null if no target exists with name
       */
      public final Target getTarget( final String targetName )
      {
          return (Target)m_targets.get( targetName );
      }
  
      /**
       * Get name of default target.
       *
       * @return the default target name
       */
      public final String getDefaultTargetName()
      {
          return m_defaultTarget;
      }
  
      /**
       * Retrieve names of all targets in project.
       *
       * @return an array target names
       */
      public final String[] getTargetNames()
      {
          return (String[])m_targets.keySet().toArray( new String[ 0 ] );
      }
  
      /**
       * Set DefaultTargetName.
       *
       * @param defaultTarget the default target name
       */
      public final void setDefaultTargetName( final String defaultTarget )
      {
          m_defaultTarget = defaultTarget;
      }
  
      /**
       * Retrieve base directory of project.
       *
       * @return the projects base directory
       */
      public final void setBaseDirectory( final File baseDirectory )
      {
          m_baseDirectory = baseDirectory;
      }
  
      /**
       * Add a target to project.
       *
       * @param name the name of target
       * @param target the Target
       * @exception AntException if an error occurs
       */
      public final void addTarget( final String name, final Target target )
          throws AntException
      {
          if( null != m_targets.get( name ) )
          {
              throw new AntException( "Can not have two targets in a file with the name "
+
                                      name );
          }
          else
          {
              m_targets.put( name, target );
          }
      }
  }
  
  
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/model/DefaultTarget.java
  
  Index: DefaultTarget.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.myrmidon.model;
  
  import java.util.ArrayList;
  import java.util.Iterator;
  import org.apache.ant.util.Condition;
  import org.apache.avalon.framework.configuration.Configuration;
  
  /**
   * Default implementation of target.
   *
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   */
  public class DefaultTarget
      implements Target
  {
      protected final ArrayList   m_dependencies     = new ArrayList();
      protected final ArrayList   m_tasks            = new ArrayList();
      protected final Condition   m_condition;
  
      /**
       * Constructor taking condition for target.
       *
       * @param condition the condition
       */
      public DefaultTarget( final Condition condition )
      {
          m_condition = condition;
      }
  
      /**
       * Constructor for target with no condition.
       */
      public DefaultTarget()
      {
          this( null );
      }
  
      /**
       * Get condition under which target is executed.
       *
       * @return the condition for target or null
       */
      public Condition getCondition()
      {
          return m_condition;
      }
      /**
       * Get dependencies of target
       *
       * @return the dependency list
       */
      public Iterator getDependencies()
      {
          return m_dependencies.iterator();
      }
  
      /**
       * Get tasks in target
       *
       * @return the target list
       */
      public Iterator getTasks()
      {
          return m_tasks.iterator();
      }
  
      /**
       * Add a dependency to target.
       *
       * @param dependency the dependency
       */
      public void addDependency( final String dependency )
      {
          m_dependencies.add( dependency );
      }
  
      /**
       * Add task to target.
       *
       * @param taskConfiguration the task representation
       */
      public void addTask( final Configuration taskConfiguration )
      {
          m_tasks.add( taskConfiguration );
      }
  }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/model/Project.java
  
  Index: Project.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.myrmidon.model;
  
  import java.io.File;
  import org.apache.avalon.framework.component.Component;
  
  /**
   * Abstraction used to interact with projects.
   * 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>
   */
  public interface Project
      extends Component
  {
      // the name of currently executing project
      String PROJECT          = "ant.project.name";
  
      // the name of currently executing project
      String PROJECT_FILE     = "ant.project.file";
  
      // the name of currently executing target
      String TARGET           = "ant.target.name";
  
      /**
       * Get name of default target.
       *
       * @return the default target name
       */
      String getDefaultTargetName();
  
      /**
       * Retrieve implicit target.
       * The implicit target is top level tasks.
       * Currently restricted to property tasks.
       *
       * @return the Target
       */
      Target getImplicitTarget();
  
      /**
       * Retrieve a target by name.
       *
       * @param name the name of target
       * @return the Target or null if no target exists with name
       */
      Target getTarget( String name );
  
      /**
       * Retrieve names of all targets in project.
       *
       * @return the iterator of project names
       */
      String[] getTargetNames();
  
      /**
       * Retrieve base directory of project.
       *
       * @return the projects base directory
       */
      File getBaseDirectory();
  }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/model/Target.java
  
  Index: Target.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.myrmidon.model;
  
  import java.util.Iterator;
  import org.apache.ant.util.Condition;
  import org.apache.avalon.framework.component.Component;
  
  /**
   * Interface to represent targets in build file.
   *
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   */
  public interface Target
      extends Component
  {
      /**
       * Get dependencies of target
       *
       * @return the dependency list
       */
      Iterator getDependencies();
  
      /**
       * Get tasks in target
       *
       * @return the target list
       */
      Iterator getTasks();
  
      /**
       * Get condition under which target is executed.
       *
       * @return the condition for target or null
       */
      Condition getCondition();
  }
  
  
  
  
  

Mime
View raw message