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 07:39:29 GMT
donaldp     01/05/29 00:39:29

  Modified:    proposal/myrmidon/src/java/org/apache/myrmidon/components/builder
                        DefaultProjectBuilder.java ProjectBuilder.java
  Added:       proposal/myrmidon/src/java/org/apache/myrmidon/components/model
                        DefaultProject.java DefaultTarget.java Project.java
                        Target.java
  Removed:     proposal/myrmidon/src/java/org/apache/myrmidon/model
                        DefaultProject.java DefaultTarget.java Project.java
                        Target.java
  Log:
  Model is not a user concern but a modder/embeddor concern.
  
  Revision  Changes    Path
  1.2       +4 -4      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/builder/DefaultProjectBuilder.java
  
  Index: DefaultProjectBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/builder/DefaultProjectBuilder.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultProjectBuilder.java	2001/05/29 07:13:13	1.1
  +++ DefaultProjectBuilder.java	2001/05/29 07:39:28	1.2
  @@ -18,10 +18,10 @@
   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.apache.myrmidon.components.model.DefaultProject;
  +import org.apache.myrmidon.components.model.DefaultTarget;
  +import org.apache.myrmidon.components.model.Project;
  +import org.apache.myrmidon.components.model.Target;
   import org.xml.sax.InputSource;
   import org.xml.sax.SAXException;
   
  
  
  
  1.2       +1 -1      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/builder/ProjectBuilder.java
  
  Index: ProjectBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/builder/ProjectBuilder.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ProjectBuilder.java	2001/05/29 07:13:13	1.1
  +++ ProjectBuilder.java	2001/05/29 07:39:28	1.2
  @@ -11,7 +11,7 @@
   import java.io.IOException;
   import org.apache.ant.AntException;
   import org.apache.avalon.framework.component.Component;
  -import org.apache.myrmidon.model.Project;
  +import org.apache.myrmidon.components.model.Project;
   
   /**
    * Interface implemented by components that build projects from sources.
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/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.components.model;
  
  import java.io.File;
  import java.io.IOException;
  import java.util.HashMap;
  import org.apache.ant.AntException;
  
  /**
   * 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/components/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.components.model;
  
  import java.util.ArrayList;
  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
  {
      private final ArrayList   m_dependencies     = new ArrayList();
      private final ArrayList   m_tasks            = new ArrayList();
      private 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 String[] getDependencies()
      {
          return (String[])m_dependencies.toArray( new String[ 0 ] );
      }
  
      /**
       * Get tasks in target
       *
       * @return the target list
       */
      public Configuration[] getTasks()
      {
          return (Configuration[])m_tasks.toArray( new Configuration[ 0 ] );
      }
  
      /**
       * 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 taskData )
      {
          m_tasks.add( taskData );
      }
  }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/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.components.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/components/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.components.model;
  
  import org.apache.ant.util.Condition;
  import org.apache.avalon.framework.component.Component;
  import org.apache.avalon.framework.configuration.Configuration;
  
  /**
   * 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
       */
      String[] getDependencies();
  
      /**
       * Get tasks in target
       *
       * @return the target list
       */
      Configuration[] getTasks();
  
      /**
       * Get condition under which target is executed.
       *
       * @return the condition for target or null
       */
      Condition getCondition();
  }
  
  
  
  
  

Mime
View raw message