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 Environment.java
Date Thu, 03 Aug 2000 11:25:15 GMT
bodewig     00/08/03 04:25:14

  Modified:    .        build.xml
               src/main/org/apache/tools/ant/taskdefs Cvs.java
                        ExecuteOn.java Javadoc.java Patch.java
               src/main/org/apache/tools/ant/taskdefs/optional Cab.java
               src/main/org/apache/tools/ant/taskdefs/optional/junit
                        JUnitTask.java
               src/main/org/apache/tools/ant/types Commandline.java
                        Environment.java
  Log:
  Did some cleanup.
  
  Revision  Changes    Path
  1.55      +1 -1      jakarta-ant/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/build.xml,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- build.xml	2000/08/03 10:12:02	1.54
  +++ build.xml	2000/08/03 11:25:11	1.55
  @@ -250,7 +250,7 @@
   
     <target name="get.snapshot">
       <get src="http://jakarta.apache.org/build/tmp/ant/ant.src.zip" dest="ant-src.zip"
/>
  -    <expand src="ant-src.zip" dest="." />
  +    <unzip src="ant-src.zip" dest="." />
     </target>
   
     <target name="make.snapshot">
  
  
  
  1.9       +11 -11    jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Cvs.java
  
  Index: Cvs.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Cvs.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Cvs.java	2000/07/31 16:21:55	1.8
  +++ Cvs.java	2000/08/03 11:25:11	1.9
  @@ -88,20 +88,20 @@
   
           toExecute.setExecutable("cvs");
           if (cvsRoot != null) { 
  -            toExecute.addValue("-d");
  -            toExecute.addValue(cvsRoot);
  +            toExecute.createArgument().setValue("-d");
  +            toExecute.createArgument().setValue(cvsRoot);
           }
           if (noexec) {
  -            toExecute.addValue("-n");
  +            toExecute.createArgument().setValue("-n");
           }
           if (quiet) {
  -            toExecute.addValue("-q");
  +            toExecute.createArgument().setValue("-q");
           }
  -        toExecute.addValue(command);
  -        toExecute.addLine(cmd.getCommandline());
  +        toExecute.createArgument().setValue(command);
  +        toExecute.addArguments(cmd.getCommandline());
   
   	if (pack != null) {
  -            toExecute.addValue(pack);
  +            toExecute.createArgument().setValue(pack);
   	}
   
           Execute exe = new Execute(new LogStreamHandler(this, Project.MSG_INFO,
  @@ -141,16 +141,16 @@
       public void setTag(String p) { 
           // Check if not real tag => set it to null 
           if (p != null && p.trim().length() > 0) {
  -            cmd.addValue("-r");
  -            cmd.addValue(p);
  +            cmd.createArgument().setValue("-r");
  +            cmd.createArgument().setValue(p);
           }
       } 
   
       
       public void setDate(String p) {
           if(p != null && p.trim().length() > 0) {
  -            cmd.addValue("-D");
  -            cmd.addValue(p);
  +            cmd.createArgument().setValue("-D");
  +            cmd.createArgument().setValue(p);
           }
       }
   
  
  
  
  1.6       +1 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
  
  Index: ExecuteOn.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ExecuteOn.java	2000/08/02 12:06:22	1.5
  +++ ExecuteOn.java	2000/08/03 11:25:11	1.6
  @@ -135,7 +135,7 @@
               String myos = System.getProperty("os.name");
   
               if (parallel) {
  -                cmdl.addLine(s);
  +                cmdl.addArguments(s);
                   exe.setCommandline(cmdl.getCommandline());
                   err = exe.execute();
                   if (err != 0) {
  
  
  
  1.22      +9 -9      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.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- Javadoc.java	2000/08/01 13:47:02	1.21
  +++ Javadoc.java	2000/08/03 11:25:11	1.22
  @@ -223,7 +223,7 @@
       }
       public void setDestdir(File dir) {
           cmd.createArgument().setValue("-d");
  -        cmd.createArgument().setValue(dir.getAbsolutePath());
  +        cmd.createArgument().setFile(dir);
           destDir = dir;
       }
       public void setSourcefiles(String src) {
  @@ -235,7 +235,7 @@
       public void setOverview(File f) {
           if (!javadoc1) {
               cmd.createArgument().setValue("-overview");
  -            cmd.createArgument().setValue(f.getAbsolutePath());
  +            cmd.createArgument().setFile(f);
           }
       }
       public void setPublic(boolean b) {
  @@ -400,13 +400,13 @@
       public void setStylesheetfile(File f) {
           if (!javadoc1) {
               cmd.createArgument().setValue("-stylesheetfile");
  -            cmd.createArgument().setValue(f.getAbsolutePath());
  +            cmd.createArgument().setFile(f);
           }
       }
       public void setHelpfile(File f) {
           if (!javadoc1) {
               cmd.createArgument().setValue("-helpfile");
  -            cmd.createArgument().setValue(f.getAbsolutePath());
  +            cmd.createArgument().setFile(f);
           }
       }
       public void setDocencoding(String enc) {
  @@ -517,10 +517,10 @@
   
           if ( (!javadoc1) || (sourcePath == null) ) {
               cmd.createArgument().setValue("-classpath");
  -            cmd.createArgument().setValue(classpath.toString());
  +            cmd.createArgument().setPath(classpath);
               if (sourcePath != null) {
                   cmd.createArgument().setValue("-sourcepath");
  -                cmd.createArgument().setValue(sourcePath.toString());
  +                cmd.createArgument().setPath(sourcePath);
               }
           } else {
               cmd.createArgument().setValue("-classpath");
  @@ -547,7 +547,7 @@
                       cmd.createArgument().setValue(doclet.getName());
                       if (doclet.getPath() != null) {
                           cmd.createArgument().setValue("-docletpath");
  -                        cmd.createArgument().setValue(doclet.getPath().toString());
  +                        cmd.createArgument().setPath(doclet.getPath());
                       }
                       for (Enumeration e = doclet.getParams(); e.hasMoreElements();) {
                           DocletParam param = (DocletParam)e.nextElement();
  @@ -564,7 +564,7 @@
               } 
               if (bootclasspath != null) {
                   cmd.createArgument().setValue("-bootclasspath");
  -                cmd.createArgument().setValue(bootclasspath.toString());
  +                cmd.createArgument().setPath(bootclasspath);
               }
               
               // add the links arguments
  @@ -573,7 +573,7 @@
                       LinkArgument la = (LinkArgument)e.nextElement();
                   
                       if (la.getHref() == null) {
  -                        throw new BuildException("Links must provide the RUL to the external
class documentation.");
  +                        throw new BuildException("Links must provide the URL to the external
class documentation.");
                       }
                   
                       if (la.isLinkOffline()) {
  
  
  
  1.5       +8 -8      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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Patch.java	2000/07/31 16:21:56	1.4
  +++ Patch.java	2000/08/03 11:25:12	1.5
  @@ -85,8 +85,8 @@
               throw new BuildException("patchfile "+file+" doesn\'t exist", 
                                        location);
           }
  -        cmd.addValue("-i");
  -        cmd.addValue(file.getAbsolutePath());
  +        cmd.createArgument().setValue("-i");
  +        cmd.createArgument().setFile(file);
           havePatchfile = true;
       }
   
  @@ -95,7 +95,7 @@
        */
       public void setBackups(boolean backups) {
           if (backups) {
  -            cmd.addValue("-b");
  +            cmd.createArgument().setValue("-b");
           }
       }
   
  @@ -104,7 +104,7 @@
        */
       public void setIgnorewhitespace(boolean ignore) {
           if (ignore) {
  -            cmd.addValue("-l");
  +            cmd.createArgument().setValue("-l");
           }
       }
   
  @@ -118,7 +118,7 @@
           if (num < 0) {
               throw new BuildException("strip has to be >= 0", location);
           }
  -        cmd.addValue("-p"+num);
  +        cmd.createArgument().setValue("-p"+num);
       }
   
       /**
  @@ -126,7 +126,7 @@
        */
       public void setQuiet(boolean q) {
           if (q) {
  -            cmd.addValue("-s");
  +            cmd.createArgument().setValue("-s");
           }
       }
   
  @@ -135,7 +135,7 @@
        */
       public void setReverse(boolean r) {
           if (r) {
  -            cmd.addValue("-R");
  +            cmd.createArgument().setValue("-R");
           }
       }
   
  @@ -148,7 +148,7 @@
           cmd.setExecutable("patch");
   
           if (originalFile != null) {
  -            cmd.addValue(originalFile.getAbsolutePath());
  +            cmd.createArgument().setFile(originalFile);
           }
   
           Execute exe = new Execute(new LogStreamHandler(this, Project.MSG_INFO,
  
  
  
  1.2       +8 -8      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java
  
  Index: Cab.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Cab.java	2000/08/03 10:12:15	1.1
  +++ Cab.java	2000/08/03 11:25:12	1.2
  @@ -194,23 +194,23 @@
       {
           Commandline command = new Commandline();
           command.setExecutable("cabarc");
  -        command.addValue("-r");
  -        command.addValue("-p");
  +        command.createArgument().setValue("-r");
  +        command.createArgument().setValue("-p");
   
           if (!doCompress)
           {
  -            command.addValue("-m");
  -            command.addValue("none");
  +            command.createArgument().setValue("-m");
  +            command.createArgument().setValue("none");
           }
   
           if (cmdOptions != null)
           {
  -            command.addValue(cmdOptions);
  +            command.createArgument().setValue(cmdOptions);
           }
           
  -        command.addValue("n");
  -        command.addValue(cabFile.getAbsolutePath());
  -        command.addValue("@" + listFile.getAbsolutePath());
  +        command.createArgument().setValue("n");
  +        command.createArgument().setFile(cabFile);
  +        command.createArgument().setValue("@" + listFile.getAbsolutePath());
   
           return command;
       }
  
  
  
  1.4       +2 -2      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JUnitTask.java	2000/08/02 09:24:23	1.3
  +++ JUnitTask.java	2000/08/03 11:25:13	1.4
  @@ -224,8 +224,8 @@
   		    // Create a watchdog based on the timeout attribute
                       final Execute execute = new Execute(new PumpStreamHandler(), createWatchdog());
                       final Commandline cmdl = new Commandline();
  -                    cmdl.addLine(commandline.getCommandline());
  -                    cmdl.addLine(test.getCommandline());
  +                    cmdl.addArguments(commandline.getCommandline());
  +                    cmdl.addArguments(test.getCommandline());
                       execute.setCommandline(cmdl.getCommandline());
                       log("Execute JUnit: " + cmdl, Project.MSG_VERBOSE);
                       exitValue = execute.execute();
  
  
  
  1.2       +52 -20    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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Commandline.java	2000/07/19 13:00:41	1.1
  +++ Commandline.java	2000/08/03 11:25:14	1.2
  @@ -55,6 +55,7 @@
   package org.apache.tools.ant.types;
   
   import org.apache.tools.ant.BuildException;
  +import java.io.File;
   import java.util.Vector;
   import java.util.StringTokenizer;
   
  @@ -93,7 +94,7 @@
           if (tmp != null && tmp.length > 0) {
               setExecutable(tmp[0]);
               for (int i=1; i<tmp.length; i++) {
  -                addValue(tmp[i]);
  +                createArgument().setValue(tmp[i]);
               }
           }
       }
  @@ -107,13 +108,16 @@
        */
       public class Argument {
   
  +        private String[] parts;
  +        private Reference pathRef;
  +
           /**
            * Sets a single commandline argument.
            *
            * @param value a single commandline argument.
            */
           public void setValue(String value) {
  -            Commandline.this.addValue(value);
  +            parts = new String[] {value};
           }
   
           /**
  @@ -122,7 +126,35 @@
            * @param line line to split into several commandline arguments
            */
           public void setLine(String line) {
  -            Commandline.this.addLine(translateCommandline(line));
  +            parts = translateCommandline(line);
  +        }
  +
  +        /**
  +         * Sets a single commandline argument and treats it like a
  +         * PATH - ensures the right separator for the local platform
  +         * is used.
  +         *
  +         * @param value a single commandline argument.  
  +         */
  +        public void setPath(Path value) {
  +            parts = new String[] {value.toString()};
  +        }
  +
  +        /**
  +         * Sets a single commandline argument to the absolute filename
  +         * of the given file.  
  +         *
  +         * @param value a single commandline argument.  
  +         */
  +        public void setFile(File value) {
  +            parts = new String[] {value.getAbsolutePath()};
  +        }
  +
  +        /**
  +         * Returns the parts this Argument consists of.
  +         */
  +        public String[] getParts() {
  +            return parts;
           }
       }
   
  @@ -133,9 +165,8 @@
        * @return the argument object.
        */
       public Argument createArgument() {
  -        if (argument == null) {
  -            argument = new Argument();
  -        }
  +        Argument argument = new Argument();
  +        definition.addElement(argument);
           return argument;
       }
   
  @@ -153,26 +184,19 @@
           return executable;
       }
   
  -
  -    public void addValue(String value) {
  -        if (value == null || value.length() == 0) return;
  -        definition.addElement(value);
  -    }
  -
   
  -    public void addLine(String[] line) {
  +    public void addArguments(String[] line) {
           for (int i=0; i < line.length; i++) {
               createArgument().setValue(line[i]);
           }
       }
   
  -
       /**
        * Returns the executable and all defined arguments.
        */
       public String[] getCommandline() {
  -        if (executable == null) return getArguments();
           final String[] args = getArguments();
  +        if (executable == null) return args;
           final String[] result = new String[args.length+1];
           result[0] = executable;
           System.arraycopy(args, 0, result, 1, args.length);
  @@ -185,10 +209,18 @@
        * <code>addValue</code> or the argument object.
        */
       public String[] getArguments() {
  -        final String [] result;
  -        result = new String[definition.size()];
  -        definition.copyInto(result);
  -        return result;
  +        Vector result = new Vector(definition.size()*2);
  +        for (int i=0; i<definition.size(); i++) {
  +            Argument arg = (Argument) definition.elementAt(i);
  +            String[] s = arg.getParts();
  +            for (int j=0; j<s.length; j++) {
  +                result.addElement(s[j]);
  +            }
  +        }
  +        
  +        String [] res = new String[result.size()];
  +        result.copyInto(res);
  +        return res;
       }
   
   
  @@ -294,7 +326,7 @@
       }
   
       public int size() {
  -        return definition.size() + (executable == null ? 0 : 1);
  +        return getCommandline().length;
       }
   
   }
  
  
  
  1.3       +4 -0      jakarta-ant/src/main/org/apache/tools/ant/types/Environment.java
  
  Index: Environment.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/Environment.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Environment.java	2000/07/25 14:08:33	1.2
  +++ Environment.java	2000/08/03 11:25:14	1.3
  @@ -85,6 +85,10 @@
               this.value = path.toString();
           }
   
  +        public void setFile(java.io.File file) {
  +            this.value = file.getAbsolutePath();
  +        }
  +
           public String getContent() throws BuildException {
               if (key == null || value == null) {
                   throw new BuildException("key and value must be specified for environment
variables.");
  
  
  

Mime
View raw message