bodewig     2005/01/13 01:05:35

  Modified:    .        WHATSNEW
               src/main/org/apache/tools/ant/types CommandlineJava.java
  Log:
  Try to harmonize bootclasspath and build.sysclasspath a bit more, there are 
still some more tasks to handle
  
  Revision  Changes    Path
  1.710     +5 -0      ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.709
  retrieving revision 1.710
  diff -u -r1.709 -r1.710
  --- WHATSNEW  11 Jan 2005 18:30:34 -0000      1.709
  +++ WHATSNEW  13 Jan 2005 09:05:35 -0000      1.710
  @@ -10,6 +10,11 @@
     to upgrade to a newer version of log4j.
     Bugzilla Report 31951.
   
  +* build.sysclasspath now also affects the bootclasspath handling of
  +  spawned Java VMs.  If you set build.sysclasspath to anything other
  +  than "ignore" (or leave it unset, since "ignore" is the default when
  +  it comes to bootclasspath handling), then the bootclasspath of the
  +  VM running Ant will be added to the bootclasspath you've specified.
   
   Fixed bugs:
   -----------
  
  
  
  1.62      +25 -32    
ant/src/main/org/apache/tools/ant/types/CommandlineJava.java
  
  Index: CommandlineJava.java
  ===================================================================
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/types/CommandlineJava.java,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- CommandlineJava.java      11 Jan 2005 14:05:01 -0000      1.61
  +++ CommandlineJava.java      13 Jan 2005 09:05:35 -0000      1.62
  @@ -386,13 +386,11 @@
           }
   
           //boot classpath
  -        if (haveBootclasspath(true)) {
  -            listIterator.add("-Xbootclasspath:" + bootclasspath.toString());
  -        } else if (cloneBootclasspath()) {
  -            listIterator.add("-Xbootclasspath:"
  -                             + Path.systemBootClasspath.toString());
  +        Path bcp = calculateBootclasspath(true);
  +        if (bcp.size() > 0) {
  +            listIterator.add("-Xbootclasspath:" + bcp.toString());
           }
  -
  +        
           //main classpath
           if (haveClasspath()) {
               listIterator.add("-classpath");
  @@ -493,7 +491,7 @@
               size += 2;
           }
           // bootclasspath is "-Xbootclasspath:<classpath>" -> 1 arg
  -        if (haveBootclasspath(true) || cloneBootclasspath()) {
  +        if (calculateBootclasspath(true).size() > 0) {
               size++;
           }
           // jar execution requires an additional -jar option
  @@ -622,37 +620,32 @@
        * @since Ant 1.6
        */
       protected boolean haveBootclasspath(boolean log) {
  -        if (bootclasspath != null
  -            && bootclasspath.toString().trim().length() > 0) {
  -
  -            if (!bootclasspath.toString()
  -                .equals(bootclasspath.concatSystemClasspath("ignore")
  -                        .toString())) {
  -                if (log) {
  -                    bootclasspath.log("Ignoring bootclasspath as "
  -                                       + "build.sysclasspath has been set.");
  -                }
  -            } else if (vmVersion.startsWith("1.1")) {
  -                if (log) {
  -                    bootclasspath.log("Ignoring bootclasspath as "
  -                                       + "the target VM doesn't support 
it.");
  -                }
  -            } else {
  -                return true;
  -            }
  -        }
  -        return false;
  +        return calculateBootclasspath(log).size() > 0;
       }
   
       /**
  -     * Should a bootclasspath argument be created to clone the current
  -     * VM settings?
  +     * Calculate the bootclasspath based on the bootclasspath
  +     * specified, the build.sysclasspath and build.clonevm magic
  +     * properties as well as the cloneVm attribute.
        *
        * @since Ant 1.7
        */
  -    private boolean cloneBootclasspath() {
  -        return isCloneVm() && !vmVersion.startsWith("1.1")
  -            && Path.systemBootClasspath.size() > 0;
  +    private Path calculateBootclasspath(boolean log) {
  +        if (vmVersion.startsWith("1.1")) {
  +            if (bootclasspath != null && log) {
  +                bootclasspath.log("Ignoring bootclasspath as "
  +                                  + "the target VM doesn't support it.");
  +            }
  +        } else {
  +            if (bootclasspath != null) {
  +                return bootclasspath.concatSystemBootClasspath(isCloneVm()
  +                                                               ? "last"
  +                                                               : "ignore");
  +            } else if (isCloneVm()) {
  +                return Path.systemBootClasspath;
  +            }
  +        }
  +        return new Path(null);
       }
   
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to