ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From darr...@apache.org
Subject cvs commit: jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/project AbstractTargetTask.java AbstractWorkspaceTask.java Dependency.java Resources.properties
Date Tue, 11 Jun 2002 13:20:15 GMT
darrell     2002/06/11 06:20:15

  Modified:    ant1compat project.xml
               ant1compat/src/java/org/apache/tools/ant
                        Ant1CompatTargetTask.java
               antlib/src/java/org/apache/antlib/project DependsTask.java
                        Resources.properties TargetTask.java
               framework/src/java/org/apache/myrmidon/framework
                        SimpleTargetTask.java
  Added:       framework/src/java/org/apache/myrmidon/framework/project
                        AbstractTargetTask.java AbstractWorkspaceTask.java
                        Dependency.java Resources.properties
  Removed:     antlib/src/java/org/apache/antlib/project
                        AbstractWorkspaceTask.java Dependency.java
  Log:
  * Factored out core functionality of <target> task into AbstractTargetTask,
    which is extended by TargetTask, SimpleTargetTask and Ant1CompatTargetTask.
  
  * Moved AbstractWorkspaceTask and AbstractTargetTask out of antlib.project,
    and into new package o.a.m.framework.project.
  
  Revision  Changes    Path
  1.12      +0 -1      jakarta-ant-myrmidon/ant1compat/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/ant1compat/project.xml,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- project.xml	11 Jun 2002 05:30:47 -0000	1.11
  +++ project.xml	11 Jun 2002 13:20:14 -0000	1.12
  @@ -9,7 +9,6 @@
       <classpath>
           <fileset dir="../api/build/lib" includes="*.jar"/>
           <fileset dir="../aut/build/lib" includes="*.jar"/>
  -        <fileset dir="../antlib/build/lib" includes="*.jar"/>
           <fileset dir="../framework/build/lib" includes="*.jar"/>
           <fileset dir="../lib" includes="*.jar"/>
       </classpath>
  
  
  
  1.2       +61 -11    jakarta-ant-myrmidon/ant1compat/src/java/org/apache/tools/ant/Ant1CompatTargetTask.java
  
  Index: Ant1CompatTargetTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/ant1compat/src/java/org/apache/tools/ant/Ant1CompatTargetTask.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Ant1CompatTargetTask.java	11 Jun 2002 05:31:33 -0000	1.1
  +++ Ant1CompatTargetTask.java	11 Jun 2002 13:20:14 -0000	1.2
  @@ -7,8 +7,9 @@
    */
   package org.apache.tools.ant;
   
  -import org.apache.antlib.project.TargetTask;
  +import org.apache.myrmidon.framework.project.AbstractTargetTask;
   import org.apache.myrmidon.api.TaskException;
  +import org.apache.myrmidon.api.metadata.ModelElement;
   
   /**
    * An Ant1 compatible version of &gt;target/&lt;, which allows
  @@ -21,50 +22,99 @@
    *       so we can remove dependency between Ant1Compat and Project antlib.
    */
   public class Ant1CompatTargetTask
  -    extends TargetTask
  +    extends AbstractTargetTask
   {
       private String m_ifCondition;
       private String m_unlessCondition;
   
  +    /**
  +     * Specify the name of target.
  +     *
  +     * @param name the name of the target
  +     * @see #m_name
  +     */
  +    public void setName( final String name )
  +    {
  +        m_name = name;
  +    }
  +
  +    /**
  +     * Specify the list of dependencies for target.
  +     *
  +     * @param depends the list of dependencies for target
  +     * @see #m_dependencies
  +     */
  +    public void setDepends( final String depends )
  +        throws TaskException
  +    {
  +        buildDependsList( depends );
  +    }
  +
  +    /**
  +     * Sets the description of the target.
  +     */
  +    public void setDescription( final String desc )
  +    {
  +        // Ignore
  +    }
  +
  +    /**
  +     * Add a task to the target.
  +     *
  +     * @param task a model representing a task
  +     * @see #m_tasks
  +     */
  +    public void add( final ModelElement task )
  +    {
  +        m_tasks.add( task );
  +    }
  +
  +    /**
  +     * Add an if condition
  +     * @param ifCondition the name of a property which must be set
  +     *                    in order for the target to be executed.
  +     */
       public void setIf( String ifCondition )
       {
           m_ifCondition = ifCondition;
       }
   
  +    /**
  +     * Add an unless condition
  +     * @param unlessCondition the name of a property which must *not* be set
  +     *                        in order for the target to be executed.
  +     */
       public void setUnless( String unlessCondition )
       {
           m_unlessCondition = unlessCondition;
       }
   
   
  +    /**
  +     * Checks that the "if" property has been set, and that the "unless"
  +     * property has not been set before executing the contained tasks.
  +     * @throws TaskException
  +     */
       protected void executeContainedTasks()
               throws TaskException
       {
  -        getContext().debug( "Using custom target task." );
           if ( m_ifCondition != null )
           {
  -            getContext().debug( "Found if." );
               Object propVal = getContext().getProperty( m_ifCondition );
               if ( propVal == null )
               {
  -                getContext().debug( "If prop not set" );
                   return;
               }
  -            getContext().debug( "If prop set." );
           }
   
           if ( m_unlessCondition != null )
           {
  -            getContext().debug( "Found unless." );
               Object propVal = getContext().getProperty( m_unlessCondition );
               if ( propVal != null )
               {
  -                getContext().debug( "Unless prop set." );
                   return;
               }
  -            getContext().debug( "Unless prop not set." );
           }
  -        getContext().debug( "Executing tasks." );
           super.executeContainedTasks();
       }
   
  
  
  
  1.2       +3 -1      jakarta-ant-myrmidon/antlib/src/java/org/apache/antlib/project/DependsTask.java
  
  Index: DependsTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/antlib/src/java/org/apache/antlib/project/DependsTask.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DependsTask.java	24 May 2002 06:23:42 -0000	1.1
  +++ DependsTask.java	11 Jun 2002 13:20:15 -0000	1.2
  @@ -10,6 +10,8 @@
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.myrmidon.api.TaskException;
  +import org.apache.myrmidon.framework.project.Dependency;
  +import org.apache.myrmidon.framework.project.AbstractWorkspaceTask;
   
   /**
    * A simple task to task to execute a group of tasks.
  
  
  
  1.12      +0 -8      jakarta-ant-myrmidon/antlib/src/java/org/apache/antlib/project/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/antlib/src/java/org/apache/antlib/project/Resources.properties,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Resources.properties	9 Jun 2002 04:53:34 -0000	1.11
  +++ Resources.properties	11 Jun 2002 13:20:15 -0000	1.12
  @@ -1,12 +1,4 @@
  -target.no-name.error=Target does not specify the name attribute.
  -target.exec.notice=Executing target: "{0}".
  -target.task-exec.notice=Executing task: "{0}".
   target.bad-name.error=Target "{0}" has a invalid name.
  -target.depends.notice=Dependencies for target "{0}": {1}
  -target.bad-dependency.error=Discovered empty dependency in target "{0}" at {1}.
  -
  -workspace.exec-depends.notice=Executing dependency: {0}
  -workspace.missing-ref.error=Unable to locate Project Reference "{0}" for dependency "{1}".
   
   depends.no-target.error=No target specified in <depends/> task.
   
  
  
  
  1.14      +6 -166    jakarta-ant-myrmidon/antlib/src/java/org/apache/antlib/project/TargetTask.java
  
  Index: TargetTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/antlib/src/java/org/apache/antlib/project/TargetTask.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- TargetTask.java	11 Jun 2002 05:30:47 -0000	1.13
  +++ TargetTask.java	11 Jun 2002 13:20:15 -0000	1.14
  @@ -7,14 +7,13 @@
    */
   package org.apache.antlib.project;
   
  -import java.util.ArrayList;
  -import java.util.StringTokenizer;
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.api.metadata.ModelElement;
   import org.apache.myrmidon.interfaces.property.NameValidator;
   import org.apache.myrmidon.interfaces.property.NameValidatorManager;
  +import org.apache.myrmidon.framework.project.AbstractTargetTask;
   
   /**
    * A simple task to task to execute a group of tasks.
  @@ -24,28 +23,12 @@
    * @ant.task name="target"
    */
   public class TargetTask
  -    extends AbstractWorkspaceTask
  +    extends AbstractTargetTask
   {
       private static final Resources REZ =
           ResourceManager.getPackageResources( TargetTask.class );
   
       /**
  -     * The array of ordered tasks which are contained
  -     * withing Target.
  -     */
  -    private final ArrayList m_tasks = new ArrayList();
  -
  -    /**
  -     * The name of the target.
  -     */
  -    private String m_name;
  -
  -    /**
  -     * The list of dependencies to execute before this target.
  -     */
  -    private Dependency[] m_dependencies;
  -
  -    /**
        * Specify the name of target.
        *
        * @param name the name of the target
  @@ -65,7 +48,7 @@
       public void setDepends( final String depends )
           throws TaskException
       {
  -        m_dependencies = buildDependsList( depends );
  +        buildDependsList( depends );
       }
   
       /**
  @@ -87,34 +70,15 @@
           m_tasks.add( task );
       }
   
  -    public void execute()
  -        throws TaskException
  -    {
  -        validate();
  -
  -        executeDependencies();
  -
  -        final String message =
  -            REZ.getString( "target.exec.notice", m_name );
  -        getContext().verbose( message );
  -
  -        executeContainedTasks();
  -    }
  -
       /**
        * Validate task to make sure valid parameters are supplied.
        *
        * @throws TaskException if invalid parameters are specified
        */
  -    private void validate()
  +    protected void validate()
           throws TaskException
       {
  -        if( null == m_name )
  -        {
  -            final String message =
  -                REZ.getString( "target.no-name.error" );
  -            throw new TaskException( message );
  -        }
  +        super.validate();
   
           final NameValidatorManager validatorManager =
               (NameValidatorManager)getService( NameValidatorManager.class );
  @@ -131,129 +95,5 @@
           }
       }
   
  -    /**
  -     * Execute depencies of target (if any).
  -     *
  -     * @throws TaskException if theres an eror executing dependencies.
  -     */
  -    private void executeDependencies()
  -        throws TaskException
  -    {
  -        if( null != m_dependencies )
  -        {
  -            for( int i = 0; i < m_dependencies.length; i++ )
  -            {
  -                executeDependency( m_dependencies[ i ] );
  -            }
  -        }
  -    }
  -
  -    /**
  -     * Execute all the tasks contained within target.
  -     *
  -     * @throws TaskException if theres an eror executing contained tasks.
  -     */
  -    protected void executeContainedTasks()
  -        throws TaskException
  -    {
  -        final ModelElement[] tasks =
  -            (ModelElement[])m_tasks.toArray( new ModelElement[ m_tasks.size() ] );
  -
  -        for( int i = 0; i < tasks.length; i++ )
  -        {
  -            final ModelElement task = tasks[ i ];
  -
  -            final String message =
  -                REZ.getString( "target.task-exec.notice",
  -                               task.getName() );
  -            getContext().debug( message );
  -            executeTask( task );
  -        }
  -    }
  -
  -    public String toString()
  -    {
  -        return "Target['" + m_name + "]";
  -    }
   
  -    /**
  -     * Utility method to parse a list of dependencies from depends
  -     * string.
  -     *
  -     * @param depends a comma separated string of dependencies
  -     * @return an array of Dependency objects
  -     * @throws TaskException on error
  -     */
  -    private Dependency[] buildDependsList( final String depends )
  -        throws TaskException
  -    {
  -        //apply depends attribute
  -        if( null == depends )
  -        {
  -            return null;
  -        }
  -
  -        final String[] elements = split( depends, "," );
  -        final ArrayList dependsList = new ArrayList();
  -
  -        for( int i = 0; i < elements.length; i++ )
  -        {
  -            final String dependency = elements[ i ].trim();
  -
  -            // Split project->target dependencies
  -            final int sep = dependency.indexOf( "->" );
  -            final String projectName;
  -            final String targetName;
  -            if( sep != -1 )
  -            {
  -                projectName = dependency.substring( 0, sep );
  -                targetName = dependency.substring( sep + 2 );
  -            }
  -            else
  -            {
  -                projectName = null;
  -                targetName = dependency;
  -            }
  -
  -            if( targetName.length() == 0 ||
  -                ( projectName != null && projectName.length() == 0 ) )
  -            {
  -                final String message =
  -                    REZ.getString( "target.bad-dependency.error",
  -                                   getContext().getName(),
  -                                   getContext().getLocation() );
  -                throw new TaskException( message );
  -            }
  -
  -            dependsList.add( new Dependency( projectName, targetName ) );
  -        }
  -
  -        final String message =
  -            REZ.getString( "target.depends.notice",
  -                           m_name,
  -                           dependsList );
  -        getContext().debug( message );
  -
  -        return (Dependency[])dependsList.toArray( new Dependency[ dependsList.size() ]
);
  -    }
  -
  -    /**
  -     * Splits the string on every token into an array of strings.
  -     *
  -     * @param string the string
  -     * @param onToken the token
  -     * @return the resultant array
  -     */
  -    private String[] split( final String string, final String onToken )
  -    {
  -        final StringTokenizer tokenizer = new StringTokenizer( string, onToken );
  -        final String[] result = new String[ tokenizer.countTokens() ];
  -
  -        for( int i = 0; i < result.length; i++ )
  -        {
  -            result[ i ] = tokenizer.nextToken();
  -        }
  -
  -        return result;
  -    }
   }
  
  
  
  1.2       +4 -21     jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/SimpleTargetTask.java
  
  Index: SimpleTargetTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/SimpleTargetTask.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SimpleTargetTask.java	11 Jun 2002 06:41:32 -0000	1.1
  +++ SimpleTargetTask.java	11 Jun 2002 13:20:15 -0000	1.2
  @@ -7,9 +7,8 @@
    */
   package org.apache.myrmidon.framework;
   
  -import java.util.ArrayList;
  -import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.api.metadata.ModelElement;
  +import org.apache.myrmidon.framework.project.AbstractTargetTask;
   
   /**
    * A simple <target> implementation.
  @@ -20,16 +19,14 @@
    * @ant.task name="simple-target"
    */
   public class SimpleTargetTask
  -    extends AbstractContainerTask
  +    extends AbstractTargetTask
   {
  -    private final ArrayList m_tasks = new ArrayList();
  -
       /**
        * The task name.
        */
       public void setName( final String name )
       {
  -        // Ignore
  +        m_name = name;
       }
   
       /**
  @@ -38,19 +35,5 @@
       public void add( final ModelElement taskModel )
       {
           m_tasks.add( taskModel );
  -    }
  -
  -    /**
  -     * Executes this target.
  -     */
  -    public void execute()
  -        throws TaskException
  -    {
  -        final int i = m_tasks.size();
  -        for( int j = 0; j < i; j++ )
  -        {
  -            final ModelElement taskModel = (ModelElement)m_tasks.get( j );
  -            executeTask( taskModel );
  -        }
       }
   }
  
  
  
  1.1                  jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/project/AbstractTargetTask.java
  
  Index: AbstractTargetTask.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.txt file.
   */
  package org.apache.myrmidon.framework.project;
  
  import org.apache.myrmidon.api.TaskException;
  import org.apache.myrmidon.api.metadata.ModelElement;
  import org.apache.myrmidon.framework.project.Dependency;
  import org.apache.myrmidon.framework.project.AbstractWorkspaceTask;
  import org.apache.avalon.excalibur.i18n.Resources;
  import org.apache.avalon.excalibur.i18n.ResourceManager;
  import java.util.ArrayList;
  import java.util.StringTokenizer;
  import java.util.List;
  import java.util.Iterator;
  
  /**
   * An abstract base class for implementing &gt;target&lt; tasks.
   *
   * @author <a href="mailto:peter@apache.org">Peter Donald</a>
   * @author <a href="mailto:darrell@apache.org">Darrell DeBoer</a>
   * @version $Revision: 1.1 $ $Date: 2002/06/11 13:20:15 $
   */
  public class AbstractTargetTask extends AbstractWorkspaceTask
  {
      private static final Resources REZ =
          ResourceManager.getPackageResources( AbstractTargetTask.class );
  
      /**
       * The name of the target.
       */
      protected String m_name;
  
      /**
       * The array of ordered tasks which are contained
       * withing Target.
       */
      protected final List m_tasks = new ArrayList();
  
      /**
       * The list of dependencies to execute before this target.
       */
      protected final List m_dependencies = new ArrayList();
  
      public void execute()
          throws TaskException
      {
          validate();
  
          executeDependencies();
  
          final String message =
              REZ.getString( "target.exec.notice", m_name );
          getContext().verbose( message );
  
          executeContainedTasks();
      }
  
      /**
       * Make sure that the name is not null.
       *
       * @throws TaskException if name has not been set.
       */
      protected void validate()
          throws TaskException
      {
          if( null == m_name )
          {
              final String message =
                  REZ.getString( "target.no-name.error" );
              throw new TaskException( message );
          }
      }
  
      /**
       * Execute depencies of target (if any).
       *
       * @throws TaskException if theres an eror executing dependencies.
       */
      protected void executeDependencies()
          throws TaskException
      {
          Iterator iter = m_dependencies.iterator();
          while( iter.hasNext() )
          {
              Dependency dependency = (Dependency)iter.next();
              executeDependency( dependency );
          }
      }
  
      /**
       * Execute all the tasks contained within target.
       *
       * @throws org.apache.myrmidon.api.TaskException if theres an eror executing contained
tasks.
       */
      protected void executeContainedTasks()
          throws TaskException
      {
          final ModelElement[] tasks =
              (ModelElement[])m_tasks.toArray( new ModelElement[ m_tasks.size() ] );
  
          for( int i = 0; i < tasks.length; i++ )
          {
              final ModelElement task = tasks[ i ];
  
              final String message =
                  REZ.getString( "target.task-exec.notice",
                                 task.getName() );
              getContext().debug( message );
              executeTask( task );
          }
      }
  
      public String toString()
      {
          return "Target['" + m_name + "]";
      }
  
      /**
       * Utility method to parse a list of dependencies from depends
       * string, adding them to the Dependencies list.
       *
       * @param depends a comma separated string of dependencies
       * @throws org.apache.myrmidon.api.TaskException on error
       */
      protected void buildDependsList( final String depends )
          throws TaskException
      {
          m_dependencies.clear();
  
          //apply depends attribute
          if( null == depends )
          {
              return;
          }
  
          final String[] elements = split( depends, "," );
  
          for( int i = 0; i < elements.length; i++ )
          {
              final String dependency = elements[ i ].trim();
  
              // Split project->target dependencies
              final int sep = dependency.indexOf( "->" );
              final String projectName;
              final String targetName;
              if( sep != -1 )
              {
                  projectName = dependency.substring( 0, sep );
                  targetName = dependency.substring( sep + 2 );
              }
              else
              {
                  projectName = null;
                  targetName = dependency;
              }
  
              if( targetName.length() == 0 ||
                  ( projectName != null && projectName.length() == 0 ) )
              {
                  final String message =
                      REZ.getString( "target.bad-dependency.error",
                                     getContext().getName(),
                                     getContext().getLocation() );
                  throw new TaskException( message );
              }
  
              m_dependencies.add( new Dependency( projectName, targetName ) );
          }
  
          final String message =
              REZ.getString( "target.depends.notice",
                             m_name,
                             m_dependencies );
          getContext().debug( message );
      }
  
      /**
       * Splits the string on every token into an array of strings.
       *
       * @param string the string
       * @param onToken the token
       * @return the resultant array
       */
      private String[] split( final String string, final String onToken )
      {
          final StringTokenizer tokenizer = new StringTokenizer( string, onToken );
          final String[] result = new String[ tokenizer.countTokens() ];
  
          for( int i = 0; i < result.length; i++ )
          {
              result[ i ] = tokenizer.nextToken();
          }
  
          return result;
      }
  }
  
  
  
  1.1                  jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/project/AbstractWorkspaceTask.java
  
  Index: AbstractWorkspaceTask.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.txt file.
   */
  package org.apache.myrmidon.framework.project;
  
  import org.apache.avalon.excalibur.i18n.ResourceManager;
  import org.apache.avalon.excalibur.i18n.Resources;
  import org.apache.myrmidon.api.TaskException;
  import org.apache.myrmidon.framework.AbstractContainerTask;
  import org.apache.myrmidon.framework.project.Dependency;
  import org.apache.myrmidon.interfaces.workspace.ProjectDescriptor;
  import org.apache.myrmidon.interfaces.workspace.Workspace;
  
  /**
   * An abstract class used to execute Ant files within same workspace.
   *
   * @author <a href="mailto:peter@apache.org">Peter Donald</a>
   * @version $Revision: 1.1 $ $Date: 2002/06/11 13:20:15 $
   */
  public abstract class AbstractWorkspaceTask
      extends AbstractContainerTask
  {
      private final static Resources REZ =
          ResourceManager.getPackageResources( AbstractWorkspaceTask.class );
  
      /**
       * Execute specified Dependency in the same Workspace as this task.
       *
       * @param dependency the dependency to execute
       * @throws org.apache.myrmidon.api.TaskException if error occurs executing dependency
       */
      protected final void executeDependency( final Dependency dependency )
          throws TaskException
      {
          final String message =
              REZ.getString( "workspace.exec-depends.notice",
                             dependency );
          getContext().debug( message );
  
          // Locate the referenced target
          final ProjectDescriptor project = getProjectDescriptor( dependency.getProjectName()
);
          final String targetName = dependency.getTargetName();
  
          executeTarget( project, targetName );
      }
  
      /**
       * Utility method to execute a target.  The execution takes place in the
       * same Workspace as this task.
       *
       * @param target the name of target to execute
       * @throws org.apache.myrmidon.api.TaskException if error occurs executing target
       */
      protected final void executeTarget( final ProjectDescriptor descriptor,
                                          final String target )
          throws TaskException
      {
          final Workspace workspace = (Workspace)getContext().getService( Workspace.class
);
          workspace.execute( descriptor, target );
      }
  
      /**
       * Get project descriptor for projecName.
       * If projecName is null then return descriptor for current project else
       * return descriptor for project referenced by current project.
       *
       * @param projectName the project to get descriptor for
       * @return the descriptor
       * @throws org.apache.myrmidon.api.TaskException if unable to locate descriptor
       */
      protected ProjectDescriptor getProjectDescriptor( final String projectName )
          throws TaskException
      {
          String key = ProjectDescriptor.KEY;
          if( null != projectName )
          {
              key += "-" + projectName;
          }
          final ProjectDescriptor project = (ProjectDescriptor)getContext().getProperty( key
);
          if( null == project )
          {
              final String message =
                  REZ.getString( "workspace.missing-ref.error",
                                 projectName );
              throw new TaskException( message );
          }
          else
          {
              return project;
          }
      }
  }
  
  
  
  1.1                  jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/project/Dependency.java
  
  Index: Dependency.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.txt file.
   */
  package org.apache.myrmidon.framework.project;
  
  /**
   * A dependency for a target.
   *
   * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
   * @version $Revision: 1.1 $ $Date: 2002/06/11 13:20:15 $
   */
  public class Dependency
  {
      private final String m_projectName;
      private final String m_targetName;
  
      /**
       * @param projectName The project containing the depended-on target.
       * @param targetName The name of the depended-on target.
       */
      public Dependency( final String projectName, final String targetName )
      {
          m_projectName = projectName;
          m_targetName = targetName;
      }
  
      /**
       * @return The name of the project containing the depended-on target.
       */
      public String getProjectName()
      {
          return m_projectName;
      }
  
      /**
       * @return The name of the depended-on target.
       */
      public String getTargetName()
      {
          return m_targetName;
      }
  
      /**
       * Return human readable string for dependency.
       *
       * @return human readable string.
       */
      public String toString()
      {
          if( null == m_projectName )
          {
              return m_targetName;
          }
          else
          {
              return m_projectName + "->" + m_targetName;
          }
      }
  }
  
  
  
  1.1                  jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/project/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  target.no-name.error=Target does not specify the name attribute.
  target.exec.notice=Executing target: "{0}".
  target.task-exec.notice=Executing task: "{0}".
  target.depends.notice=Dependencies for target "{0}": {1}
  target.bad-dependency.error=Discovered empty dependency in target "{0}" at {1}.
  
  workspace.exec-depends.notice=Executing dependency: {0}
  workspace.missing-ref.error=Unable to locate Project Reference "{0}" for dependency "{1}".
  
  

--
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