diff --git a/WHATSNEW b/WHATSNEW index 165ff0b1e..05787d5b1 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -41,6 +41,10 @@ Fixed bugs: Other changes: -------------- +* Javac task allows debug levels to be spcified. Debug levels + will have an effect only when the modern compiler is used. + +* Mail task allows specification of port number. * Added support for specifying CVS_RSH in the task diff --git a/docs/manual/CoreTasks/javac.html b/docs/manual/CoreTasks/javac.html index e71127e9a..4a0b29065 100644 --- a/docs/manual/CoreTasks/javac.html +++ b/docs/manual/CoreTasks/javac.html @@ -178,40 +178,40 @@ files/directories from the CLASSPATH it passes to the compiler.

No - includeAntRuntime + includeAntRuntime whether to include the Ant run-time libraries; defaults to yes. No - includeJavaRuntime + includeJavaRuntime whether to include the default run-time libraries from the executing VM; defaults to no. No - fork + fork whether to execute Javac using the JDK compiler externally; defaults to no. You can also give a complete path to the javac executable to use instead of yes, which would run the compiler of the Java vesrion that is currently running Ant. No - + - memoryInitialSize + memoryInitialSize the initial size of the memory for the underlying VM, if javac is run externally, ignored otherwise; defaults to the standard VM memory setting. (examples: 83886080, 81920k, or 80m) No - + - memoryMaximumSize + memoryMaximumSize the maximum size of the memory for the underlying VM, if javac is run externally, ignored otherwise; defaults to the standard VM memory setting. (examples: 83886080, 81920k, or 80m) No - + failonerror indicates whether the build will continue even if there are compilation errors; defaults to true. @@ -219,14 +219,25 @@ files/directories from the CLASSPATH it passes to the compiler.

No - source + source Value of the -source command line switch, will be ignored by all implementations except modern, legal values are "1.3" and "1.4" - by default, no -source argument will be used at all. No - + + + debuglevel + Keyword list to be appended to the -g command line + switch. This will be ignored by all implementations except + modern, legal values are "none" or a comma separated list of + the following keywords. Valid keywords are "lines", "vars" and + "source" - if debuglevel is not specified, by default, nothing will be + appended to -g + + No +

Parameters specified as nested elements

@@ -259,21 +270,21 @@ used.

Required - value + value See here Exactly one of these. - line + line - file + file - path + path - implementation + implementation Only use this argument if the chosen implementation matches this attribute. Possible choices are the same as those of the build.compiler property. @@ -355,7 +366,7 @@ This problem may occur with all JDKs < 1.2.

Note: If you wish to compile only source-files located in some packages below a common root you should not include these packages in the srcdir-attribute. Use include/exclude-attributes -or elements to filter for these packages. If you include part of your package-structure inside the srcdir-attribute +or elements to filter for these packages. If you include part of your package-structure inside the srcdir-attribute (or nested src-elements) Ant will start to recompile your sources every time you call it.

Jikes Notes

@@ -371,7 +382,7 @@ build.compiler.warnings is "true" while all others are "false&quo build.compiler.emacs - + Enable emacs compatible error messages @@ -381,7 +392,7 @@ build.compiler.warnings is "true" while all others are "false&quo build.compiler.warnings
This property has been deprecated, use the nowarn attribute instead - + don't disable warning messages @@ -389,7 +400,7 @@ build.compiler.warnings is "true" while all others are "false&quo build.compiler.pedantic - + enable pedantic warnings @@ -397,9 +408,9 @@ build.compiler.warnings is "true" while all others are "false&quo build.compiler.fulldepend - + - enable full dependency checking,
+ enable full dependency checking,
"+F" in the jikes manual. diff --git a/src/main/org/apache/tools/ant/taskdefs/Javac.java b/src/main/org/apache/tools/ant/taskdefs/Javac.java index 8f706b6c6..ca91c9d13 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Javac.java +++ b/src/main/org/apache/tools/ant/taskdefs/Javac.java @@ -133,7 +133,24 @@ public class Javac extends MatchingTask { protected File[] compileList = new File[0]; private String source; + private String debugLevel; + /** + * Get the value of debugLevel. + * @return value of debugLevel. + */ + public String getDebugLevel() { + return debugLevel; + } + + /** + * Set the value of debugLevel. + * @param v Value to assign to debugLevel. + */ + public void setDebugLevel(String v) { + this.debugLevel = v; + } + /** * Get the value of source. * @return value of source. diff --git a/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java b/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java index 6cce50444..bdd4d6aa0 100644 --- a/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java +++ b/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java @@ -173,11 +173,16 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { return classpath; } + protected Commandline setupJavacCommandlineSwitches(Commandline cmd) { + return setupJavacCommandlineSwitches(cmd, false); + } + /** * Does the command line argument processing common to classic and * modern. Doesn't add the files to compile. */ - protected Commandline setupJavacCommandlineSwitches(Commandline cmd) { + protected Commandline setupJavacCommandlineSwitches(Commandline cmd, + boolean useDebugLevel) { Path classpath = getCompileClasspath(); // we cannot be using Java 1.0 when forking, so we only have to @@ -257,7 +262,16 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { cmd.createArgument().setValue(encoding); } if (debug) { - cmd.createArgument().setValue("-g"); + if (useDebugLevel) { + String debugLevel = attributes.getDebugLevel(); + if (debugLevel != null) { + cmd.createArgument().setValue("-g:" + debugLevel); + } else { + cmd.createArgument().setValue("-g"); + } + } else { + cmd.createArgument().setValue("-g"); + } } else if (Project.getJavaVersion() != Project.JAVA_1_0 && Project.getJavaVersion() != Project.JAVA_1_1) { cmd.createArgument().setValue("-g:none"); @@ -291,7 +305,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { * add the files to compile. */ protected Commandline setupModernJavacCommandlineSwitches(Commandline cmd) { - setupJavacCommandlineSwitches(cmd); + setupJavacCommandlineSwitches(cmd, true); if (attributes.getSource() != null) { cmd.createArgument().setValue("-source"); cmd.createArgument().setValue(attributes.getSource());