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/types CommandlineJava.java
Date Fri, 20 Feb 2004 15:13:22 GMT
bodewig     2004/02/20 07:13:22

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/junit
                        JUnitTask.java
               src/main/org/apache/tools/ant/types CommandlineJava.java
  Log:
  Allow subclasses of <junit> to plug in command lines of their own.
  
  Submitted by:	Mariano Benitez <mariano at fuegolabs dot com>
  
  Revision  Changes    Path
  1.93      +28 -18    ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  
  Index: JUnitTask.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v
  retrieving revision 1.92
  retrieving revision 1.93
  diff -u -r1.92 -r1.93
  --- JUnitTask.java	9 Feb 2004 21:05:32 -0000	1.92
  +++ JUnitTask.java	20 Feb 2004 15:13:21 -0000	1.93
  @@ -123,7 +123,7 @@
    */
   public class JUnitTask extends Task {
   
  -    private CommandlineJava commandline = new CommandlineJava();
  +    private CommandlineJava commandline;
       private Vector tests = new Vector();
       private Vector batchTests = new Vector();
       private Vector formatters = new Vector();
  @@ -338,7 +338,7 @@
        * @since Ant 1.2
        */
       public void setMaxmemory(String max) {
  -        commandline.setMaxmemory(max);
  +        getCommandline().setMaxmemory(max);
       }
   
       /**
  @@ -352,7 +352,7 @@
        * @since Ant 1.2
        */
       public void setJvm(String value) {
  -        commandline.setVm(value);
  +        getCommandline().setVm(value);
       }
   
       /**
  @@ -365,7 +365,7 @@
        * @since Ant 1.2
        */
       public Commandline.Argument createJvmarg() {
  -        return commandline.createVmArgument();
  +        return getCommandline().createVmArgument();
       }
   
       /**
  @@ -390,7 +390,7 @@
        */
       public void addSysproperty(Environment.Variable sysp) {
   
  -        commandline.addSysproperty(sysp);
  +        getCommandline().addSysproperty(sysp);
       }
   
       /**
  @@ -405,7 +405,7 @@
           // see bugzilla report 21684
           String testString = sysp.getContent();
           getProject().log("sysproperty added : " + testString, Project.MSG_DEBUG);
  -        commandline.addSysproperty(sysp);
  +        getCommandline().addSysproperty(sysp);
       }
   
       /**
  @@ -419,7 +419,7 @@
        * @since Ant 1.6
        */
       public void addSyspropertyset(PropertySet sysp) {
  -        commandline.addSyspropertyset(sysp);
  +        getCommandline().addSyspropertyset(sysp);
       }
   
       /**
  @@ -429,7 +429,7 @@
        * @since Ant 1.2
        */
       public Path createClasspath() {
  -        return commandline.createClasspath(getProject()).createPath();
  +        return getCommandline().createClasspath(getProject()).createPath();
       }
   
       /**
  @@ -438,7 +438,7 @@
        * @since Ant 1.6
        */
       public Path createBootclasspath() {
  -        return commandline.createBootclasspath(getProject()).createPath();
  +        return getCommandline().createBootclasspath(getProject()).createPath();
       }
   
       /**
  @@ -532,10 +532,10 @@
        * @param asserts assertion set
        */
       public void addAssertions(Assertions asserts) {
  -        if (commandline.getAssertions() != null) {
  +        if (getCommandline().getAssertions() != null) {
               throw new BuildException("Only one assertion declaration is allowed");
           }
  -        commandline.setAssertions(asserts);
  +        getCommandline().setAssertions(asserts);
       }
   
       /**
  @@ -560,7 +560,7 @@
        * @since Ant 1.7
        */
       public void setCloneVm(boolean cloneVm) {
  -        commandline.setCloneVm(cloneVm);
  +        getCommandline().setCloneVm(cloneVm);
       }
   
       /**
  @@ -570,7 +570,7 @@
        * @since Ant 1.2
        */
       public JUnitTask() throws Exception {
  -        commandline
  +        getCommandline()
               .setClassname("org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner");
       }
   
  @@ -688,7 +688,7 @@
               log("Permissions ignored when running in forked mode!", Project.MSG_WARN);
           }
   
  -        CommandlineJava cmd = (CommandlineJava) commandline.clone();
  +        CommandlineJava cmd = (CommandlineJava) getCommandline().clone();
   
           cmd.setClassname("org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner");
           cmd.createArgument().setValue(test.getName());
  @@ -916,13 +916,13 @@
                   + "the same VM.", Project.MSG_WARN);
           }
   
  -        if (commandline.getBootclasspath() != null) {
  +        if (getCommandline().getBootclasspath() != null) {
               log("bootclasspath is ignored if running in the same VM.",
                   Project.MSG_WARN);
           }
   
           CommandlineJava.SysProperties sysProperties =
  -            commandline.getSystemProperties();
  +                getCommandline().getSystemProperties();
           if (sysProperties != null) {
               sysProperties.setSystem();
           }
  @@ -1154,7 +1154,7 @@
        * @since Ant 1.6
        */
       private void createClassLoader() {
  -        Path userClasspath = commandline.getClasspath();
  +        Path userClasspath = getCommandline().getClasspath();
           if (userClasspath != null) {
               if (reloading || classLoader == null) {
                   Path classpath = (Path) userClasspath.clone();
  @@ -1175,5 +1175,15 @@
                   classLoader.addSystemPackageRoot("org.apache.tools.ant");
               }
           }
  +    }
  +
  +    /**
  +     * @since Ant 1.7
  +     */
  +    protected CommandlineJava getCommandline() {
  +        if (commandline == null) {
  +            commandline = new CommandlineJava();
  +        }
  +        return commandline;
       }
   }
  
  
  
  1.52      +3 -3      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.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- CommandlineJava.java	9 Feb 2004 21:05:36 -0000	1.51
  +++ CommandlineJava.java	20 Feb 2004 15:13:22 -0000	1.52
  @@ -463,7 +463,7 @@
        * Get the VM command parameters, including memory settings
        * @return
        */
  -    private Commandline getActualVMCommand() {
  +    protected Commandline getActualVMCommand() {
           Commandline actualVMCommand = (Commandline) vmCommand.clone();
           if (maxMemory != null) {
               if (vmVersion.startsWith("1.1")) {
  @@ -604,7 +604,7 @@
        *
        * @since Ant 1.6
        */
  -    private boolean haveClasspath() {
  +    protected boolean haveClasspath() {
           Path fullClasspath = classpath != null
               ? classpath.concatSystemClasspath("ignore") : null;
           return fullClasspath != null
  @@ -621,7 +621,7 @@
        *
        * @since Ant 1.6
        */
  -    private boolean haveBootclasspath(boolean log) {
  +    protected boolean haveBootclasspath(boolean log) {
           if (bootclasspath != null
               && bootclasspath.toString().trim().length() > 0) {
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message