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/builder DefaultProjectBuilder.java DefaultProject.java
Date Tue, 21 May 2002 07:15:22 GMT
donaldp     02/05/21 00:15:21

  Modified:    container/src/java/org/apache/myrmidon/interfaces/oldmodel
                        Project.java
               container/src/java/org/apache/myrmidon/components/builder
                        DefaultProjectBuilder.java DefaultProject.java
  Added:       container/src/java/org/apache/myrmidon/interfaces/oldmodel
                        ProjectRef.java
  Log:
  Allow projects to contain references to external Projects through a lightweight ProjectRef
"pointer" object.
  
  This is start of work for allowing lazy loading of referenced projects.
  
  Revision  Changes    Path
  1.8       +10 -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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Project.java	21 May 2002 06:52:27 -0000	1.7
  +++ Project.java	21 May 2002 07:15:21 -0000	1.8
  @@ -16,7 +16,7 @@
    * Implementations may choose to structure it anyway they choose.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.7 $ $Date: 2002/05/21 06:52:27 $
  + * @version $Revision: 1.8 $ $Date: 2002/05/21 07:15:21 $
    */
   public interface Project
       extends Module
  @@ -51,6 +51,15 @@
        * @return the Project or null if none by that name
        */
       Project getProject( String name );
  +
  +    /**
  +     * Retrieve project reference for specified name.
  +     * The name is local name of project.
  +     *
  +     * @param name the name project referenced with
  +     * @return the ProjectRef
  +     */
  +    ProjectRef getProjectRef( String name );
   
       /**
        * Get name of default target.
  
  
  
  1.1                  jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/interfaces/oldmodel/ProjectRef.java
  
  Index: ProjectRef.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.interfaces.oldmodel;
  
  /**
   * A object modeling a project reference.
   *
   * @author <a href="mailto:peter@apache.org">Peter Donald</a>
   * @version $Revision: 1.1 $ $Date: 2002/05/21 07:15:21 $
   */
  public class ProjectRef
  {
      private final String m_name;
      private final String m_uri;
  
      /**
       * @param name The local name used to refer to project
       * @param uri The URI of project file.
       */
      public ProjectRef( final String name, final String uri )
      {
          m_name = name;
          m_uri = uri;
      }
  
      /**
       * @return The name of the project containing the depended-on target.
       */
      public String getName()
      {
          return m_name;
      }
  
      /**
       * @return The name of the depended-on target.
       */
      public String getUri()
      {
          return m_uri;
      }
  
      /**
       * Return human readable string for Project reference.
       *
       * @return human readable string.
       */
      public String toString()
      {
          return m_name + ": " + m_uri;
      }
  }
  
  
  
  1.55      +13 -1     jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/builder/DefaultProjectBuilder.java
  
  Index: DefaultProjectBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant-myrmidon/container/src/java/org/apache/myrmidon/components/builder/DefaultProjectBuilder.java,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- DefaultProjectBuilder.java	21 May 2002 01:32:56 -0000	1.54
  +++ DefaultProjectBuilder.java	21 May 2002 07:15:21 -0000	1.55
  @@ -28,13 +28,14 @@
   import org.apache.myrmidon.interfaces.builder.ProjectException;
   import org.apache.myrmidon.interfaces.oldmodel.Dependency;
   import org.apache.myrmidon.interfaces.oldmodel.Project;
  +import org.apache.myrmidon.interfaces.oldmodel.ProjectRef;
   import org.apache.myrmidon.interfaces.oldmodel.Target;
   
   /**
    * Default implementation to construct project from a build file.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.54 $ $Date: 2002/05/21 01:32:56 $
  + * @version $Revision: 1.55 $ $Date: 2002/05/21 07:15:21 $
    *
    * @ant.type type="project-builder" name="ant2"
    */
  @@ -377,6 +378,17 @@
           // Build the URL of the referenced projects
           final File baseDirectory = project.getBaseDirectory();
           final File file = FileUtil.resolveFile( baseDirectory, location );
  +
  +        try
  +        {
  +            final String uri = file.getCanonicalFile().toURL().toExternalForm();
  +            final ProjectRef ref = new ProjectRef( name, uri );
  +            project.addProjectRef( ref );
  +        }
  +        catch( final IOException ioe )
  +        {
  +            throw new ProjectException( ioe.getMessage(), ioe );
  +        }
   
           // Locate the referenced project, building it if necessary
           final Project other = build( file, projects );
  
  
  
  1.12      +22 -1     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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- DefaultProject.java	21 May 2002 06:52:28 -0000	1.11
  +++ DefaultProject.java	21 May 2002 07:15:21 -0000	1.12
  @@ -17,13 +17,14 @@
   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.oldmodel.ProjectRef;
   import org.apache.myrmidon.interfaces.workspace.Workspace;
   
   /**
    * Default project implementation.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.11 $ $Date: 2002/05/21 06:52:28 $
  + * @version $Revision: 1.12 $ $Date: 2002/05/21 07:15:21 $
    */
   public class DefaultProject
       implements Project, TargetMetaData
  @@ -31,6 +32,9 @@
       private static final Resources REZ =
           ResourceManager.getPackageResources( DefaultProject.class );
   
  +    ///The project references in this project
  +    private final HashMap m_references = new HashMap();
  +
       ///The projects refferred to by this project
       private final HashMap m_projects = new HashMap();
   
  @@ -93,6 +97,18 @@
       }
   
       /**
  +     * Retrieve project reference for specified name.
  +     * The name is local name of project.
  +     *
  +     * @param name the name project referenced with
  +     * @return the ProjectRef
  +     */
  +    public ProjectRef getProjectRef( final String name )
  +    {
  +        return (ProjectRef)m_references.get( name );
  +    }
  +
  +    /**
        * Retrieve base directory of project.
        *
        * @return the projects base directory
  @@ -257,5 +273,10 @@
       public void setWorkspace( final Workspace workspace )
       {
           m_workspace = workspace;
  +    }
  +
  +    public void addProjectRef( final ProjectRef ref )
  +    {
  +        m_references.put( ref.getName(), ref );
       }
   }
  
  
  

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