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/antlib/src/java/org/apache/antlib/project AbstractWorkspaceTask.java AntCallTask.java TargetTask.java
Date Tue, 11 Jun 2002 03:59:48 GMT
donaldp     2002/06/10 20:59:48

  Modified:    ant1compat/src/java/org/apache/tools/ant/taskdefs
                        CallTarget.java
               antlib/src/java/org/apache/antlib/project
                        AbstractWorkspaceTask.java AntCallTask.java
                        TargetTask.java
  Log:
  Update tasks to work with descriptors rather than directly with projects. Allows all sorts
of neat tricks - such as integration into meta-build systems ala Centipede/Maven - with zero
hassles
  
  Revision  Changes    Path
  1.6       +5 -4      jakarta-ant-myrmidon/ant1compat/src/java/org/apache/tools/ant/taskdefs/CallTarget.java
  
  Index: CallTarget.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/ant1compat/src/java/org/apache/tools/ant/taskdefs/CallTarget.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- CallTarget.java	9 Jun 2002 04:53:34 -0000	1.5
  +++ CallTarget.java	11 Jun 2002 03:59:48 -0000	1.6
  @@ -9,7 +9,7 @@
   
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.framework.ExecuteTarget;
  -import org.apache.myrmidon.interfaces.oldmodel.Project;
  +import org.apache.myrmidon.interfaces.workspace.ProjectDescriptor;
   
   /**
    * The Ant1Compat version of the <antcall> task, which delegates to the
  @@ -35,7 +35,8 @@
        */
       protected void prepare( final ExecuteTarget exe ) throws TaskException
       {
  -        final Project project = (Project)m_context.getService( Project.class );
  -        exe.setProject( project.getProjectDescriptor() );
  +        final ProjectDescriptor project =
  +            (ProjectDescriptor)m_context.getProperty( ProjectDescriptor.KEY );
  +        exe.setProject( project );
       }
   }
  
  
  
  1.9       +13 -18    jakarta-ant-myrmidon/antlib/src/java/org/apache/antlib/project/AbstractWorkspaceTask.java
  
  Index: AbstractWorkspaceTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/antlib/src/java/org/apache/antlib/project/AbstractWorkspaceTask.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AbstractWorkspaceTask.java	11 Jun 2002 03:07:26 -0000	1.8
  +++ AbstractWorkspaceTask.java	11 Jun 2002 03:59:48 -0000	1.9
  @@ -11,9 +11,7 @@
   import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.framework.AbstractContainerTask;
  -import org.apache.myrmidon.interfaces.oldmodel.Project;
   import org.apache.myrmidon.interfaces.workspace.ProjectDescriptor;
  -import org.apache.myrmidon.interfaces.workspace.ProjectRef;
   import org.apache.myrmidon.interfaces.workspace.Workspace;
   
   /**
  @@ -77,25 +75,22 @@
       protected ProjectDescriptor getProjectDescriptor( final String projectName )
           throws TaskException
       {
  -        final Project project = (Project)getContext().getService( Project.class );
  -        if( null == projectName )
  +        String key = ProjectDescriptor.KEY;
  +        if( null != projectName )
           {
  -            return project.getProjectDescriptor();
  +            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
           {
  -            final ProjectRef projectRef = project.getProjectRef( projectName );
  -            if( null == projectRef )
  -            {
  -                final String message =
  -                    REZ.getString( "workspace.missing-ref.error",
  -                                   projectName );
  -                throw new TaskException( message );
  -            }
  -            else
  -            {
  -                return projectRef.getProject();
  -            }
  +            return project;
           }
       }
   }
  
  
  
  1.7       +13 -18    jakarta-ant-myrmidon/antlib/src/java/org/apache/antlib/project/AntCallTask.java
  
  Index: AntCallTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/antlib/src/java/org/apache/antlib/project/AntCallTask.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AntCallTask.java	11 Jun 2002 03:07:26 -0000	1.6
  +++ AntCallTask.java	11 Jun 2002 03:59:48 -0000	1.7
  @@ -11,9 +11,7 @@
   import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.framework.ExecuteTarget;
  -import org.apache.myrmidon.interfaces.oldmodel.Project;
   import org.apache.myrmidon.interfaces.workspace.ProjectDescriptor;
  -import org.apache.myrmidon.interfaces.workspace.ProjectRef;
   
   /**
    * A task which executes a target in the current project,
  @@ -63,25 +61,22 @@
       protected ProjectDescriptor getProjectDescriptor( final String projectName )
           throws TaskException
       {
  -        final Project project = (Project)getContext().getService( Project.class );
  -        if( null == projectName )
  +        String key = ProjectDescriptor.KEY;
  +        if( null != projectName )
           {
  -            return project.getProjectDescriptor();
  +            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
           {
  -            final ProjectRef projectRef = project.getProjectRef( projectName );
  -            if( null == projectRef )
  -            {
  -                final String message =
  -                    REZ.getString( "workspace.missing-ref.error",
  -                                   projectName );
  -                throw new TaskException( message );
  -            }
  -            else
  -            {
  -                return projectRef.getProject();
  -            }
  +            return project;
           }
       }
   }
  
  
  
  1.12      +6 -5      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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- TargetTask.java	2 Jun 2002 14:08:05 -0000	1.11
  +++ TargetTask.java	11 Jun 2002 03:59:48 -0000	1.12
  @@ -15,7 +15,6 @@
   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.interfaces.oldmodel.Project;
   
   /**
    * A simple task to task to execute a group of tasks.
  @@ -30,6 +29,8 @@
       private static final Resources REZ =
           ResourceManager.getPackageResources( TargetTask.class );
   
  +    private static final String IMPLICIT_TARGET_NAME = "<init>";
  +
       /**
        * The array of ordered tasks which are contained
        * withing Target.
  @@ -118,7 +119,7 @@
           }
   
           //Add in special case for "init" target.
  -        if( Project.IMPLICIT_TARGET_NAME.equals( m_name ) )
  +        if( IMPLICIT_TARGET_NAME.equals( m_name ) )
           {
               return;
           }
  @@ -147,9 +148,9 @@
           throws TaskException
       {
           // Execute implicit target first
  -        if( ! m_name.equals( Project.IMPLICIT_TARGET_NAME ) )
  +        if( ! m_name.equals( IMPLICIT_TARGET_NAME ) )
           {
  -            executeDependency( new Dependency( null, Project.IMPLICIT_TARGET_NAME ) );
  +            executeDependency( new Dependency( null, IMPLICIT_TARGET_NAME ) );
           }
   
           if( null != m_dependencies )
  
  
  

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