ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/types Commandline.java CommandlineJava.java
Date Thu, 25 Apr 2002 12:14:51 GMT
bodewig     02/04/25 05:14:51

  Modified:    src/main/org/apache/tools/ant DefaultLogger.java
               src/main/org/apache/tools/ant/taskdefs AbstractCvsTask.java
                        ExecTask.java Execute.java ExecuteOn.java Java.java
                        Javadoc.java
               src/main/org/apache/tools/ant/taskdefs/compilers
                        DefaultCompilerAdapter.java
               src/main/org/apache/tools/ant/taskdefs/optional ANTLR.java
                        Javah.java Rpm.java
               src/main/org/apache/tools/ant/taskdefs/optional/ccm
                        CCMCreateTask.java
               src/main/org/apache/tools/ant/taskdefs/optional/clearcase
                        CCUpdate.java
               src/main/org/apache/tools/ant/taskdefs/optional/dotnet
                        NetCommand.java
               src/main/org/apache/tools/ant/taskdefs/optional/ejb
                        BorlandDeploymentTool.java
               src/main/org/apache/tools/ant/taskdefs/optional/javacc
                        JJTree.java
               src/main/org/apache/tools/ant/taskdefs/optional/jdepend
                        JDependTask.java
               src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers
                        DefaultJspCompilerAdapter.java
               src/main/org/apache/tools/ant/taskdefs/optional/junit
                        JUnitTask.java
               src/main/org/apache/tools/ant/taskdefs/optional/metamata
                        AbstractMetamataTask.java MParse.java
               src/main/org/apache/tools/ant/taskdefs/optional/perforce
                        P4Base.java
               src/main/org/apache/tools/ant/taskdefs/optional/pvcs
                        Pvcs.java
               src/main/org/apache/tools/ant/taskdefs/optional/sitraka
                        CovMerge.java CovReport.java Coverage.java
               src/main/org/apache/tools/ant/taskdefs/rmic
                        DefaultRmicAdapter.java
               src/main/org/apache/tools/ant/types Commandline.java
                        CommandlineJava.java
  Log:
  Don't tell people we'd execute a given command line when we really do
  something completely different.
  
  I hope this will cut down the "Ant swallows my quotes" reports to
  those that are real problems in Ant and not just problems of
  communication.
  
  Revision  Changes    Path
  1.37      +22 -8     jakarta-ant/src/main/org/apache/tools/ant/DefaultLogger.java
  
  Index: DefaultLogger.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/DefaultLogger.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- DefaultLogger.java	12 Apr 2002 09:35:39 -0000	1.36
  +++ DefaultLogger.java	25 Apr 2002 12:14:49 -0000	1.37
  @@ -55,6 +55,7 @@
   package org.apache.tools.ant;
   
   import java.io.PrintStream;
  +import java.util.StringTokenizer;
   
   import org.apache.tools.ant.util.StringUtils;
   import org.apache.tools.ant.util.DateUtils;
  @@ -248,21 +249,34 @@
           if (priority <= msgOutputLevel) {
   
               StringBuffer message = new StringBuffer();
  -            // Print out the name of the task if we're in one
  -            if (event.getTask() != null) {
  +            if (event.getTask() != null && !emacsMode) {
  +                // Print out the name of the task if we're in one
                   String name = event.getTask().getTaskName();
  +                String label = "[" + name + "] ";
  +                int size = LEFT_COLUMN_SIZE - label.length();
  +                StringBuffer tmp = new StringBuffer(size);
  +                for (int i = 0; i < size; i++) {
  +                    tmp.append(" ");
  +                }
  +                tmp.append(label);
  +                label = tmp.toString();
   
  -                if (!emacsMode) {
  -                    String label = "[" + name + "] ";
  -                    int size = LEFT_COLUMN_SIZE - label.length();
  -                    for (int i = 0; i < size; i++) {
  -                        message.append(" ");
  +                StringTokenizer tok = new StringTokenizer(event.getMessage(),
  +                                                          "\r\n", false);
  +                boolean first = true;
  +                while (tok.hasMoreTokens()) {
  +                    if (!first) {
  +                        message.append(StringUtils.LINE_SEP);
                       }
  +                    first = false;
                       message.append(label);
  +                    message.append(tok.nextToken());
                   }
  +
  +            } else {
  +                message.append(event.getMessage());
               }
   
  -            message.append(event.getMessage());
               String msg = message.toString();
               if (priority != Project.MSG_ERR) {
                   printMessage(msg, out, priority);
  
  
  
  1.12      +4 -9      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java
  
  Index: AbstractCvsTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- AbstractCvsTask.java	16 Apr 2002 07:15:18 -0000	1.11
  +++ AbstractCvsTask.java	25 Apr 2002 12:14:49 -0000	1.12
  @@ -321,8 +321,7 @@
   
           try {
               String actualCommandLine = executeToString(exe);
  -            log("running cvs command: " + actualCommandLine, 
  -                Project.MSG_DEBUG);
  +            log(actualCommandLine, Project.MSG_VERBOSE);
               int retCode = exe.execute();
               log("retCode=" + retCode, Project.MSG_DEBUG);
               /*Throw an exception if cvs exited with error. (Iulian)*/
  @@ -400,13 +399,9 @@
   
       private String executeToString(Execute execute){
   
  -        StringBuffer stringBuffer = new StringBuffer(250);
  -        String[] commandLine = execute.getCommandline();
  -        for (int i = 0; i < commandLine.length; i++){
  -
  -            stringBuffer.append(commandLine[i]);
  -            stringBuffer.append(" ");
  -        }
  +        StringBuffer stringBuffer = 
  +            new StringBuffer(Commandline.describeCommand(execute
  +                                                         .getCommandline()));
   
           String newLine = StringUtils.LINE_SEP;
           String[] variableArray = execute.getEnvironment();
  
  
  
  1.36      +3 -3      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/ExecTask.java
  
  Index: ExecTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/ExecTask.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- ExecTask.java	14 Apr 2002 11:16:12 -0000	1.35
  +++ ExecTask.java	25 Apr 2002 12:14:49 -0000	1.36
  @@ -303,9 +303,6 @@
           if (dir == null) {
               dir = project.getBaseDir();
           }
  -        // show the command
  -        log(cmdl.toString(), Project.MSG_VERBOSE);
  -
           Execute exe = new Execute(createHandler(), createWatchdog());
           exe.setAntRun(getProject());
           exe.setWorkingDirectory(dir);
  @@ -363,6 +360,9 @@
        * overidden by subclasses
        */
       protected void runExec(Execute exe) throws BuildException {
  +        // show the command
  +        log(cmdl.describeCommand(), Project.MSG_VERBOSE);
  +
           exe.setCommandline(cmdl.getCommandline());
           try {
               runExecute(exe);
  
  
  
  1.43      +9 -6      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Execute.java
  
  Index: Execute.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Execute.java,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- Execute.java	15 Apr 2002 15:33:08 -0000	1.42
  +++ Execute.java	25 Apr 2002 12:14:49 -0000	1.43
  @@ -63,7 +63,6 @@
   import java.io.File;
   import java.io.IOException;
   
  -
   import java.io.BufferedReader;
   import java.io.StringReader;
   import java.io.ByteArrayOutputStream;
  @@ -79,7 +78,7 @@
    *
    * @since Ant 1.2
    *
  - * @version $Revision: 1.42 $
  + * @version $Revision: 1.43 $
    */
   public class Execute {
   
  @@ -507,7 +506,8 @@
       public static void runCommand(Task task, String[] cmdline) 
           throws BuildException {
           try {
  -            task.log(Commandline.toString(cmdline), Project.MSG_VERBOSE);
  +            task.log(Commandline.describeCommand(cmdline), 
  +                     Project.MSG_VERBOSE);
               Execute exe = new Execute(new LogStreamHandler(task,
                                                              Project.MSG_INFO,
                                                              Project.MSG_ERR));
  @@ -542,7 +542,8 @@
                throws IOException {
               if (project != null) {
                   project.log("Execute:CommandLauncher: " +
  -                            Commandline.toString(cmd), Project.MSG_DEBUG);
  +                            Commandline.describeCommand(cmd), 
  +                            Project.MSG_DEBUG);
               }
               return Runtime.getRuntime().exec(cmd, env);
           }
  @@ -588,7 +589,8 @@
               }
               if (project != null) {
                   project.log("Execute:Java11CommandLauncher: " +
  -                            Commandline.toString(newcmd), Project.MSG_DEBUG);
  +                            Commandline.describeCommand(newcmd),
  +                            Project.MSG_DEBUG);
               }
               return Runtime.getRuntime().exec(newcmd, env);
           }
  @@ -615,7 +617,8 @@
               try {
                   if (project != null) {
                       project.log("Execute:Java13CommandLauncher: " +
  -                                Commandline.toString(cmd), Project.MSG_DEBUG);
  +                                Commandline.describeCommand(cmd),
  +                                Project.MSG_DEBUG);
                   }
                   Object[] arguments = { cmd, env, workingDir };
                   return (Process) _execWithCWD.invoke(Runtime.getRuntime(), 
  
  
  
  1.30      +2 -3      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.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- ExecuteOn.java	16 Apr 2002 10:36:25 -0000	1.29
  +++ ExecuteOn.java	25 Apr 2002 12:14:49 -0000	1.30
  @@ -240,7 +240,7 @@
                       fileNames.copyInto(s);
                       for (int j = 0; j < s.length; j++) {
                           String[] command = getCommandline(s[j], base);
  -                        log("Executing " + Commandline.toString(command), 
  +                        log(Commandline.describeCommand(command), 
                               Project.MSG_VERBOSE);
                           exe.setCommandline(command);
                           runExecute(exe);
  @@ -256,8 +256,7 @@
                   File[] b = new File[baseDirs.size()];
                   baseDirs.copyInto(b);
                   String[] command = getCommandline(s, b);
  -                log("Executing " + Commandline.toString(command), 
  -                    Project.MSG_VERBOSE);
  +                log(Commandline.describeCommand(command), Project.MSG_VERBOSE);
                   exe.setCommandline(command);
                   runExecute(exe);
               }
  
  
  
  1.45      +2 -2      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Java.java
  
  Index: Java.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Java.java,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- Java.java	18 Apr 2002 06:54:54 -0000	1.44
  +++ Java.java	25 Apr 2002 12:14:49 -0000	1.45
  @@ -135,7 +135,7 @@
           }
   
           if (fork) {
  -            log("Forking " + cmdl.toString(), Project.MSG_VERBOSE);
  +            log(cmdl.describeCommand(), Project.MSG_VERBOSE);
           } else {
               if (cmdl.getVmCommand().size() > 1) {
                   log("JVM args ignored when same JVM is used.", 
  @@ -151,7 +151,7 @@
                       + "JVM is used.", Project.MSG_WARN);
               }
   
  -            log("Running in same VM " + cmdl.getJavaCommand().toString(), 
  +            log("Running in same VM " + cmdl.describeJavaCommand(), 
                   Project.MSG_VERBOSE);
           }
           
  
  
  
  1.94      +1 -1      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.93
  retrieving revision 1.94
  diff -u -r1.93 -r1.94
  --- Javadoc.java	18 Apr 2002 06:54:54 -0000	1.93
  +++ Javadoc.java	25 Apr 2002 12:14:49 -0000	1.94
  @@ -1687,7 +1687,7 @@
           if (packageList != null) {
               toExecute.createArgument().setValue("@" + packageList);
           }
  -        log("Javadoc args: " + toExecute, Project.MSG_VERBOSE);
  +        log(toExecute.describeCommand(), Project.MSG_VERBOSE);
   
           log("Javadoc execution", Project.MSG_INFO);
   
  
  
  
  1.28      +2 -2      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
  
  Index: DefaultCompilerAdapter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- DefaultCompilerAdapter.java	19 Apr 2002 12:12:57 -0000	1.27
  +++ DefaultCompilerAdapter.java	25 Apr 2002 12:14:49 -0000	1.28
  @@ -374,8 +374,8 @@
        * &qout;niceSourceList&quot;
        */
       protected void logAndAddFilesToCompile(Commandline cmd) {
  -        attributes.log("Compilation args: " + cmd.toString(),
  -            Project.MSG_VERBOSE);
  +        attributes.log("Compilation " + cmd.describeArguments(),
  +                       Project.MSG_VERBOSE);
   
           StringBuffer niceSourceList = new StringBuffer("File");
           if (compileList.length != 1) {
  
  
  
  1.10      +2 -2      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java
  
  Index: ANTLR.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ANTLR.java	28 Jan 2002 03:53:35 -0000	1.9
  +++ ANTLR.java	25 Apr 2002 12:14:50 -0000	1.10
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2000-2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 2000-2002 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -188,7 +188,7 @@
               commandline.createArgument().setValue(outputDirectory.toString());
               commandline.createArgument().setValue(target.toString());
   
  -            log("Forking " + commandline.toString(), Project.MSG_VERBOSE);
  +            log(commandline.describeCommand(), Project.MSG_VERBOSE);
               int err = run(commandline.getCommandline());
               if (err == 1) {
                   throw new BuildException("ANTLR returned: " + err, location);
  
  
  
  1.15      +1 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java
  
  Index: Javah.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Javah.java	23 Apr 2002 08:15:51 -0000	1.14
  +++ Javah.java	25 Apr 2002 12:14:50 -0000	1.15
  @@ -390,7 +390,7 @@
        */
       protected void logAndAddFilesToCompile(Commandline cmd) {
           int n = 0;
  -        log("Compilation args: " + cmd.toString(),
  +        log("Compilation " + cmd.describeArguments(),
               Project.MSG_VERBOSE);
   
           StringBuffer niceClassList = new StringBuffer();
  
  
  
  1.8       +1 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java
  
  Index: Rpm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Rpm.java	15 Apr 2002 13:36:19 -0000	1.7
  +++ Rpm.java	25 Apr 2002 12:14:50 -0000	1.8
  @@ -171,7 +171,7 @@
   
           exe.setAntRun(project);
           if (topDir == null) {
  -          topDir = project.getBaseDir();
  +            topDir = project.getBaseDir();
           }
           exe.setWorkingDirectory(topDir);
   
  
  
  
  1.9       +1 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCreateTask.java
  
  Index: CCMCreateTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCreateTask.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- CCMCreateTask.java	15 Apr 2002 14:56:31 -0000	1.8
  +++ CCMCreateTask.java	25 Apr 2002 12:14:50 -0000	1.9
  @@ -119,7 +119,7 @@
           commandLine2.createArgument().setValue(COMMAND_DEFAULT_TASK);
           commandLine2.createArgument().setValue(getTask());
   
  -        log(commandLine.toString(), Project.MSG_DEBUG);
  +        log(commandLine.describeCommand(), Project.MSG_DEBUG);
   
           result = run(commandLine2);
           if (result != 0) {
  
  
  
  1.6       +7 -7      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCUpdate.java
  
  Index: CCUpdate.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCUpdate.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- CCUpdate.java	15 Apr 2002 14:56:31 -0000	1.5
  +++ CCUpdate.java	25 Apr 2002 12:14:50 -0000	1.6
  @@ -323,31 +323,31 @@
           }
       }
   
  -        /**
  +    /**
        *  -graphical flag -- display graphical dialog during update operation
        */
       public static final String FLAG_GRAPHICAL = "-graphical";
  -        /**
  +    /**
        * -log flag -- file to log status to
        */
       public static final String FLAG_LOG = "-log";
  -        /**
  +    /**
        * -overwrite flag -- overwrite hijacked files
        */
       public static final String FLAG_OVERWRITE = "-overwrite";
  -        /**
  +    /**
        * -noverwrite flag -- do not overwrite hijacked files
        */
       public static final String FLAG_NOVERWRITE = "-noverwrite";
  -        /**
  +    /**
        * -rename flag -- rename hijacked files with .keep extension
        */
       public static final String FLAG_RENAME = "-rename";
  -        /**
  +    /**
        * -ctime flag -- modified time is written as the current time
        */
       public static final String FLAG_CURRENTTIME = "-ctime";
  -        /**
  +    /**
        * -ptime flag -- modified time is written as the VOB time
        */
       public static final String FLAG_PRESERVETIME = "-ptime";
  
  
  
  1.15      +2 -2      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java
  
  Index: NetCommand.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- NetCommand.java	14 Apr 2002 11:16:17 -0000	1.14
  +++ NetCommand.java	25 Apr 2002 12:14:50 -0000	1.15
  @@ -242,10 +242,10 @@
           // assume the worst
           try {
               if (traceCommandLine) {
  -                owner.log(commandLine.toString());
  +                owner.log(commandLine.describeCommand());
               } else {
                   //in verbose mode we always log stuff
  -                logVerbose(commandLine.toString());
  +                logVerbose(commandLine.describeCommand());
               }
               executable.setCommandline(commandLine.getCommandline());
               err = executable.execute();
  
  
  
  1.16      +1 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java
  
  Index: BorlandDeploymentTool.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- BorlandDeploymentTool.java	15 Apr 2002 14:56:31 -0000	1.15
  +++ BorlandDeploymentTool.java	25 Apr 2002 12:14:50 -0000	1.16
  @@ -351,7 +351,7 @@
   
           try {
               log("Calling java2iiop", Project.MSG_VERBOSE);                       
  -            log(commandline.toString(), Project.MSG_DEBUG);
  +            log(commandline.describeCommand(), Project.MSG_DEBUG);
               execTask.setCommandline(commandline.getCommandline());
               int result = execTask.execute();
               if (result != 0) {
  
  
  
  1.13      +1 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java
  
  Index: JJTree.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- JJTree.java	15 Apr 2002 14:56:32 -0000	1.12
  +++ JJTree.java	25 Apr 2002 12:14:50 -0000	1.13
  @@ -212,7 +212,7 @@
                                                Project.MSG_INFO,
                                                Project.MSG_INFO),
                           null);
  -        log(cmdl.toString(), Project.MSG_VERBOSE);
  +        log(cmdl.describeCommand(), Project.MSG_VERBOSE);
           process.setCommandline(cmdl.getCommandline());
   
           try {
  
  
  
  1.12      +1 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java
  
  Index: JDependTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- JDependTask.java	15 Apr 2002 14:56:32 -0000	1.11
  +++ JDependTask.java	25 Apr 2002 12:14:50 -0000	1.12
  @@ -410,7 +410,7 @@
           if (getOutputFile() != null) {
               log("Output to be stored in " + getOutputFile().getPath());
           }
  -        log("Executing: " + commandline.toString(), Project.MSG_VERBOSE);
  +        log(commandline.describeCommand(), Project.MSG_VERBOSE);
           try {
               return execute.execute();
           } catch (IOException e) {
  
  
  
  1.4       +2 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultJspCompilerAdapter.java
  
  Index: DefaultJspCompilerAdapter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultJspCompilerAdapter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultJspCompilerAdapter.java	15 Apr 2002 13:36:21 -0000	1.3
  +++ DefaultJspCompilerAdapter.java	25 Apr 2002 12:14:50 -0000	1.4
  @@ -84,7 +84,8 @@
       protected void logAndAddFilesToCompile(JspC jspc,
                                              Vector compileList,
                                              Commandline cmd) {
  -        jspc.log("Compilation args: " + cmd.toString(), Project.MSG_VERBOSE);
  +        jspc.log("Compilation " + cmd.describeArguments(), 
  +                 Project.MSG_VERBOSE);
   
           StringBuffer niceSourceList = new StringBuffer("File");
           if (compileList.size() != 1) {
  
  
  
  1.44      +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.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- JUnitTask.java	18 Apr 2002 09:49:54 -0000	1.43
  +++ JUnitTask.java	25 Apr 2002 12:14:50 -0000	1.44
  @@ -146,7 +146,7 @@
    * @author <a href="mailto:Gerrit.Riessen@web.de">Gerrit Riessen</a>
    * @author <a href="mailto:ehatcher@apache.org">Erik Hatcher</a>
    *
  - * @version $Revision: 1.43 $
  + * @version $Revision: 1.44 $
    *
    * @since Ant 1.2
    *
  @@ -667,7 +667,7 @@
           execute.setNewenvironment(newEnvironment);
           execute.setEnvironment(environment);
   
  -        log("Executing: " + cmd.toString(), Project.MSG_VERBOSE);
  +        log(cmd.describeCommand(), Project.MSG_VERBOSE);
           int retVal;
           try {
               retVal = execute.execute();
  
  
  
  1.7       +1 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java
  
  Index: AbstractMetamataTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AbstractMetamataTask.java	23 Apr 2002 08:15:51 -0000	1.6
  +++ AbstractMetamataTask.java	25 Apr 2002 12:14:50 -0000	1.7
  @@ -212,7 +212,7 @@
       /** execute the process with a specific handler */
       protected void execute0(ExecuteStreamHandler handler) throws BuildException {
           final Execute process = new Execute(handler);
  -        log(cmdl.toString(), Project.MSG_VERBOSE);
  +        log(cmdl.describeCommand(), Project.MSG_VERBOSE);
           process.setCommandline(cmdl.getCommandline());
           try {
               if (process.execute() != 0) {
  
  
  
  1.11      +1 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java
  
  Index: MParse.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- MParse.java	23 Apr 2002 08:15:51 -0000	1.10
  +++ MParse.java	25 Apr 2002 12:14:50 -0000	1.11
  @@ -212,7 +212,7 @@
           }
           
           final Execute process = new Execute(handler);
  -        log(cmdl.toString(), Project.MSG_VERBOSE);
  +        log(cmdl.describeCommand(), Project.MSG_VERBOSE);
           process.setCommandline(cmdl.getCommandline());
           try {
               if (process.execute() != 0) {
  
  
  
  1.14      +1 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java
  
  Index: P4Base.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- P4Base.java	12 Apr 2002 13:26:52 -0000	1.13
  +++ P4Base.java	25 Apr 2002 12:14:51 -0000	1.14
  @@ -188,7 +188,7 @@
                   cmdl += cmdline[i] + " ";
               }
   
  -            log("Execing " + cmdl, Project.MSG_VERBOSE);
  +            log(cmdl.describeCommand(), Project.MSG_VERBOSE);
   
               if (handler == null) {
                   handler = new SimpleP4OutputHandler(this);
  
  
  
  1.14      +1 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java
  
  Index: Pvcs.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Pvcs.java	15 Apr 2002 14:56:33 -0000	1.13
  +++ Pvcs.java	25 Apr 2002 12:14:51 -0000	1.14
  @@ -208,7 +208,7 @@
               Random rand = new Random(System.currentTimeMillis());
               tmp = new File("pvcs_ant_" + rand.nextLong() + ".log");
               tmp2 = new File("pvcs_ant_" + rand.nextLong() + ".log");
  -            log("Executing " + commandLine.toString(), Project.MSG_VERBOSE);
  +            log(commandLine.describeCommand(), Project.MSG_VERBOSE);
               result = runCmd(commandLine, 
                   new PumpStreamHandler(new FileOutputStream(tmp), 
                   new LogOutputStream(this, Project.MSG_WARN)));
  
  
  
  1.10      +1 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java
  
  Index: CovMerge.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- CovMerge.java	3 Mar 2002 01:46:23 -0000	1.9
  +++ CovMerge.java	25 Apr 2002 12:14:51 -0000	1.10
  @@ -135,7 +135,7 @@
   
               LogStreamHandler handler = new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN);
               Execute exec = new Execute(handler);
  -            log(cmdl.toString(), Project.MSG_VERBOSE);
  +            log(cmdl.describeCommand(), Project.MSG_VERBOSE);
               exec.setCommandline(cmdl.getCommandline());
   
               // JProbe process always return 0 so  we will not be
  
  
  
  1.11      +1 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java
  
  Index: CovReport.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- CovReport.java	3 Mar 2002 01:46:23 -0000	1.10
  +++ CovReport.java	25 Apr 2002 12:14:51 -0000	1.11
  @@ -285,7 +285,7 @@
               // use the custom handler for stdin issues
               LogStreamHandler handler = new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN);
               Execute exec = new Execute(handler);
  -            log(cmdl.toString(), Project.MSG_VERBOSE);
  +            log(cmdl.describeCommand(), Project.MSG_VERBOSE);
               exec.setCommandline(cmdl.getCommandline());
               int exitValue = exec.execute();
               if (exitValue != 0) {
  
  
  
  1.10      +1 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java
  
  Index: Coverage.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Coverage.java	3 Mar 2002 01:46:23 -0000	1.9
  +++ Coverage.java	25 Apr 2002 12:14:51 -0000	1.10
  @@ -277,7 +277,7 @@
               // use the custom handler for stdin issues
               LogStreamHandler handler = new CoverageStreamHandler(this);
               Execute exec = new Execute(handler);
  -            log(cmdl.toString(), Project.MSG_VERBOSE);
  +            log(cmdl.describeCommand(), Project.MSG_VERBOSE);
               exec.setCommandline(cmdl.getCommandline());
               int exitValue = exec.execute();
               if (exitValue != 0) {
  
  
  
  1.20      +1 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java
  
  Index: DefaultRmicAdapter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- DefaultRmicAdapter.java	23 Apr 2002 08:15:51 -0000	1.19
  +++ DefaultRmicAdapter.java	25 Apr 2002 12:14:51 -0000	1.20
  @@ -260,7 +260,7 @@
       protected void logAndAddFilesToCompile(Commandline cmd) {
           Vector compileList = attributes.getCompileList();
   
  -        attributes.log("Compilation args: " + cmd.toString(),
  +        attributes.log("Compilation " + cmd.describeArguments(),
                          Project.MSG_VERBOSE);
   
           StringBuffer niceSourceList = new StringBuffer("File");
  
  
  
  1.21      +125 -4    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.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- Commandline.java	15 Apr 2002 12:11:50 -0000	1.20
  +++ Commandline.java	25 Apr 2002 12:14:51 -0000	1.21
  @@ -55,6 +55,7 @@
   package org.apache.tools.ant.types;
   
   import org.apache.tools.ant.BuildException;
  +import org.apache.tools.ant.util.StringUtils;
   import java.io.File;
   import java.util.Vector;
   import java.util.StringTokenizer;
  @@ -87,6 +88,13 @@
       private Vector arguments = new Vector();
       private String executable = null;
   
  +    protected static final String DISCLAIMER =
  +        StringUtils.LINE_SEP
  +        + "The \' characters around the executable and arguments are"
  +        + StringUtils.LINE_SEP
  +        + "not part of the command."
  +        + StringUtils.LINE_SEP;
  +
       public Commandline(String to_process) {
           super();
           String[] tmp = translateCommandline(to_process);
  @@ -230,7 +238,7 @@
        */
       public void setExecutable(String executable) {
           if (executable == null || executable.length() == 0) {
  -          return;
  +            return;
           }
           this.executable = executable.replace('/', File.separatorChar)
               .replace('\\', File.separatorChar);
  @@ -254,7 +262,7 @@
       public String[] getCommandline() {
           final String[] args = getArguments();
           if (executable == null) {
  -          return args;
  +            return args;
           }
           final String[] result = new String[args.length + 1];
           result[0] = executable;
  @@ -313,10 +321,14 @@
           }
       }
   
  +    /**
  +     * Quotes the parts of the given array in way that makes them
  +     * usable as command line arguments.
  +     */
       public static String toString(String [] line) {
           // empty path return empty string
           if (line == null || line.length == 0) {
  -          return "";
  +            return "";
           }
   
           // path containing one or more elements
  @@ -411,7 +423,8 @@
       }
   
       /**
  -     * Clear out the arguments but leave the executable in place for another operation.
  +     * Clear out the arguments but leave the executable in place for
  +     * another operation.
        */
       public void clearArgs() {
           arguments.removeAllElements();
  @@ -428,4 +441,112 @@
           return new Marker(arguments.size());
       }
   
  +    /**
  +     * Returns a String that describes the command and arguments
  +     * suitable for verbose output before a call to
  +     * <code>Runtime.exec(String[])<code>
  +     *
  +     * @since Ant 1.5
  +     */
  +    public String describeCommand() {
  +        return describeCommand(this);
  +    }
  +
  +    /**
  +     * Returns a String that describes the arguments suitable for
  +     * verbose output before a call to
  +     * <code>Runtime.exec(String[])<code>
  +     *
  +     * @since Ant 1.5
  +     */
  +    public String describeArguments() {
  +        return describeArguments(this);
  +    }
  +
  +    /**
  +     * Returns a String that describes the command and arguments
  +     * suitable for verbose output before a call to
  +     * <code>Runtime.exec(String[])<code>
  +     *
  +     * @since Ant 1.5
  +     */
  +    public static String describeCommand(Commandline line) {
  +        return describeCommand(line.getCommandline());
  +    }
  +
  +    /**
  +     * Returns a String that describes the arguments suitable for
  +     * verbose output before a call to
  +     * <code>Runtime.exec(String[])<code>
  +     *
  +     * @since Ant 1.5
  +     */
  +    public static String describeArguments(Commandline line) {
  +        return describeArguments(line.getArguments());
  +    }
  +
  +    /**
  +     * Returns a String that describes the command and arguments
  +     * suitable for verbose output before a call to
  +     * <code>Runtime.exec(String[])<code>
  +     *
  +     * <p>This method assumes that the first entry in the array is the
  +     * executable to run.</p>
  +     * 
  +     * @since Ant 1.5
  +     */
  +    public static String describeCommand(String[] args) {
  +        if (args == null || args.length == 0) {
  +            return "";
  +        }
  +        
  +        StringBuffer buf = new StringBuffer("Executing \'");
  +        buf.append(args[0]);
  +        buf.append("\'");
  +        if (args.length > 0) {
  +            buf.append(" with ");
  +            buf.append(describeArguments(args, 1));
  +        } else {
  +            buf.append(DISCLAIMER);
  +        }
  +        return buf.toString();
  +    }
  +
  +    /**
  +     * Returns a String that describes the arguments suitable for
  +     * verbose output before a call to
  +     * <code>Runtime.exec(String[])<code>
  +     *
  +     * @since Ant 1.5
  +     */
  +    public static String describeArguments(String[] args) {
  +        return describeArguments(args, 0);
  +    }
  +
  +    /**
  +     * Returns a String that describes the arguments suitable for
  +     * verbose output before a call to
  +     * <code>Runtime.exec(String[])<code>
  +     *
  +     * @param offset ignore entries before this index
  +     *
  +     * @since Ant 1.5
  +     */
  +    protected static String describeArguments(String[] args, int offset) {
  +        if (args == null || args.length <= offset) {
  +            return "";
  +        }
  +
  +        StringBuffer buf = new StringBuffer("argument");
  +        if (args.length > offset) {
  +            buf.append("s");
  +        }
  +        buf.append(":").append(StringUtils.LINE_SEP);
  +        for (int i = offset; i < args.length; i++) {
  +            buf.append("\'").append(args[i]).append("\'")
  +                .append(StringUtils.LINE_SEP);
  +        }
  +        buf.append(DISCLAIMER);
  +        return buf.toString();
  +    }
   }
  
  
  
  1.34      +23 -0     jakarta-ant/src/main/org/apache/tools/ant/types/CommandlineJava.java
  
  Index: CommandlineJava.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/CommandlineJava.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- CommandlineJava.java	15 Apr 2002 12:11:50 -0000	1.33
  +++ CommandlineJava.java	25 Apr 2002 12:14:51 -0000	1.34
  @@ -283,6 +283,29 @@
           return Commandline.toString(getCommandline());
       }
   
  +    /**
  +     * Returns a String that describes the command and arguments
  +     * suitable for verbose output before a call to
  +     * <code>Runtime.exec(String[])<code>
  +     *
  +     * @since Ant 1.5
  +     */
  +    public String describeCommand() {
  +        return Commandline.describeCommand(getCommandline());
  +    }
  +
  +    /**
  +     * Returns a String that describes the java command and arguments
  +     * for in VM executions.
  +     *
  +     * <p>The class name is the executable in this context.</p>
  +     *
  +     * @since Ant 1.5
  +     */
  +    public String describeJavaCommand() {
  +        return Commandline.describeCommand(getJavaCommand());
  +    }
  +
       private Commandline getActualVMCommand() {
           Commandline actualVMCommand = (Commandline) vmCommand.clone();
           if (maxMemory != null) {
  
  
  

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