git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270442 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -114,16 +114,6 @@ public class Project | |||
| 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 | |||
| * either "on", "true", or "yes" is found, ignoring case. | |||
| @@ -138,28 +128,6 @@ public class Project | |||
| 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 | |||
| * | |||
| @@ -139,12 +139,6 @@ public class GenerateKey | |||
| public void execute() | |||
| 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 ) | |||
| { | |||
| throw new TaskException( "alias attribute must be set" ); | |||
| @@ -16,7 +16,6 @@ import java.net.URL; | |||
| import java.net.URLConnection; | |||
| import java.util.Date; | |||
| import org.apache.myrmidon.api.TaskException; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.Task; | |||
| /** | |||
| @@ -95,10 +94,7 @@ public class Get extends Task | |||
| */ | |||
| 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 | |||
| * comes from file access failures. | |||
| */ | |||
| protected boolean touchFile( File file, long timemillis ) | |||
| protected void touchFile( File file, long timemillis ) | |||
| 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(); | |||
| } | |||
| /** | |||
| @@ -109,11 +109,6 @@ public class Java extends Task | |||
| this.fork = s; | |||
| } | |||
| public void setJVMVersion( String value ) | |||
| { | |||
| cmdl.setVmversion( value ); | |||
| } | |||
| /** | |||
| * set the jar name... | |||
| * | |||
| @@ -11,6 +11,7 @@ import java.io.File; | |||
| import java.util.ArrayList; | |||
| import java.util.Iterator; | |||
| import org.apache.myrmidon.api.TaskException; | |||
| import org.apache.myrmidon.api.JavaVersion; | |||
| import org.apache.myrmidon.framework.Os; | |||
| import org.apache.tools.ant.DirectoryScanner; | |||
| import org.apache.tools.ant.Project; | |||
| @@ -894,8 +895,7 @@ public class Javac extends MatchingTask | |||
| if( compiler == null ) | |||
| { | |||
| if( Project.getJavaVersion() != Project.JAVA_1_1 && | |||
| Project.getJavaVersion() != Project.JAVA_1_2 ) | |||
| if( JavaVersion.JAVA1_2 != getJavaVersion() ) | |||
| { | |||
| compiler = "modern"; | |||
| } | |||
| @@ -249,11 +249,6 @@ public class SignJar extends Task | |||
| private void doOneJar( File jarSource, File jarTarget ) | |||
| 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 ) | |||
| { | |||
| throw new TaskException( "alias attribute must be set" ); | |||
| @@ -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; | |||
| 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 ); | |||
| } | |||
| if( getProject().getJavaVersion() == Project.JAVA_1_1 ) | |||
| { | |||
| return; | |||
| } | |||
| final long time = ( millis < 0 ) ? System.currentTimeMillis() : millis; | |||
| file.setLastModified( time ); | |||
| } | |||
| @@ -13,6 +13,7 @@ import java.io.IOException; | |||
| import java.io.PrintWriter; | |||
| import org.apache.avalon.framework.logger.AbstractLogEnabled; | |||
| import org.apache.myrmidon.api.TaskException; | |||
| import org.apache.myrmidon.api.JavaVersion; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.taskdefs.Javac; | |||
| import org.apache.tools.ant.taskdefs.exec.Execute; | |||
| @@ -125,12 +126,7 @@ public abstract class DefaultCompilerAdapter | |||
| throws TaskException | |||
| { | |||
| 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_attributes.isForkedJavac() ) | |||
| @@ -174,47 +170,27 @@ public abstract class DefaultCompilerAdapter | |||
| } | |||
| 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 ) | |||
| @@ -224,11 +200,8 @@ public abstract class DefaultCompilerAdapter | |||
| } | |||
| if( m_debug ) | |||
| { | |||
| if( useDebugLevel | |||
| && Project.getJavaVersion() != Project.JAVA_1_0 | |||
| && Project.getJavaVersion() != Project.JAVA_1_1 ) | |||
| if( useDebugLevel ) | |||
| { | |||
| String debugLevel = m_attributes.getDebugLevel(); | |||
| if( debugLevel != null ) | |||
| { | |||
| @@ -244,8 +217,7 @@ public abstract class DefaultCompilerAdapter | |||
| cmd.createArgument().setValue( "-g" ); | |||
| } | |||
| } | |||
| else if( Project.getJavaVersion() != Project.JAVA_1_0 && | |||
| Project.getJavaVersion() != Project.JAVA_1_1 ) | |||
| else | |||
| { | |||
| cmd.createArgument().setValue( "-g:none" ); | |||
| } | |||
| @@ -254,23 +226,6 @@ public abstract class DefaultCompilerAdapter | |||
| 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 ) | |||
| { | |||
| cmd.createArgument().setValue( "-verbose" ); | |||
| @@ -12,6 +12,7 @@ import java.util.ArrayList; | |||
| import java.util.Iterator; | |||
| import java.util.StringTokenizer; | |||
| import org.apache.myrmidon.api.TaskException; | |||
| import org.apache.myrmidon.api.JavaVersion; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.Task; | |||
| import org.apache.tools.ant.types.Commandline; | |||
| @@ -267,8 +268,7 @@ public class Javah extends Task | |||
| String compiler = getProject().getProperty( "build.compiler" ); | |||
| if( compiler == null ) | |||
| { | |||
| if( Project.getJavaVersion() != Project.JAVA_1_1 && | |||
| Project.getJavaVersion() != Project.JAVA_1_2 ) | |||
| if( JavaVersion.JAVA1_2 != getJavaVersion() ) | |||
| { | |||
| compiler = "modern"; | |||
| } | |||
| @@ -353,28 +353,17 @@ public class Javah extends Task | |||
| 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 ) | |||
| @@ -20,7 +20,6 @@ import java.util.Properties; | |||
| import java.util.Random; | |||
| import org.apache.myrmidon.api.TaskException; | |||
| import org.apache.tools.ant.AntClassLoader; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.Task; | |||
| import org.apache.tools.ant.taskdefs.exec.Execute; | |||
| import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | |||
| @@ -265,14 +264,7 @@ public class JUnitTask extends Task | |||
| */ | |||
| public void setMaxmemory( String max ) | |||
| { | |||
| if( Project.getJavaVersion().startsWith( "1.1" ) ) | |||
| { | |||
| createJvmarg().setValue( "-mx" + max ); | |||
| } | |||
| else | |||
| { | |||
| createJvmarg().setValue( "-Xmx" + max ); | |||
| } | |||
| createJvmarg().setValue( "-Xmx" + max ); | |||
| } | |||
| /** | |||
| @@ -17,7 +17,6 @@ import java.util.Iterator; | |||
| import java.util.Random; | |||
| import org.apache.myrmidon.api.TaskException; | |||
| import org.apache.tools.ant.DirectoryScanner; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.Task; | |||
| import org.apache.tools.ant.taskdefs.exec.Execute; | |||
| import org.apache.tools.ant.types.Argument; | |||
| @@ -119,14 +118,7 @@ public abstract class AbstractMetamataTask extends Task | |||
| */ | |||
| public void setMaxmemory( String max ) | |||
| { | |||
| if( Project.getJavaVersion().startsWith( "1.1" ) ) | |||
| { | |||
| createJvmarg().setValue( "-mx" + max ); | |||
| } | |||
| else | |||
| { | |||
| createJvmarg().setValue( "-Xmx" + max ); | |||
| } | |||
| createJvmarg().setValue( "-Xmx" + max ); | |||
| } | |||
| /** | |||
| @@ -14,7 +14,6 @@ import java.io.PrintWriter; | |||
| import java.util.ArrayList; | |||
| import java.util.Random; | |||
| import org.apache.myrmidon.api.TaskException; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.Task; | |||
| import org.apache.tools.ant.taskdefs.exec.Execute; | |||
| import org.apache.tools.ant.taskdefs.exec.ExecuteStreamHandler; | |||
| @@ -102,14 +101,7 @@ public class MParse extends Task | |||
| */ | |||
| public void setMaxmemory( String max ) | |||
| { | |||
| if( Project.getJavaVersion().startsWith( "1.1" ) ) | |||
| { | |||
| createJvmarg().setValue( "-mx" + max ); | |||
| } | |||
| else | |||
| { | |||
| createJvmarg().setValue( "-Xmx" + max ); | |||
| } | |||
| createJvmarg().setValue( "-Xmx" + max ); | |||
| } | |||
| /** | |||
| @@ -12,7 +12,6 @@ import java.util.ArrayList; | |||
| import java.util.Random; | |||
| import org.apache.avalon.framework.logger.AbstractLogEnabled; | |||
| import org.apache.myrmidon.api.TaskException; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.taskdefs.Rmic; | |||
| import org.apache.tools.ant.types.Commandline; | |||
| import org.apache.tools.ant.types.Path; | |||
| @@ -113,18 +112,8 @@ public abstract class DefaultRmicAdapter | |||
| 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" ); | |||
| @@ -26,24 +26,21 @@ import org.apache.tools.ant.Project; | |||
| */ | |||
| public class CommandlineJava implements Cloneable | |||
| { | |||
| private Commandline vmCommand = new Commandline(); | |||
| private Commandline javaCommand = new Commandline(); | |||
| 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 | |||
| * 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() | |||
| { | |||
| setVm( getJavaExecutableName() ); | |||
| setVmversion( Project.getJavaVersion() ); | |||
| } | |||
| /** | |||
| @@ -89,11 +86,6 @@ public class CommandlineJava implements Cloneable | |||
| 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 | |||
| * class. | |||
| @@ -185,11 +177,6 @@ public class CommandlineJava implements Cloneable | |||
| return getActualVMCommand(); | |||
| } | |||
| public String getVmversion() | |||
| { | |||
| return vmVersion; | |||
| } | |||
| public void addSysproperty( EnvironmentVariable sysp ) | |||
| { | |||
| sysProperties.addVariable( sysp ); | |||
| @@ -214,7 +201,6 @@ public class CommandlineJava implements Cloneable | |||
| { | |||
| c.classpath = (Path)classpath.clone(); | |||
| } | |||
| c.vmVersion = vmVersion; | |||
| c.executeJar = executeJar; | |||
| return c; | |||
| } | |||
| @@ -285,14 +271,7 @@ public class CommandlineJava implements Cloneable | |||
| Commandline actualVMCommand = (Commandline)vmCommand.clone(); | |||
| 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; | |||
| } | |||
| @@ -353,12 +353,6 @@ public class Path | |||
| kaffeJarFiles.setIncludes( "*.jar" ); | |||
| 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 | |||
| { | |||
| // JDK > 1.1 seems to set java.home to the JRE directory. | |||
| @@ -114,16 +114,6 @@ public class Project | |||
| 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 | |||
| * either "on", "true", or "yes" is found, ignoring case. | |||
| @@ -138,28 +128,6 @@ public class Project | |||
| 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 | |||
| * | |||
| @@ -139,12 +139,6 @@ public class GenerateKey | |||
| public void execute() | |||
| 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 ) | |||
| { | |||
| throw new TaskException( "alias attribute must be set" ); | |||
| @@ -16,7 +16,6 @@ import java.net.URL; | |||
| import java.net.URLConnection; | |||
| import java.util.Date; | |||
| import org.apache.myrmidon.api.TaskException; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.Task; | |||
| /** | |||
| @@ -95,10 +94,7 @@ public class Get extends Task | |||
| */ | |||
| 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 | |||
| * comes from file access failures. | |||
| */ | |||
| protected boolean touchFile( File file, long timemillis ) | |||
| protected void touchFile( File file, long timemillis ) | |||
| 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(); | |||
| } | |||
| /** | |||
| @@ -109,11 +109,6 @@ public class Java extends Task | |||
| this.fork = s; | |||
| } | |||
| public void setJVMVersion( String value ) | |||
| { | |||
| cmdl.setVmversion( value ); | |||
| } | |||
| /** | |||
| * set the jar name... | |||
| * | |||
| @@ -11,6 +11,7 @@ import java.io.File; | |||
| import java.util.ArrayList; | |||
| import java.util.Iterator; | |||
| import org.apache.myrmidon.api.TaskException; | |||
| import org.apache.myrmidon.api.JavaVersion; | |||
| import org.apache.myrmidon.framework.Os; | |||
| import org.apache.tools.ant.DirectoryScanner; | |||
| import org.apache.tools.ant.Project; | |||
| @@ -894,8 +895,7 @@ public class Javac extends MatchingTask | |||
| if( compiler == null ) | |||
| { | |||
| if( Project.getJavaVersion() != Project.JAVA_1_1 && | |||
| Project.getJavaVersion() != Project.JAVA_1_2 ) | |||
| if( JavaVersion.JAVA1_2 != getJavaVersion() ) | |||
| { | |||
| compiler = "modern"; | |||
| } | |||
| @@ -249,11 +249,6 @@ public class SignJar extends Task | |||
| private void doOneJar( File jarSource, File jarTarget ) | |||
| 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 ) | |||
| { | |||
| throw new TaskException( "alias attribute must be set" ); | |||
| @@ -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; | |||
| 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 ); | |||
| } | |||
| if( getProject().getJavaVersion() == Project.JAVA_1_1 ) | |||
| { | |||
| return; | |||
| } | |||
| final long time = ( millis < 0 ) ? System.currentTimeMillis() : millis; | |||
| file.setLastModified( time ); | |||
| } | |||
| @@ -13,6 +13,7 @@ import java.io.IOException; | |||
| import java.io.PrintWriter; | |||
| import org.apache.avalon.framework.logger.AbstractLogEnabled; | |||
| import org.apache.myrmidon.api.TaskException; | |||
| import org.apache.myrmidon.api.JavaVersion; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.taskdefs.Javac; | |||
| import org.apache.tools.ant.taskdefs.exec.Execute; | |||
| @@ -125,12 +126,7 @@ public abstract class DefaultCompilerAdapter | |||
| throws TaskException | |||
| { | |||
| 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_attributes.isForkedJavac() ) | |||
| @@ -174,47 +170,27 @@ public abstract class DefaultCompilerAdapter | |||
| } | |||
| 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 ) | |||
| @@ -224,11 +200,8 @@ public abstract class DefaultCompilerAdapter | |||
| } | |||
| if( m_debug ) | |||
| { | |||
| if( useDebugLevel | |||
| && Project.getJavaVersion() != Project.JAVA_1_0 | |||
| && Project.getJavaVersion() != Project.JAVA_1_1 ) | |||
| if( useDebugLevel ) | |||
| { | |||
| String debugLevel = m_attributes.getDebugLevel(); | |||
| if( debugLevel != null ) | |||
| { | |||
| @@ -244,8 +217,7 @@ public abstract class DefaultCompilerAdapter | |||
| cmd.createArgument().setValue( "-g" ); | |||
| } | |||
| } | |||
| else if( Project.getJavaVersion() != Project.JAVA_1_0 && | |||
| Project.getJavaVersion() != Project.JAVA_1_1 ) | |||
| else | |||
| { | |||
| cmd.createArgument().setValue( "-g:none" ); | |||
| } | |||
| @@ -254,23 +226,6 @@ public abstract class DefaultCompilerAdapter | |||
| 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 ) | |||
| { | |||
| cmd.createArgument().setValue( "-verbose" ); | |||
| @@ -12,6 +12,7 @@ import java.util.ArrayList; | |||
| import java.util.Iterator; | |||
| import java.util.StringTokenizer; | |||
| import org.apache.myrmidon.api.TaskException; | |||
| import org.apache.myrmidon.api.JavaVersion; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.Task; | |||
| import org.apache.tools.ant.types.Commandline; | |||
| @@ -267,8 +268,7 @@ public class Javah extends Task | |||
| String compiler = getProject().getProperty( "build.compiler" ); | |||
| if( compiler == null ) | |||
| { | |||
| if( Project.getJavaVersion() != Project.JAVA_1_1 && | |||
| Project.getJavaVersion() != Project.JAVA_1_2 ) | |||
| if( JavaVersion.JAVA1_2 != getJavaVersion() ) | |||
| { | |||
| compiler = "modern"; | |||
| } | |||
| @@ -353,28 +353,17 @@ public class Javah extends Task | |||
| 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 ) | |||
| @@ -20,7 +20,6 @@ import java.util.Properties; | |||
| import java.util.Random; | |||
| import org.apache.myrmidon.api.TaskException; | |||
| import org.apache.tools.ant.AntClassLoader; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.Task; | |||
| import org.apache.tools.ant.taskdefs.exec.Execute; | |||
| import org.apache.tools.ant.taskdefs.exec.LogOutputStream; | |||
| @@ -265,14 +264,7 @@ public class JUnitTask extends Task | |||
| */ | |||
| public void setMaxmemory( String max ) | |||
| { | |||
| if( Project.getJavaVersion().startsWith( "1.1" ) ) | |||
| { | |||
| createJvmarg().setValue( "-mx" + max ); | |||
| } | |||
| else | |||
| { | |||
| createJvmarg().setValue( "-Xmx" + max ); | |||
| } | |||
| createJvmarg().setValue( "-Xmx" + max ); | |||
| } | |||
| /** | |||
| @@ -17,7 +17,6 @@ import java.util.Iterator; | |||
| import java.util.Random; | |||
| import org.apache.myrmidon.api.TaskException; | |||
| import org.apache.tools.ant.DirectoryScanner; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.Task; | |||
| import org.apache.tools.ant.taskdefs.exec.Execute; | |||
| import org.apache.tools.ant.types.Argument; | |||
| @@ -119,14 +118,7 @@ public abstract class AbstractMetamataTask extends Task | |||
| */ | |||
| public void setMaxmemory( String max ) | |||
| { | |||
| if( Project.getJavaVersion().startsWith( "1.1" ) ) | |||
| { | |||
| createJvmarg().setValue( "-mx" + max ); | |||
| } | |||
| else | |||
| { | |||
| createJvmarg().setValue( "-Xmx" + max ); | |||
| } | |||
| createJvmarg().setValue( "-Xmx" + max ); | |||
| } | |||
| /** | |||
| @@ -14,7 +14,6 @@ import java.io.PrintWriter; | |||
| import java.util.ArrayList; | |||
| import java.util.Random; | |||
| import org.apache.myrmidon.api.TaskException; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.Task; | |||
| import org.apache.tools.ant.taskdefs.exec.Execute; | |||
| import org.apache.tools.ant.taskdefs.exec.ExecuteStreamHandler; | |||
| @@ -102,14 +101,7 @@ public class MParse extends Task | |||
| */ | |||
| public void setMaxmemory( String max ) | |||
| { | |||
| if( Project.getJavaVersion().startsWith( "1.1" ) ) | |||
| { | |||
| createJvmarg().setValue( "-mx" + max ); | |||
| } | |||
| else | |||
| { | |||
| createJvmarg().setValue( "-Xmx" + max ); | |||
| } | |||
| createJvmarg().setValue( "-Xmx" + max ); | |||
| } | |||
| /** | |||
| @@ -12,7 +12,6 @@ import java.util.ArrayList; | |||
| import java.util.Random; | |||
| import org.apache.avalon.framework.logger.AbstractLogEnabled; | |||
| import org.apache.myrmidon.api.TaskException; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.taskdefs.Rmic; | |||
| import org.apache.tools.ant.types.Commandline; | |||
| import org.apache.tools.ant.types.Path; | |||
| @@ -113,18 +112,8 @@ public abstract class DefaultRmicAdapter | |||
| 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" ); | |||
| @@ -26,24 +26,21 @@ import org.apache.tools.ant.Project; | |||
| */ | |||
| public class CommandlineJava implements Cloneable | |||
| { | |||
| private Commandline vmCommand = new Commandline(); | |||
| private Commandline javaCommand = new Commandline(); | |||
| 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 | |||
| * 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() | |||
| { | |||
| setVm( getJavaExecutableName() ); | |||
| setVmversion( Project.getJavaVersion() ); | |||
| } | |||
| /** | |||
| @@ -89,11 +86,6 @@ public class CommandlineJava implements Cloneable | |||
| 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 | |||
| * class. | |||
| @@ -185,11 +177,6 @@ public class CommandlineJava implements Cloneable | |||
| return getActualVMCommand(); | |||
| } | |||
| public String getVmversion() | |||
| { | |||
| return vmVersion; | |||
| } | |||
| public void addSysproperty( EnvironmentVariable sysp ) | |||
| { | |||
| sysProperties.addVariable( sysp ); | |||
| @@ -214,7 +201,6 @@ public class CommandlineJava implements Cloneable | |||
| { | |||
| c.classpath = (Path)classpath.clone(); | |||
| } | |||
| c.vmVersion = vmVersion; | |||
| c.executeJar = executeJar; | |||
| return c; | |||
| } | |||
| @@ -285,14 +271,7 @@ public class CommandlineJava implements Cloneable | |||
| Commandline actualVMCommand = (Commandline)vmCommand.clone(); | |||
| 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; | |||
| } | |||
| @@ -353,12 +353,6 @@ public class Path | |||
| kaffeJarFiles.setIncludes( "*.jar" ); | |||
| 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 | |||
| { | |||
| // JDK > 1.1 seems to set java.home to the JRE directory. | |||