ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka CovBase.java CovMerge.java CovReport.java Coverage.java
Date Thu, 03 Apr 2003 08:48:53 GMT
bodewig     2003/04/03 00:48:52

  Modified:    .        WHATSNEW
               src/main/org/apache/tools/ant/taskdefs/optional/sitraka
                        CovBase.java CovMerge.java CovReport.java
                        Coverage.java
  Log:
  Add support for JProbe 4.x.
  
  PR: 14849
  
  Revision  Changes    Path
  1.388     +2 -0      ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.387
  retrieving revision 1.388
  diff -u -r1.387 -r1.388
  --- WHATSNEW	3 Apr 2003 06:41:50 -0000	1.387
  +++ WHATSNEW	3 Apr 2003 08:48:47 -0000	1.388
  @@ -216,6 +216,8 @@
     <exclude> elements can be used to exclude certain packages from
     being parsed.  Bugzilla Report 17134.
   
  +* The JProbe tasks now also work with JProbe 4.x.  Bugzilla Report 14849.
  +
   Changes from Ant 1.5.2 to Ant 1.5.3
   ===================================
   
  
  
  
  1.2       +38 -4     ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovBase.java
  
  Index: CovBase.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovBase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CovBase.java	2 Apr 2003 12:42:50 -0000	1.1
  +++ CovBase.java	3 Apr 2003 08:48:50 -0000	1.2
  @@ -56,6 +56,7 @@
   
   import java.io.File;
   import org.apache.tools.ant.Task;
  +import org.apache.tools.ant.taskdefs.condition.Os;
   import org.apache.tools.ant.util.FileUtils;
   
   /**
  @@ -68,6 +69,8 @@
   public abstract class CovBase extends Task {
       private File home;
       private static FileUtils fu = FileUtils.newFileUtils();
  +    private boolean isJProbe4 = false;
  +    private static boolean isDos = Os.isFamily("dos");
   
       /**
        * The directory where JProbe is installed.
  @@ -80,12 +83,43 @@
           return home;
       }
   
  -    protected File findJar(String relativePath) {
  -        return fu.resolveFile(home, relativePath);
  +    protected File findCoverageJar() {
  +        File loc = null;
  +        if (isJProbe4) {
  +            loc = fu.resolveFile(home, "lib/coverage.jar");
  +        } else {
  +            loc = fu.resolveFile(home, "coverage/coverage.jar");
  +            if (!loc.canRead()) {
  +                File newLoc = fu.resolveFile(home, "lib/coverage.jar");
  +                if (newLoc.canRead()) {
  +                    isJProbe4 = true;
  +                    loc = newLoc;
  +                }
  +            }
  +        }
  +        
  +        return loc;
       }
   
       protected String findExecutable(String relativePath) {
  -        return fu.resolveFile(home, relativePath).getAbsolutePath();
  +        if (isDos) {
  +            relativePath += ".exe";
  +        }
  +
  +        File loc = null;
  +        if (isJProbe4) {
  +            loc = fu.resolveFile(home, "bin/" + relativePath);
  +        } else {
  +            loc = fu.resolveFile(home, relativePath);
  +            if (!loc.canRead()) {
  +                File newLoc = fu.resolveFile(home, "bin/" + relativePath);
  +                if (newLoc.canRead()) {
  +                    isJProbe4 = true;
  +                    loc = newLoc;
  +                }
  +            }
  +        }
  +        return loc.getAbsolutePath();
       }
   
       protected File createTempFile(String prefix) {
  @@ -93,6 +127,6 @@
       }
   
       protected String getParamFileArgument() {
  -        return "-jp_paramfile=";
  +        return (!isJProbe4 ? "-jp_" : "") + "paramfile=";
       }
   }
  
  
  
  1.16      +1 -1      ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java
  
  Index: CovMerge.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- CovMerge.java	2 Apr 2003 12:42:50 -0000	1.15
  +++ CovMerge.java	3 Apr 2003 08:48:50 -0000	1.16
  @@ -154,7 +154,7 @@
           if (getHome() == null || !getHome().isDirectory()) {
               throw new BuildException("Invalid home directory. Must point to JProbe home
directory");
           }
  -        File jar = findJar("coverage/coverage.jar");
  +        File jar = findCoverageJar();
           if (!jar.exists()) {
               throw new BuildException("Cannot find Coverage directory: " + getHome());
           }
  
  
  
  1.17      +1 -1      ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java
  
  Index: CovReport.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- CovReport.java	2 Apr 2003 12:42:50 -0000	1.16
  +++ CovReport.java	3 Apr 2003 08:48:51 -0000	1.17
  @@ -271,7 +271,7 @@
           if (getHome() == null) {
               throw new BuildException("'home' attribute must be set to JProbe home directory");
           }
  -        File jar = findJar("coverage/coverage.jar");
  +        File jar = findCoverageJar();
           if (!jar.exists()) {
               throw new BuildException("Cannot find Coverage directory: " + getHome());
           }
  
  
  
  1.16      +1 -1      ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java
  
  Index: Coverage.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- Coverage.java	2 Apr 2003 12:42:50 -0000	1.15
  +++ Coverage.java	3 Apr 2003 08:48:51 -0000	1.16
  @@ -351,7 +351,7 @@
           if (getHome() == null || !getHome().isDirectory()) {
               throw new BuildException("Invalid home directory. Must point to JProbe home
directory");
           }
  -        File jar = findJar("coverage/coverage.jar");
  +        File jar = findCoverageJar();
           if (!jar.exists()) {
               throw new BuildException("Cannot find Coverage directory: " + getHome());
           }
  
  
  

Mime
View raw message