You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by jv...@apache.org on 2002/02/24 20:35:32 UTC

cvs commit: jakarta-turbine-maven/src/templates/build build-docs.xml build.init.target

jvanzyl     02/02/24 11:35:32

  Modified:    .        build-bootstrap.xml
               src/java/org/apache/maven ChangeLog.java
               src/templates/build build-docs.xml build.init.target
  Log:
  - making the cvs change log task work with the maven project model
    and integrating into the doc cycle.
  
  Revision  Changes    Path
  1.11      +1 -0      jakarta-turbine-maven/build-bootstrap.xml
  
  Index: build-bootstrap.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/build-bootstrap.xml,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- build-bootstrap.xml	24 Feb 2002 18:32:01 -0000	1.10
  +++ build-bootstrap.xml	24 Feb 2002 19:35:31 -0000	1.11
  @@ -74,6 +74,7 @@
         <class name="org.apache.maven.build.BaseProjectTask"/>
         <class name="org.apache.maven.build.ProjectProperties"/>
         <class name="org.apache.maven.jxr.JxrTask"/>
  +      <class name="org.apache.maven.ChangeLog"/>
         <!-- The project classes have to be all list, dynamic loading -->
         <class name="org.apache.maven.project.BaseObject"/>
         <class name="org.apache.maven.project.Build"/>
  
  
  
  1.3       +51 -102   jakarta-turbine-maven/src/java/org/apache/maven/ChangeLog.java
  
  Index: ChangeLog.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/ChangeLog.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ChangeLog.java	24 Feb 2002 18:32:01 -0000	1.2
  +++ ChangeLog.java	24 Feb 2002 19:35:32 -0000	1.3
  @@ -50,6 +50,7 @@
    * License version 1.0
    *
    */
  +
   import java.io.*;
   import java.util.*;
   import java.text.*;
  @@ -58,6 +59,11 @@
   import org.apache.tools.ant.taskdefs.*;
   import org.apache.tools.ant.types.*;
   
  +import org.apache.stratum.xo.Mapper;
  +import org.apache.maven.project.Project;
  +import org.apache.maven.project.Developer;
  +
  +
   /**
    * Change log task. The task will examine the output of cvs log and group
    * related changes together. It produces an XML output representing the list of
  @@ -65,36 +71,37 @@
    *
    * @author <a href="mailto:jeff.martin@synamic.co.uk">Jeff Martin</a>
    * @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
  - * @version $Id: ChangeLog.java,v 1.2 2002/02/24 18:32:01 jvanzyl Exp $
  + * @version $Id: ChangeLog.java,v 1.3 2002/02/24 19:35:32 jvanzyl Exp $
    */
   public class ChangeLog
        extends Task
        implements ExecuteStreamHandler
   {
       /**
  -     * User list
  +     * Project descriptor.
        */
  -    private File users = null;
  +    protected File projectDescriptor;
  +
       /**
        * User list
        */
       private Properties userList = new Properties();
  -    /**
  -     * User list
  -     */
  -    private Vector ulist = new Vector();
  +
       /**
        * Input dir
        */
       private File base = null;
  +
       /**
        * Output file
        */
       private File output = null;
  +
       /**
        * input stream read in from cvs
        */
       private BufferedReader in = null;
  +
       /**
        * output file stream
        */
  @@ -133,10 +140,17 @@
           new SimpleDateFormat("hh:mm");
   
       /**
  +     * Set the project descriptor file. This file must exist.
  +     */
  +    public void setProjectDescriptor (File projectDescriptor)
  +    {
  +        this.projectDescriptor = projectDescriptor;
  +    }
  +
  +    /**
        * Set the input stream for the cvs process. cvs requires no input so this
        * is not used.
        */
  -
       public void setProcessInputStream(OutputStream os)
           throws IOException
       {
  @@ -188,6 +202,7 @@
       public void execute()
           throws BuildException
       {
  +
           if (base == null)
           {
               throw new BuildException("basedir must be set");
  @@ -196,37 +211,34 @@
           {
               throw new BuildException("output must be set");
           }
  -        if (!users.exists())
  -        {
  -            throw new BuildException(
  -                "Cannot find user lookup file " + users.getAbsolutePath());
  -        }
           if (!base.exists())
           {
               throw new BuildException(
                   "Cannot find base dir " + base.getAbsolutePath());
           }
   
  -        if (users != null)
  +        Project mavenProject = null;
  +
  +        try
           {
  -            if (!users.exists())
  -            {
  -                throw new BuildException("Cannot find user list " + users.getAbsolutePath());
  -            }
  -            userList = new Properties();
  -            try
  -            {
  -                userList.load(new FileInputStream(users));
  -            }
  -            catch (IOException e)
  -            {
  -                throw new BuildException(e);
  -            }
  -            for (Enumeration e = ulist.elements(); e.hasMoreElements(); )
  -            {
  -                User user = (User) e.nextElement();
  -                userList.put(user.getUsername(), user.getDisplayname());
  -            }
  +            Mapper m = new Mapper();
  +            mavenProject = (Project) m.map(projectDescriptor,
  +                "org.apache.maven.project.Project");
  +
  +        }
  +        catch (Exception e)
  +        {
  +            throw new BuildException(e);
  +        }
  +
  +        List developers = mavenProject.getDevelopers();
  +
  +        userList = new Properties();
  +        for (Iterator i = developers.iterator(); i.hasNext();)
  +        {
  +            Developer developer = (Developer) i.next();
  +
  +            userList.put(developer.getId(), developer.getName());
           }
   
           Commandline toExecute = new Commandline();
  @@ -237,6 +249,7 @@
           exe.setCommandline(toExecute.getCommandline());
           exe.setAntRun(project);
           exe.setWorkingDirectory(base);
  +
           try
           {
               exe.execute();
  @@ -248,21 +261,18 @@
       }
   
       /**
  -     * Set a lookup list of user names & addresses
  -     */
  -    public void setUserlist(File users)
  -    {
  -        this.users = users;
  -    }
  -
  -    /**
        * Start read from the cvs log
        */
       public void start()
           throws IOException
       {
  +        System.out.println("!!!");
  +
           String file = null;
  -        out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(output), "UTF-8"));
  +
  +        out = new PrintWriter(new OutputStreamWriter(
  +            new FileOutputStream(output), "UTF-8"));
  +
           String line;
           String date = null;
           String author = null;
  @@ -500,67 +510,6 @@
               {
                   return previousRev;
               }
  -        }
  -    }
  -
  -    /**
  -     * Description of the Method
  -     */
  -    public User createUser()
  -    {
  -        User user = new User();
  -        ulist.addElement(user);
  -        return user;
  -    }
  -
  -    /**
  -     * Description of the Class
  -     */
  -    public class User
  -    {
  -        private String user;
  -        private String name;
  -
  -        /**
  -         * Sets the displayname attribute of the User object
  -         */
  -        public void setDisplayname(String name)
  -        {
  -            this.name = name;
  -        }
  -
  -        /**
  -         * Sets the username attribute of the User object
  -         */
  -        public void setUsername(String user)
  -        {
  -            this.user = user;
  -        }
  -
  -        /**
  -         * Gets the username attribute of the User object
  -         */
  -        public String getUsername()
  -            throws BuildException
  -        {
  -            if (name == null)
  -            {
  -                throw new BuildException("username attribute must be set");
  -            }
  -            return user;
  -        }
  -
  -        /**
  -         * Gets the displayname attribute of the User object
  -         */
  -        public String getDisplayname()
  -            throws BuildException
  -        {
  -            if (name == null)
  -            {
  -                throw new BuildException("displayname attribute must be set");
  -            }
  -            return name;
           }
       }
   }
  
  
  
  1.13      +16 -0     jakarta-turbine-maven/src/templates/build/build-docs.xml
  
  Index: build-docs.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/templates/build/build-docs.xml,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- build-docs.xml	23 Feb 2002 20:41:21 -0000	1.12
  +++ build-docs.xml	24 Feb 2002 19:35:32 -0000	1.13
  @@ -59,6 +59,22 @@
     </target>
   
     <!-- ================================================================== -->
  +  <!-- C V S  C H A N G E  L O G  R E P O R T                             -->
  +  <!-- ================================================================== -->
  +
  +  <target
  +    name="cvs-change-log"
  +    depends="init">
  +    
  +    <change-log
  +      projectDescriptor="project.xml"
  +      baseDir="src/java"
  +      output="docs/cvs-change-log.xml"
  +    />
  +  
  +  </target>
  +
  +  <!-- ================================================================== -->
     <!-- P R O J E C T  D O C U M E N T A T I O N                           -->
     <!-- ================================================================== -->
   
  
  
  
  1.3       +6 -0      jakarta-turbine-maven/src/templates/build/build.init.target
  
  Index: build.init.target
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/templates/build/build.init.target,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- build.init.target	23 Feb 2002 20:41:21 -0000	1.2
  +++ build.init.target	24 Feb 2002 19:35:32 -0000	1.3
  @@ -25,6 +25,12 @@
       </taskdef>
   
       <taskdef
  +      name="change-log"
  +      classname="org.apache.maven.ChangeLog">
  +      <classpath refid="maven-classpath"/>
  +    </taskdef>
  +
  +    <taskdef
         name="project-properties"
         classname="org.apache.maven.build.ProjectProperties">
         <classpath refid="maven-classpath"/>
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>