You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ru...@locus.apache.org on 2000/01/02 19:06:40 UTC

cvs commit: jakarta-tools/ant/src/main/org/apache/tools/ant/taskdefs Exec.java

rubys       00/01/02 10:06:40

  Modified:    ant/src/main/org/apache/tools/ant/taskdefs Exec.java
  Added:       ant/src/bin antRun.bat
  Log:
  Windows support and cosmetic improvements
  
  Note: if any of these cosmetic improvements are not appreciated, let me
  know and I will undo them.  It just seems odd to me to see warnings
  issued telling me what OS I am running, and errors issued for every line
  of standard output....
  
  Revision  Changes    Path
  1.1                  jakarta-tools/ant/src/bin/antRun.bat
  
  Index: antRun.bat
  ===================================================================
  cd %1
  echo %2 %3 %4 %5 %6 %7 %8 %9
  %2 %3 %4 %5 %6 %7 %8 %9 2>&1
  
  
  
  1.6       +11 -7     jakarta-tools/ant/src/main/org/apache/tools/ant/taskdefs/Exec.java
  
  Index: Exec.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tools/ant/src/main/org/apache/tools/ant/taskdefs/Exec.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Exec.java	1999/12/14 22:41:05	1.5
  +++ Exec.java	2000/01/02 18:06:39	1.6
  @@ -73,10 +73,10 @@
   	try {
   	    // test if os match
   	    String myos=System.getProperty("os.name");
  -	    project.log("Myos= " + myos, "exec", Project.MSG_WARN);
  +	    project.log("Myos= " + myos, Project.MSG_VERBOSE);
   	    if( ( os != null ) && ( os.indexOf(myos) < 0 ) ){
   		// this command will be executed only on the specified OS
  -		project.log("Not found in " + os, "exec", Project.MSG_WARN);
  +		project.log("Not found in " + os, Project.MSG_VERBOSE);
   		return;
   	    }
   		
  @@ -86,8 +86,11 @@
   	    String ant=project.getProperty("ant.home");
   	    if(ant==null) throw new BuildException("Needs ant.home");
   		
  -	    command=ant + "/bin/antRun " + dir + " " + command;
  -            project.log(command, "exec", Project.MSG_WARN);
  +	    String antRun = project.resolveFile(ant + "/bin/antRun").toString();
  +	    if (myos.toLowerCase().indexOf("windows")>=0)
  +		antRun=antRun+".bat";
  +	    command=antRun + " " + project.resolveFile(dir) + " " + command;
  +            project.log(command, Project.MSG_VERBOSE);
   		
   	    // exec command on system runtime
   	    Process proc = Runtime.getRuntime().exec( command);
  @@ -95,16 +98,17 @@
   	    InputStreamReader isr=new InputStreamReader(proc.getInputStream());
   	    BufferedReader din = new BufferedReader(isr);
   	    
  -	    project.log("Output: ", "exec", Project.MSG_WARN);
   	    PrintWriter fos=null;
  -	    if( out!=null ) 
  +	    if( out!=null )  {
   		fos=new PrintWriter( new FileWriter( out ) );
  +        	project.log("Output redirected to " + out, Project.MSG_VERBOSE);
  +	    }
   
   	    // pipe CVS output to STDOUT
   	    String line;
   	    while((line = din.readLine()) != null) {
   		if( fos==null)
  -		    project.log(line, "exec", Project.MSG_ERR);
  +		    project.log(line, "exec", Project.MSG_INFO);
   		else
   		    fos.println(line);
   	    }