Browse Source

Removed Project.getVersion() replaced it with getJavaVersion() (inherited from AbstractTask) where necessary and removed all checks for java 1.1

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270442 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 23 years ago
parent
commit
37879f0723
30 changed files with 96 additions and 474 deletions
  1. +0
    -32
      proposal/myrmidon/src/main/org/apache/tools/ant/Project.java
  2. +0
    -6
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/GenerateKey.java
  3. +6
    -18
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Get.java
  4. +0
    -5
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java
  5. +2
    -2
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javac.java
  6. +0
    -5
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SignJar.java
  7. +0
    -11
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Touch.java
  8. +21
    -66
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
  9. +10
    -21
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java
  10. +1
    -9
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  11. +1
    -9
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java
  12. +1
    -9
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java
  13. +2
    -13
      proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java
  14. +4
    -25
      proposal/myrmidon/src/main/org/apache/tools/ant/types/CommandlineJava.java
  15. +0
    -6
      proposal/myrmidon/src/main/org/apache/tools/ant/types/Path.java
  16. +0
    -32
      proposal/myrmidon/src/todo/org/apache/tools/ant/Project.java
  17. +0
    -6
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/GenerateKey.java
  18. +6
    -18
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Get.java
  19. +0
    -5
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Java.java
  20. +2
    -2
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Javac.java
  21. +0
    -5
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/SignJar.java
  22. +0
    -11
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Touch.java
  23. +21
    -66
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
  24. +10
    -21
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Javah.java
  25. +1
    -9
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  26. +1
    -9
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java
  27. +1
    -9
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java
  28. +2
    -13
      proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java
  29. +4
    -25
      proposal/myrmidon/src/todo/org/apache/tools/ant/types/CommandlineJava.java
  30. +0
    -6
      proposal/myrmidon/src/todo/org/apache/tools/ant/types/Path.java

+ 0
- 32
proposal/myrmidon/src/main/org/apache/tools/ant/Project.java View File

@@ -114,16 +114,6 @@ public class Project
return super.getLogger(); return super.getLogger();
} }


/**
* static query of the java version
*
* @return something like "1.1" or "1.3"
*/
public static String getJavaVersion()
{
return javaVersion;
}

/** /**
* returns the boolean equivalent of a string, which is considered true if * returns the boolean equivalent of a string, which is considered true if
* either "on", "true", or "yes" is found, ignoring case. * either "on", "true", or "yes" is found, ignoring case.
@@ -138,28 +128,6 @@ public class Project
s.equalsIgnoreCase( "yes" ) ); s.equalsIgnoreCase( "yes" ) );
} }


/**
* set the ant.java.version property, also tests for unsupported JVM
* versions, prints the verbose log messages
*
* @throws TaskException if this Java version is not supported
*/
public void setJavaVersionProperty()
throws TaskException
{
setPropertyInternal( "ant.java.version", javaVersion );

// sanity check
if( javaVersion == JAVA_1_0 )
{
throw new TaskException( "Ant cannot work on Java 1.0" );
}

getLogger().debug( "Detected Java version: " + javaVersion + " in: " + System.getProperty( "java.home" ) );

getLogger().debug( "Detected OS: " + System.getProperty( "os.name" ) );
}

/** /**
* get the base directory of the project as a file object * get the base directory of the project as a file object
* *


+ 0
- 6
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/GenerateKey.java View File

@@ -139,12 +139,6 @@ public class GenerateKey
public void execute() public void execute()
throws TaskException throws TaskException
{ {
if( getProject().getJavaVersion().equals( Project.JAVA_1_1 ) )
{
throw new TaskException( "The genkey task is only available on JDK" +
" versions 1.2 or greater" );
}

if( null == alias ) if( null == alias )
{ {
throw new TaskException( "alias attribute must be set" ); throw new TaskException( "alias attribute must be set" );


+ 6
- 18
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Get.java View File

@@ -16,7 +16,6 @@ import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import java.util.Date; import java.util.Date;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;


/** /**
@@ -95,10 +94,7 @@ public class Get extends Task
*/ */
public void setUseTimestamp( boolean v ) public void setUseTimestamp( boolean v )
{ {
if( getProject().getJavaVersion() != Project.JAVA_1_1 )
{
useTimestamp = v;
}
useTimestamp = v;
} }


/** /**
@@ -296,22 +292,14 @@ public class Get extends Task
* @exception TaskException Thrown in unrecoverable error. Likely this * @exception TaskException Thrown in unrecoverable error. Likely this
* comes from file access failures. * comes from file access failures.
*/ */
protected boolean touchFile( File file, long timemillis )
protected void touchFile( File file, long timemillis )
throws TaskException throws TaskException
{ {


if( getProject().getJavaVersion() != Project.JAVA_1_1 )
{
Touch touch = (Touch)getProject().createTask( "touch" );
touch.setFile( file );
touch.setMillis( timemillis );
touch.touch();
return true;
}
else
{
return false;
}
Touch touch = (Touch)getProject().createTask( "touch" );
touch.setFile( file );
touch.setMillis( timemillis );
touch.touch();
} }


/** /**


+ 0
- 5
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java View File

@@ -109,11 +109,6 @@ public class Java extends Task
this.fork = s; this.fork = s;
} }


public void setJVMVersion( String value )
{
cmdl.setVmversion( value );
}

/** /**
* set the jar name... * set the jar name...
* *


+ 2
- 2
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javac.java View File

@@ -11,6 +11,7 @@ import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.api.JavaVersion;
import org.apache.myrmidon.framework.Os; import org.apache.myrmidon.framework.Os;
import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
@@ -894,8 +895,7 @@ public class Javac extends MatchingTask


if( compiler == null ) if( compiler == null )
{ {
if( Project.getJavaVersion() != Project.JAVA_1_1 &&
Project.getJavaVersion() != Project.JAVA_1_2 )
if( JavaVersion.JAVA1_2 != getJavaVersion() )
{ {
compiler = "modern"; compiler = "modern";
} }


+ 0
- 5
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SignJar.java View File

@@ -249,11 +249,6 @@ public class SignJar extends Task
private void doOneJar( File jarSource, File jarTarget ) private void doOneJar( File jarSource, File jarTarget )
throws TaskException throws TaskException
{ {
if( getProject().getJavaVersion().equals( Project.JAVA_1_1 ) )
{
throw new TaskException( "The signjar task is only available on JDK versions 1.2 or greater" );
}

if( null == alias ) if( null == alias )
{ {
throw new TaskException( "alias attribute must be set" ); throw new TaskException( "alias attribute must be set" );


+ 0
- 11
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Touch.java View File

@@ -148,12 +148,6 @@ public class Touch extends Task
} }
} }


if( millis >= 0 && getProject().getJavaVersion() == Project.JAVA_1_1 )
{
getLogger().warn( "modification time of files cannot be set in JDK 1.1" );
return;
}

boolean resetMillis = false; boolean resetMillis = false;
if( millis < 0 ) if( millis < 0 )
{ {
@@ -201,11 +195,6 @@ public class Touch extends Task
throw new TaskException( "Can not change modification date of read-only file " + file ); throw new TaskException( "Can not change modification date of read-only file " + file );
} }


if( getProject().getJavaVersion() == Project.JAVA_1_1 )
{
return;
}

final long time = ( millis < 0 ) ? System.currentTimeMillis() : millis; final long time = ( millis < 0 ) ? System.currentTimeMillis() : millis;
file.setLastModified( time ); file.setLastModified( time );
} }


+ 21
- 66
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java View File

@@ -13,6 +13,7 @@ import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.api.JavaVersion;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Javac; import org.apache.tools.ant.taskdefs.Javac;
import org.apache.tools.ant.taskdefs.exec.Execute; import org.apache.tools.ant.taskdefs.exec.Execute;
@@ -125,12 +126,7 @@ public abstract class DefaultCompilerAdapter
throws TaskException throws TaskException
{ {
Path classpath = getCompileClasspath(); Path classpath = getCompileClasspath();

// we cannot be using Java 1.0 when forking, so we only have to
// distinguish between Java 1.1, and Java 1.2 and higher, as Java 1.1
// has its own parameter format
boolean usingJava1_1 = Project.getJavaVersion().equals( Project.JAVA_1_1 );
String memoryParameterPrefix = usingJava1_1 ? "-J-" : "-J-X";
String memoryParameterPrefix = "-J-X";
if( m_memoryInitialSize != null ) if( m_memoryInitialSize != null )
{ {
if( !m_attributes.isForkedJavac() ) if( !m_attributes.isForkedJavac() )
@@ -174,47 +170,27 @@ public abstract class DefaultCompilerAdapter
} }


cmd.createArgument().setValue( "-classpath" ); cmd.createArgument().setValue( "-classpath" );
cmd.createArgument().setPath( classpath );

cmd.createArgument().setValue( "-sourcepath" );
cmd.createArgument().setPath( src );


// Just add "sourcepath" to classpath ( for JDK1.1 )
// as well as "bootclasspath" and "extdirs"
if( Project.getJavaVersion().startsWith( "1.1" ) )
if( target != null )
{ {
Path cp = new Path();
/*
* XXX - This doesn't mix very well with build.systemclasspath,
*/
if( m_bootclasspath != null )
{
cp.append( m_bootclasspath );
}
if( m_extdirs != null )
{
cp.addExtdirs( m_extdirs );
}
cp.append( classpath );
cp.append( src );
cmd.createArgument().setPath( cp );
cmd.createArgument().setValue( "-target" );
cmd.createArgument().setValue( target );
} }
else

if( m_bootclasspath != null )
{ {
cmd.createArgument().setPath( classpath );
cmd.createArgument().setValue( "-sourcepath" );
cmd.createArgument().setPath( src );
if( target != null )
{
cmd.createArgument().setValue( "-target" );
cmd.createArgument().setValue( target );
}
if( m_bootclasspath != null )
{
cmd.createArgument().setValue( "-bootclasspath" );
cmd.createArgument().setPath( m_bootclasspath );
}
if( m_extdirs != null )
{
cmd.createArgument().setValue( "-extdirs" );
cmd.createArgument().setPath( m_extdirs );
}
cmd.createArgument().setValue( "-bootclasspath" );
cmd.createArgument().setPath( m_bootclasspath );
}

if( m_extdirs != null )
{
cmd.createArgument().setValue( "-extdirs" );
cmd.createArgument().setPath( m_extdirs );
} }


if( m_encoding != null ) if( m_encoding != null )
@@ -224,11 +200,8 @@ public abstract class DefaultCompilerAdapter
} }
if( m_debug ) if( m_debug )
{ {
if( useDebugLevel
&& Project.getJavaVersion() != Project.JAVA_1_0
&& Project.getJavaVersion() != Project.JAVA_1_1 )
if( useDebugLevel )
{ {

String debugLevel = m_attributes.getDebugLevel(); String debugLevel = m_attributes.getDebugLevel();
if( debugLevel != null ) if( debugLevel != null )
{ {
@@ -244,8 +217,7 @@ public abstract class DefaultCompilerAdapter
cmd.createArgument().setValue( "-g" ); cmd.createArgument().setValue( "-g" );
} }
} }
else if( Project.getJavaVersion() != Project.JAVA_1_0 &&
Project.getJavaVersion() != Project.JAVA_1_1 )
else
{ {
cmd.createArgument().setValue( "-g:none" ); cmd.createArgument().setValue( "-g:none" );
} }
@@ -254,23 +226,6 @@ public abstract class DefaultCompilerAdapter
cmd.createArgument().setValue( "-O" ); cmd.createArgument().setValue( "-O" );
} }


if( m_depend )
{
if( Project.getJavaVersion().startsWith( "1.1" ) )
{
cmd.createArgument().setValue( "-depend" );
}
else if( Project.getJavaVersion().startsWith( "1.2" ) )
{
cmd.createArgument().setValue( "-Xdepend" );
}
else
{
final String message = "depend attribute is not supported by the modern compiler";
getLogger().warn( message );
}
}

if( m_verbose ) if( m_verbose )
{ {
cmd.createArgument().setValue( "-verbose" ); cmd.createArgument().setValue( "-verbose" );


+ 10
- 21
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java View File

@@ -12,6 +12,7 @@ import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.api.JavaVersion;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;
@@ -267,8 +268,7 @@ public class Javah extends Task
String compiler = getProject().getProperty( "build.compiler" ); String compiler = getProject().getProperty( "build.compiler" );
if( compiler == null ) if( compiler == null )
{ {
if( Project.getJavaVersion() != Project.JAVA_1_1 &&
Project.getJavaVersion() != Project.JAVA_1_2 )
if( JavaVersion.JAVA1_2 != getJavaVersion() )
{ {
compiler = "modern"; compiler = "modern";
} }
@@ -353,28 +353,17 @@ public class Javah extends Task
cmd.createArgument().setPath( classpath ); cmd.createArgument().setPath( classpath );
} }


// JDK1.1 is rather simpler than JDK1.2
if( Project.getJavaVersion().startsWith( "1.1" ) )
if( verbose )
{ {
if( verbose )
{
cmd.createArgument().setValue( "-v" );
}
cmd.createArgument().setValue( "-verbose" );
} }
else
if( old )
{ {
if( verbose )
{
cmd.createArgument().setValue( "-verbose" );
}
if( old )
{
cmd.createArgument().setValue( "-old" );
}
if( force )
{
cmd.createArgument().setValue( "-force" );
}
cmd.createArgument().setValue( "-old" );
}
if( force )
{
cmd.createArgument().setValue( "-force" );
} }


if( stubs ) if( stubs )


+ 1
- 9
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java View File

@@ -20,7 +20,6 @@ import java.util.Properties;
import java.util.Random; import java.util.Random;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.AntClassLoader; import org.apache.tools.ant.AntClassLoader;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.exec.Execute; import org.apache.tools.ant.taskdefs.exec.Execute;
import org.apache.tools.ant.taskdefs.exec.LogOutputStream; import org.apache.tools.ant.taskdefs.exec.LogOutputStream;
@@ -265,14 +264,7 @@ public class JUnitTask extends Task
*/ */
public void setMaxmemory( String max ) public void setMaxmemory( String max )
{ {
if( Project.getJavaVersion().startsWith( "1.1" ) )
{
createJvmarg().setValue( "-mx" + max );
}
else
{
createJvmarg().setValue( "-Xmx" + max );
}
createJvmarg().setValue( "-Xmx" + max );
} }


/** /**


+ 1
- 9
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java View File

@@ -17,7 +17,6 @@ import java.util.Iterator;
import java.util.Random; import java.util.Random;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.exec.Execute; import org.apache.tools.ant.taskdefs.exec.Execute;
import org.apache.tools.ant.types.Argument; import org.apache.tools.ant.types.Argument;
@@ -119,14 +118,7 @@ public abstract class AbstractMetamataTask extends Task
*/ */
public void setMaxmemory( String max ) public void setMaxmemory( String max )
{ {
if( Project.getJavaVersion().startsWith( "1.1" ) )
{
createJvmarg().setValue( "-mx" + max );
}
else
{
createJvmarg().setValue( "-Xmx" + max );
}
createJvmarg().setValue( "-Xmx" + max );
} }


/** /**


+ 1
- 9
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java View File

@@ -14,7 +14,6 @@ import java.io.PrintWriter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Random; import java.util.Random;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.exec.Execute; import org.apache.tools.ant.taskdefs.exec.Execute;
import org.apache.tools.ant.taskdefs.exec.ExecuteStreamHandler; import org.apache.tools.ant.taskdefs.exec.ExecuteStreamHandler;
@@ -102,14 +101,7 @@ public class MParse extends Task
*/ */
public void setMaxmemory( String max ) public void setMaxmemory( String max )
{ {
if( Project.getJavaVersion().startsWith( "1.1" ) )
{
createJvmarg().setValue( "-mx" + max );
}
else
{
createJvmarg().setValue( "-Xmx" + max );
}
createJvmarg().setValue( "-Xmx" + max );
} }


/** /**


+ 2
- 13
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java View File

@@ -12,7 +12,6 @@ import java.util.ArrayList;
import java.util.Random; import java.util.Random;
import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Rmic; import org.apache.tools.ant.taskdefs.Rmic;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;
@@ -113,18 +112,8 @@ public abstract class DefaultRmicAdapter


if( attributes.getExtdirs() != null ) if( attributes.getExtdirs() != null )
{ {
if( Project.getJavaVersion().startsWith( "1.1" ) )
{
/*
* XXX - This doesn't mix very well with build.systemclasspath,
*/
classpath.addExtdirs( attributes.getExtdirs() );
}
else
{
cmd.createArgument().setValue( "-extdirs" );
cmd.createArgument().setPath( attributes.getExtdirs() );
}
cmd.createArgument().setValue( "-extdirs" );
cmd.createArgument().setPath( attributes.getExtdirs() );
} }


cmd.createArgument().setValue( "-classpath" ); cmd.createArgument().setValue( "-classpath" );


+ 4
- 25
proposal/myrmidon/src/main/org/apache/tools/ant/types/CommandlineJava.java View File

@@ -26,24 +26,21 @@ import org.apache.tools.ant.Project;
*/ */
public class CommandlineJava implements Cloneable public class CommandlineJava implements Cloneable
{ {

private Commandline vmCommand = new Commandline(); private Commandline vmCommand = new Commandline();
private Commandline javaCommand = new Commandline(); private Commandline javaCommand = new Commandline();
private SysProperties sysProperties = new SysProperties(); private SysProperties sysProperties = new SysProperties();
private Path classpath = null;
private String maxMemory = null;
private Path classpath;
private String maxMemory;


/** /**
* Indicate whether it will execute a jar file or not, in this case the * Indicate whether it will execute a jar file or not, in this case the
* first vm option must be a -jar and the 'executable' is a jar file. * first vm option must be a -jar and the 'executable' is a jar file.
*/ */
private boolean executeJar = false;
private String vmVersion;
private boolean executeJar;


public CommandlineJava() public CommandlineJava()
{ {
setVm( getJavaExecutableName() ); setVm( getJavaExecutableName() );
setVmversion( Project.getJavaVersion() );
} }


/** /**
@@ -89,11 +86,6 @@ public class CommandlineJava implements Cloneable
vmCommand.setExecutable( vm ); vmCommand.setExecutable( vm );
} }


public void setVmversion( String value )
{
vmVersion = value;
}

/** /**
* @return the name of the class to run or <tt>null</tt> if there is no * @return the name of the class to run or <tt>null</tt> if there is no
* class. * class.
@@ -185,11 +177,6 @@ public class CommandlineJava implements Cloneable
return getActualVMCommand(); return getActualVMCommand();
} }


public String getVmversion()
{
return vmVersion;
}

public void addSysproperty( EnvironmentVariable sysp ) public void addSysproperty( EnvironmentVariable sysp )
{ {
sysProperties.addVariable( sysp ); sysProperties.addVariable( sysp );
@@ -214,7 +201,6 @@ public class CommandlineJava implements Cloneable
{ {
c.classpath = (Path)classpath.clone(); c.classpath = (Path)classpath.clone();
} }
c.vmVersion = vmVersion;
c.executeJar = executeJar; c.executeJar = executeJar;
return c; return c;
} }
@@ -285,14 +271,7 @@ public class CommandlineJava implements Cloneable
Commandline actualVMCommand = (Commandline)vmCommand.clone(); Commandline actualVMCommand = (Commandline)vmCommand.clone();
if( maxMemory != null ) if( maxMemory != null )
{ {
if( vmVersion.startsWith( "1.1" ) )
{
actualVMCommand.createArgument().setValue( "-mx" + maxMemory );
}
else
{
actualVMCommand.createArgument().setValue( "-Xmx" + maxMemory );
}
actualVMCommand.createArgument().setValue( "-Xmx" + maxMemory );
} }
return actualVMCommand; return actualVMCommand;
} }


+ 0
- 6
proposal/myrmidon/src/main/org/apache/tools/ant/types/Path.java View File

@@ -353,12 +353,6 @@ public class Path
kaffeJarFiles.setIncludes( "*.jar" ); kaffeJarFiles.setIncludes( "*.jar" );
addFileset( kaffeJarFiles ); addFileset( kaffeJarFiles );
} }
else if( Project.getJavaVersion() == Project.JAVA_1_1 )
{
final String classes = System.getProperty( "java.home" ) +
File.separator + "lib" + File.separator + "classes.zip";
addExisting( new Path( classes ) );
}
else else
{ {
// JDK > 1.1 seems to set java.home to the JRE directory. // JDK > 1.1 seems to set java.home to the JRE directory.


+ 0
- 32
proposal/myrmidon/src/todo/org/apache/tools/ant/Project.java View File

@@ -114,16 +114,6 @@ public class Project
return super.getLogger(); return super.getLogger();
} }


/**
* static query of the java version
*
* @return something like "1.1" or "1.3"
*/
public static String getJavaVersion()
{
return javaVersion;
}

/** /**
* returns the boolean equivalent of a string, which is considered true if * returns the boolean equivalent of a string, which is considered true if
* either "on", "true", or "yes" is found, ignoring case. * either "on", "true", or "yes" is found, ignoring case.
@@ -138,28 +128,6 @@ public class Project
s.equalsIgnoreCase( "yes" ) ); s.equalsIgnoreCase( "yes" ) );
} }


/**
* set the ant.java.version property, also tests for unsupported JVM
* versions, prints the verbose log messages
*
* @throws TaskException if this Java version is not supported
*/
public void setJavaVersionProperty()
throws TaskException
{
setPropertyInternal( "ant.java.version", javaVersion );

// sanity check
if( javaVersion == JAVA_1_0 )
{
throw new TaskException( "Ant cannot work on Java 1.0" );
}

getLogger().debug( "Detected Java version: " + javaVersion + " in: " + System.getProperty( "java.home" ) );

getLogger().debug( "Detected OS: " + System.getProperty( "os.name" ) );
}

/** /**
* get the base directory of the project as a file object * get the base directory of the project as a file object
* *


+ 0
- 6
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/GenerateKey.java View File

@@ -139,12 +139,6 @@ public class GenerateKey
public void execute() public void execute()
throws TaskException throws TaskException
{ {
if( getProject().getJavaVersion().equals( Project.JAVA_1_1 ) )
{
throw new TaskException( "The genkey task is only available on JDK" +
" versions 1.2 or greater" );
}

if( null == alias ) if( null == alias )
{ {
throw new TaskException( "alias attribute must be set" ); throw new TaskException( "alias attribute must be set" );


+ 6
- 18
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Get.java View File

@@ -16,7 +16,6 @@ import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import java.util.Date; import java.util.Date;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;


/** /**
@@ -95,10 +94,7 @@ public class Get extends Task
*/ */
public void setUseTimestamp( boolean v ) public void setUseTimestamp( boolean v )
{ {
if( getProject().getJavaVersion() != Project.JAVA_1_1 )
{
useTimestamp = v;
}
useTimestamp = v;
} }


/** /**
@@ -296,22 +292,14 @@ public class Get extends Task
* @exception TaskException Thrown in unrecoverable error. Likely this * @exception TaskException Thrown in unrecoverable error. Likely this
* comes from file access failures. * comes from file access failures.
*/ */
protected boolean touchFile( File file, long timemillis )
protected void touchFile( File file, long timemillis )
throws TaskException throws TaskException
{ {


if( getProject().getJavaVersion() != Project.JAVA_1_1 )
{
Touch touch = (Touch)getProject().createTask( "touch" );
touch.setFile( file );
touch.setMillis( timemillis );
touch.touch();
return true;
}
else
{
return false;
}
Touch touch = (Touch)getProject().createTask( "touch" );
touch.setFile( file );
touch.setMillis( timemillis );
touch.touch();
} }


/** /**


+ 0
- 5
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Java.java View File

@@ -109,11 +109,6 @@ public class Java extends Task
this.fork = s; this.fork = s;
} }


public void setJVMVersion( String value )
{
cmdl.setVmversion( value );
}

/** /**
* set the jar name... * set the jar name...
* *


+ 2
- 2
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Javac.java View File

@@ -11,6 +11,7 @@ import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.api.JavaVersion;
import org.apache.myrmidon.framework.Os; import org.apache.myrmidon.framework.Os;
import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
@@ -894,8 +895,7 @@ public class Javac extends MatchingTask


if( compiler == null ) if( compiler == null )
{ {
if( Project.getJavaVersion() != Project.JAVA_1_1 &&
Project.getJavaVersion() != Project.JAVA_1_2 )
if( JavaVersion.JAVA1_2 != getJavaVersion() )
{ {
compiler = "modern"; compiler = "modern";
} }


+ 0
- 5
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/SignJar.java View File

@@ -249,11 +249,6 @@ public class SignJar extends Task
private void doOneJar( File jarSource, File jarTarget ) private void doOneJar( File jarSource, File jarTarget )
throws TaskException throws TaskException
{ {
if( getProject().getJavaVersion().equals( Project.JAVA_1_1 ) )
{
throw new TaskException( "The signjar task is only available on JDK versions 1.2 or greater" );
}

if( null == alias ) if( null == alias )
{ {
throw new TaskException( "alias attribute must be set" ); throw new TaskException( "alias attribute must be set" );


+ 0
- 11
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Touch.java View File

@@ -148,12 +148,6 @@ public class Touch extends Task
} }
} }


if( millis >= 0 && getProject().getJavaVersion() == Project.JAVA_1_1 )
{
getLogger().warn( "modification time of files cannot be set in JDK 1.1" );
return;
}

boolean resetMillis = false; boolean resetMillis = false;
if( millis < 0 ) if( millis < 0 )
{ {
@@ -201,11 +195,6 @@ public class Touch extends Task
throw new TaskException( "Can not change modification date of read-only file " + file ); throw new TaskException( "Can not change modification date of read-only file " + file );
} }


if( getProject().getJavaVersion() == Project.JAVA_1_1 )
{
return;
}

final long time = ( millis < 0 ) ? System.currentTimeMillis() : millis; final long time = ( millis < 0 ) ? System.currentTimeMillis() : millis;
file.setLastModified( time ); file.setLastModified( time );
} }


+ 21
- 66
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java View File

@@ -13,6 +13,7 @@ import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.api.JavaVersion;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Javac; import org.apache.tools.ant.taskdefs.Javac;
import org.apache.tools.ant.taskdefs.exec.Execute; import org.apache.tools.ant.taskdefs.exec.Execute;
@@ -125,12 +126,7 @@ public abstract class DefaultCompilerAdapter
throws TaskException throws TaskException
{ {
Path classpath = getCompileClasspath(); Path classpath = getCompileClasspath();

// we cannot be using Java 1.0 when forking, so we only have to
// distinguish between Java 1.1, and Java 1.2 and higher, as Java 1.1
// has its own parameter format
boolean usingJava1_1 = Project.getJavaVersion().equals( Project.JAVA_1_1 );
String memoryParameterPrefix = usingJava1_1 ? "-J-" : "-J-X";
String memoryParameterPrefix = "-J-X";
if( m_memoryInitialSize != null ) if( m_memoryInitialSize != null )
{ {
if( !m_attributes.isForkedJavac() ) if( !m_attributes.isForkedJavac() )
@@ -174,47 +170,27 @@ public abstract class DefaultCompilerAdapter
} }


cmd.createArgument().setValue( "-classpath" ); cmd.createArgument().setValue( "-classpath" );
cmd.createArgument().setPath( classpath );

cmd.createArgument().setValue( "-sourcepath" );
cmd.createArgument().setPath( src );


// Just add "sourcepath" to classpath ( for JDK1.1 )
// as well as "bootclasspath" and "extdirs"
if( Project.getJavaVersion().startsWith( "1.1" ) )
if( target != null )
{ {
Path cp = new Path();
/*
* XXX - This doesn't mix very well with build.systemclasspath,
*/
if( m_bootclasspath != null )
{
cp.append( m_bootclasspath );
}
if( m_extdirs != null )
{
cp.addExtdirs( m_extdirs );
}
cp.append( classpath );
cp.append( src );
cmd.createArgument().setPath( cp );
cmd.createArgument().setValue( "-target" );
cmd.createArgument().setValue( target );
} }
else

if( m_bootclasspath != null )
{ {
cmd.createArgument().setPath( classpath );
cmd.createArgument().setValue( "-sourcepath" );
cmd.createArgument().setPath( src );
if( target != null )
{
cmd.createArgument().setValue( "-target" );
cmd.createArgument().setValue( target );
}
if( m_bootclasspath != null )
{
cmd.createArgument().setValue( "-bootclasspath" );
cmd.createArgument().setPath( m_bootclasspath );
}
if( m_extdirs != null )
{
cmd.createArgument().setValue( "-extdirs" );
cmd.createArgument().setPath( m_extdirs );
}
cmd.createArgument().setValue( "-bootclasspath" );
cmd.createArgument().setPath( m_bootclasspath );
}

if( m_extdirs != null )
{
cmd.createArgument().setValue( "-extdirs" );
cmd.createArgument().setPath( m_extdirs );
} }


if( m_encoding != null ) if( m_encoding != null )
@@ -224,11 +200,8 @@ public abstract class DefaultCompilerAdapter
} }
if( m_debug ) if( m_debug )
{ {
if( useDebugLevel
&& Project.getJavaVersion() != Project.JAVA_1_0
&& Project.getJavaVersion() != Project.JAVA_1_1 )
if( useDebugLevel )
{ {

String debugLevel = m_attributes.getDebugLevel(); String debugLevel = m_attributes.getDebugLevel();
if( debugLevel != null ) if( debugLevel != null )
{ {
@@ -244,8 +217,7 @@ public abstract class DefaultCompilerAdapter
cmd.createArgument().setValue( "-g" ); cmd.createArgument().setValue( "-g" );
} }
} }
else if( Project.getJavaVersion() != Project.JAVA_1_0 &&
Project.getJavaVersion() != Project.JAVA_1_1 )
else
{ {
cmd.createArgument().setValue( "-g:none" ); cmd.createArgument().setValue( "-g:none" );
} }
@@ -254,23 +226,6 @@ public abstract class DefaultCompilerAdapter
cmd.createArgument().setValue( "-O" ); cmd.createArgument().setValue( "-O" );
} }


if( m_depend )
{
if( Project.getJavaVersion().startsWith( "1.1" ) )
{
cmd.createArgument().setValue( "-depend" );
}
else if( Project.getJavaVersion().startsWith( "1.2" ) )
{
cmd.createArgument().setValue( "-Xdepend" );
}
else
{
final String message = "depend attribute is not supported by the modern compiler";
getLogger().warn( message );
}
}

if( m_verbose ) if( m_verbose )
{ {
cmd.createArgument().setValue( "-verbose" ); cmd.createArgument().setValue( "-verbose" );


+ 10
- 21
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Javah.java View File

@@ -12,6 +12,7 @@ import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.api.JavaVersion;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;
@@ -267,8 +268,7 @@ public class Javah extends Task
String compiler = getProject().getProperty( "build.compiler" ); String compiler = getProject().getProperty( "build.compiler" );
if( compiler == null ) if( compiler == null )
{ {
if( Project.getJavaVersion() != Project.JAVA_1_1 &&
Project.getJavaVersion() != Project.JAVA_1_2 )
if( JavaVersion.JAVA1_2 != getJavaVersion() )
{ {
compiler = "modern"; compiler = "modern";
} }
@@ -353,28 +353,17 @@ public class Javah extends Task
cmd.createArgument().setPath( classpath ); cmd.createArgument().setPath( classpath );
} }


// JDK1.1 is rather simpler than JDK1.2
if( Project.getJavaVersion().startsWith( "1.1" ) )
if( verbose )
{ {
if( verbose )
{
cmd.createArgument().setValue( "-v" );
}
cmd.createArgument().setValue( "-verbose" );
} }
else
if( old )
{ {
if( verbose )
{
cmd.createArgument().setValue( "-verbose" );
}
if( old )
{
cmd.createArgument().setValue( "-old" );
}
if( force )
{
cmd.createArgument().setValue( "-force" );
}
cmd.createArgument().setValue( "-old" );
}
if( force )
{
cmd.createArgument().setValue( "-force" );
} }


if( stubs ) if( stubs )


+ 1
- 9
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java View File

@@ -20,7 +20,6 @@ import java.util.Properties;
import java.util.Random; import java.util.Random;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.AntClassLoader; import org.apache.tools.ant.AntClassLoader;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.exec.Execute; import org.apache.tools.ant.taskdefs.exec.Execute;
import org.apache.tools.ant.taskdefs.exec.LogOutputStream; import org.apache.tools.ant.taskdefs.exec.LogOutputStream;
@@ -265,14 +264,7 @@ public class JUnitTask extends Task
*/ */
public void setMaxmemory( String max ) public void setMaxmemory( String max )
{ {
if( Project.getJavaVersion().startsWith( "1.1" ) )
{
createJvmarg().setValue( "-mx" + max );
}
else
{
createJvmarg().setValue( "-Xmx" + max );
}
createJvmarg().setValue( "-Xmx" + max );
} }


/** /**


+ 1
- 9
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java View File

@@ -17,7 +17,6 @@ import java.util.Iterator;
import java.util.Random; import java.util.Random;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.exec.Execute; import org.apache.tools.ant.taskdefs.exec.Execute;
import org.apache.tools.ant.types.Argument; import org.apache.tools.ant.types.Argument;
@@ -119,14 +118,7 @@ public abstract class AbstractMetamataTask extends Task
*/ */
public void setMaxmemory( String max ) public void setMaxmemory( String max )
{ {
if( Project.getJavaVersion().startsWith( "1.1" ) )
{
createJvmarg().setValue( "-mx" + max );
}
else
{
createJvmarg().setValue( "-Xmx" + max );
}
createJvmarg().setValue( "-Xmx" + max );
} }


/** /**


+ 1
- 9
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java View File

@@ -14,7 +14,6 @@ import java.io.PrintWriter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Random; import java.util.Random;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.exec.Execute; import org.apache.tools.ant.taskdefs.exec.Execute;
import org.apache.tools.ant.taskdefs.exec.ExecuteStreamHandler; import org.apache.tools.ant.taskdefs.exec.ExecuteStreamHandler;
@@ -102,14 +101,7 @@ public class MParse extends Task
*/ */
public void setMaxmemory( String max ) public void setMaxmemory( String max )
{ {
if( Project.getJavaVersion().startsWith( "1.1" ) )
{
createJvmarg().setValue( "-mx" + max );
}
else
{
createJvmarg().setValue( "-Xmx" + max );
}
createJvmarg().setValue( "-Xmx" + max );
} }


/** /**


+ 2
- 13
proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java View File

@@ -12,7 +12,6 @@ import java.util.ArrayList;
import java.util.Random; import java.util.Random;
import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Rmic; import org.apache.tools.ant.taskdefs.Rmic;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Path;
@@ -113,18 +112,8 @@ public abstract class DefaultRmicAdapter


if( attributes.getExtdirs() != null ) if( attributes.getExtdirs() != null )
{ {
if( Project.getJavaVersion().startsWith( "1.1" ) )
{
/*
* XXX - This doesn't mix very well with build.systemclasspath,
*/
classpath.addExtdirs( attributes.getExtdirs() );
}
else
{
cmd.createArgument().setValue( "-extdirs" );
cmd.createArgument().setPath( attributes.getExtdirs() );
}
cmd.createArgument().setValue( "-extdirs" );
cmd.createArgument().setPath( attributes.getExtdirs() );
} }


cmd.createArgument().setValue( "-classpath" ); cmd.createArgument().setValue( "-classpath" );


+ 4
- 25
proposal/myrmidon/src/todo/org/apache/tools/ant/types/CommandlineJava.java View File

@@ -26,24 +26,21 @@ import org.apache.tools.ant.Project;
*/ */
public class CommandlineJava implements Cloneable public class CommandlineJava implements Cloneable
{ {

private Commandline vmCommand = new Commandline(); private Commandline vmCommand = new Commandline();
private Commandline javaCommand = new Commandline(); private Commandline javaCommand = new Commandline();
private SysProperties sysProperties = new SysProperties(); private SysProperties sysProperties = new SysProperties();
private Path classpath = null;
private String maxMemory = null;
private Path classpath;
private String maxMemory;


/** /**
* Indicate whether it will execute a jar file or not, in this case the * Indicate whether it will execute a jar file or not, in this case the
* first vm option must be a -jar and the 'executable' is a jar file. * first vm option must be a -jar and the 'executable' is a jar file.
*/ */
private boolean executeJar = false;
private String vmVersion;
private boolean executeJar;


public CommandlineJava() public CommandlineJava()
{ {
setVm( getJavaExecutableName() ); setVm( getJavaExecutableName() );
setVmversion( Project.getJavaVersion() );
} }


/** /**
@@ -89,11 +86,6 @@ public class CommandlineJava implements Cloneable
vmCommand.setExecutable( vm ); vmCommand.setExecutable( vm );
} }


public void setVmversion( String value )
{
vmVersion = value;
}

/** /**
* @return the name of the class to run or <tt>null</tt> if there is no * @return the name of the class to run or <tt>null</tt> if there is no
* class. * class.
@@ -185,11 +177,6 @@ public class CommandlineJava implements Cloneable
return getActualVMCommand(); return getActualVMCommand();
} }


public String getVmversion()
{
return vmVersion;
}

public void addSysproperty( EnvironmentVariable sysp ) public void addSysproperty( EnvironmentVariable sysp )
{ {
sysProperties.addVariable( sysp ); sysProperties.addVariable( sysp );
@@ -214,7 +201,6 @@ public class CommandlineJava implements Cloneable
{ {
c.classpath = (Path)classpath.clone(); c.classpath = (Path)classpath.clone();
} }
c.vmVersion = vmVersion;
c.executeJar = executeJar; c.executeJar = executeJar;
return c; return c;
} }
@@ -285,14 +271,7 @@ public class CommandlineJava implements Cloneable
Commandline actualVMCommand = (Commandline)vmCommand.clone(); Commandline actualVMCommand = (Commandline)vmCommand.clone();
if( maxMemory != null ) if( maxMemory != null )
{ {
if( vmVersion.startsWith( "1.1" ) )
{
actualVMCommand.createArgument().setValue( "-mx" + maxMemory );
}
else
{
actualVMCommand.createArgument().setValue( "-Xmx" + maxMemory );
}
actualVMCommand.createArgument().setValue( "-Xmx" + maxMemory );
} }
return actualVMCommand; return actualVMCommand;
} }


+ 0
- 6
proposal/myrmidon/src/todo/org/apache/tools/ant/types/Path.java View File

@@ -353,12 +353,6 @@ public class Path
kaffeJarFiles.setIncludes( "*.jar" ); kaffeJarFiles.setIncludes( "*.jar" );
addFileset( kaffeJarFiles ); addFileset( kaffeJarFiles );
} }
else if( Project.getJavaVersion() == Project.JAVA_1_1 )
{
final String classes = System.getProperty( "java.home" ) +
File.separator + "lib" + File.separator + "classes.zip";
addExisting( new Path( classes ) );
}
else else
{ {
// JDK > 1.1 seems to set java.home to the JRE directory. // JDK > 1.1 seems to set java.home to the JRE directory.


Loading…
Cancel
Save