ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@locus.apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/types Commandline.java
Date Mon, 04 Sep 2000 15:19:17 GMT
bodewig     00/09/04 08:19:17

  Modified:    src/main/org/apache/tools/ant/taskdefs Javadoc.java
                        Patch.java
               src/main/org/apache/tools/ant/types Commandline.java
  Log:
  <javadoc> and <patch> would fail if the execute method was called more
  than once on the same instance of the class. This is why the second
  <javadoc> in the nightly builds ("ant dist install") failed.
  
  Revision  Changes    Path
  1.29      +38 -36    jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
  
  Index: Javadoc.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Javadoc.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- Javadoc.java	2000/08/30 22:10:38	1.28
  +++ Javadoc.java	2000/09/04 15:19:16	1.29
  @@ -593,7 +593,8 @@
   
           log("Generating Javadoc", Project.MSG_INFO);
   
  -        cmd.setExecutable("javadoc");
  +        Commandline toExecute = (Commandline)cmd.clone();
  +        toExecute.setExecutable("javadoc");
   
   // ------------------------------------------------ general javadoc arguments
           if (classpath == null)
  @@ -603,20 +604,20 @@
           addReferencesToPath(sourcepathReferences, sourcePath);
   
           if (!javadoc1) {
  -            cmd.createArgument().setValue("-classpath");
  -            cmd.createArgument().setPath(classpath);
  -            cmd.createArgument().setValue("-sourcepath");
  -            cmd.createArgument().setPath(sourcePath);
  +            toExecute.createArgument().setValue("-classpath");
  +            toExecute.createArgument().setPath(classpath);
  +            toExecute.createArgument().setValue("-sourcepath");
  +            toExecute.createArgument().setPath(sourcePath);
           } else {
  -            cmd.createArgument().setValue("-classpath");
  -            cmd.createArgument().setValue(sourcePath.toString() +
  +            toExecute.createArgument().setValue("-classpath");
  +            toExecute.createArgument().setValue(sourcePath.toString() +
                   System.getProperty("path.separator") + classpath.toString());
           }
   
           if (version && doclet == null)
  -            cmd.createArgument().setValue("-version");
  +            toExecute.createArgument().setValue("-version");
           if (author && doclet == null)
  -            cmd.createArgument().setValue("-author");
  +            toExecute.createArgument().setValue("-author");
   
   // --------------------------------- javadoc2 arguments for default doclet
   
  @@ -628,11 +629,11 @@
                       throw new BuildException("The doclet name must be specified.", location);
                   }
                   else {                
  -                    cmd.createArgument().setValue("-doclet");
  -                    cmd.createArgument().setValue(doclet.getName());
  +                    toExecute.createArgument().setValue("-doclet");
  +                    toExecute.createArgument().setValue(doclet.getName());
                       if (doclet.getPath() != null) {
  -                        cmd.createArgument().setValue("-docletpath");
  -                        cmd.createArgument().setPath(doclet.getPath());
  +                        toExecute.createArgument().setValue("-docletpath");
  +                        toExecute.createArgument().setPath(doclet.getPath());
                       }
                       for (Enumeration e = doclet.getParams(); e.hasMoreElements();) {
                           DocletParam param = (DocletParam)e.nextElement();
  @@ -640,9 +641,9 @@
                               throw new BuildException("Doclet parameters must have a name");
                           }
                           
  -                        cmd.createArgument().setValue(param.getName());
  +                        toExecute.createArgument().setValue(param.getName());
                           if (param.getValue() != null) {
  -                            cmd.createArgument().setValue(param.getValue());
  +                            toExecute.createArgument().setValue(param.getValue());
                           }
                       }                        
                   }
  @@ -650,8 +651,8 @@
               if (bootclasspath != null || bootClasspathReferences.size() > 0) {
                   addReferencesToPath(bootClasspathReferences, 
                                       createBootclasspath());
  -                cmd.createArgument().setValue("-bootclasspath");
  -                cmd.createArgument().setPath(bootclasspath);
  +                toExecute.createArgument().setValue("-bootclasspath");
  +                toExecute.createArgument().setPath(bootclasspath);
               }
               
               // add the links arguments
  @@ -669,13 +670,13 @@
                               throw new BuildException("The package list location for link
" + la.getHref() +
                                                        " must be provided because the link
is offline");
                           }
  -                        cmd.createArgument().setValue("-linkoffline");
  -                        cmd.createArgument().setValue(la.getHref());
  -                        cmd.createArgument().setValue(packageListLocation);
  +                        toExecute.createArgument().setValue("-linkoffline");
  +                        toExecute.createArgument().setValue(la.getHref());
  +                        toExecute.createArgument().setValue(packageListLocation);
                       }
                       else {
  -                        cmd.createArgument().setValue("-link");
  -                        cmd.createArgument().setValue(la.getHref());
  +                        toExecute.createArgument().setValue("-link");
  +                        toExecute.createArgument().setValue(la.getHref());
                       }
                   }
               }                                   
  @@ -699,9 +700,9 @@
                     if (space > 0){
                       String name = grp.substring(0, space);
                       String pkgList = grp.substring(space + 1);
  -                    cmd.createArgument().setValue("-group");
  -                    cmd.createArgument().setValue(name);
  -                    cmd.createArgument().setValue(pkgList);
  +                    toExecute.createArgument().setValue("-group");
  +                    toExecute.createArgument().setValue(name);
  +                    toExecute.createArgument().setValue(pkgList);
                     }
                   }
               }
  @@ -715,9 +716,9 @@
                       if (title == null || packages == null) {
                           throw new BuildException("The title and packages must be specified
for group elements.");
                       }
  -                    cmd.createArgument().setValue("-group");
  -                    cmd.createArgument().setValue(title);
  -                    cmd.createArgument().setValue(packages);
  +                    toExecute.createArgument().setValue("-group");
  +                    toExecute.createArgument().setValue(title);
  +                    toExecute.createArgument().setValue(packages);
                   }
               }
   
  @@ -731,25 +732,25 @@
                   if (name.endsWith(".*")) {
                       packages.addElement(name);
                   } else {
  -                    cmd.createArgument().setValue(name);
  +                    toExecute.createArgument().setValue(name);
                   }
               }
               if (packages.size() > 0) {
  -                evaluatePackages(sourcePath, packages);
  +                evaluatePackages(toExecute, sourcePath, packages);
               }
           }
   
           if ((sourceFiles != null) && (sourceFiles.length() > 0)) {
               StringTokenizer tok = new StringTokenizer(sourceFiles, ",", false);
               while (tok.hasMoreTokens()) {
  -                cmd.createArgument().setValue(tok.nextToken().trim());
  +                toExecute.createArgument().setValue(tok.nextToken().trim());
               }
           }
   
            if (packageList != null) {
  -            cmd.createArgument().setValue("@" + packageList);
  +            toExecute.createArgument().setValue("@" + packageList);
           }
  -        log("Javadoc args: " + cmd, Project.MSG_VERBOSE);
  +        log("Javadoc args: " + toExecute, Project.MSG_VERBOSE);
   
           log("Javadoc execution", Project.MSG_INFO);
   
  @@ -759,7 +760,7 @@
           exe.setAntRun(project);
           exe.setWorkingDirectory(project.getBaseDir());
           try {
  -            exe.setCommandline(cmd.getCommandline());
  +            exe.setCommandline(toExecute.getCommandline());
               exe.execute();
           } catch (IOException e) {
               throw new BuildException("Javadoc failed: " + e, e, location);
  @@ -797,7 +798,8 @@
        * with the packages found in that path subdirs matching one of the given
        * patterns.
        */
  -    private void evaluatePackages(Path sourcePath, Vector packages) {
  +    private void evaluatePackages(Commandline toExecute, Path sourcePath, 
  +                                  Vector packages) {
           log("Source path = " + sourcePath.toString(), Project.MSG_VERBOSE);
           log("Packages = " + packages, Project.MSG_VERBOSE);
   
  @@ -813,7 +815,7 @@
                   for (int i = 0; i < packages.size(); i++) {
                       if (matches(pack, (String) packages.elementAt(i))) {
                           if (!addedPackages.contains(pack)) {
  -                            cmd.createArgument().setValue(pack);
  +                            toExecute.createArgument().setValue(pack);
                               addedPackages.addElement(pack);
                           }
                           break;
  
  
  
  1.6       +4 -3      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Patch.java
  
  Index: Patch.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Patch.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Patch.java	2000/08/03 11:25:12	1.5
  +++ Patch.java	2000/09/04 15:19:16	1.6
  @@ -145,16 +145,17 @@
                                        location);
           } 
           
  -        cmd.setExecutable("patch");
  +        Commandline toExecute = (Commandline)cmd.clone();
  +        toExecute.setExecutable("patch");
   
           if (originalFile != null) {
  -            cmd.createArgument().setFile(originalFile);
  +            toExecute.createArgument().setFile(originalFile);
           }
   
           Execute exe = new Execute(new LogStreamHandler(this, Project.MSG_INFO,
                                                          Project.MSG_WARN), 
                                     null);
  -        exe.setCommandline(cmd.getCommandline());
  +        exe.setCommandline(toExecute.getCommandline());
           try {
               exe.execute();
           } catch (IOException e) {
  
  
  
  1.10      +8 -0      jakarta-ant/src/main/org/apache/tools/ant/types/Commandline.java
  
  Index: Commandline.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/Commandline.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Commandline.java	2000/08/10 08:42:29	1.9
  +++ Commandline.java	2000/09/04 15:19:17	1.10
  @@ -327,4 +327,12 @@
           return c;
       }
   
  +    /**
  +     * Clear out the whole command line.
  +     */
  +    public void clear() {
  +        executable = null;
  +        arguments.removeAllElements();
  +    }
  +
   }
  
  
  

Mime
View raw message