debuglevel. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269986 13f79535-47bb-0310-9956-ffa450edef68master
@@ -49,8 +49,10 @@ Other changes: | |||||
select files from an archive for extraction. Filesets may be | select files from an archive for extraction. Filesets may be | ||||
used to select archived files for unarchival. | used to select archived files for unarchival. | ||||
* Javac task allows debug levels to be spcified. Debug levels | |||||
will have an effect only when the modern compiler is used. | |||||
* Javac task allows debug levels to be specified. Debug levels | |||||
will have an effect only when the modern compiler or the | |||||
classic compiler (version 1.2 and higher) is used and debugging | |||||
is enabled. | |||||
* Mail task allows specification of port number. | * Mail task allows specification of port number. | ||||
@@ -231,10 +231,12 @@ files/directories from the CLASSPATH it passes to the compiler.</p> | |||||
<td valign="top">debuglevel</td> | <td valign="top">debuglevel</td> | ||||
<td valign="top">Keyword list to be appended to the <code>-g</code> command line | <td valign="top">Keyword list to be appended to the <code>-g</code> command line | ||||
switch. This will be ignored by all implementations except | switch. This will be ignored by all implementations except | ||||
<code>modern</code>, 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 <code>-g</code> | |||||
<code>modern</code> and <code>classic(ver >= 1.2)</code>, 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 <code>-g</code>. If debug is not turned on, this attribute will be | |||||
ignored. | |||||
</td> | </td> | ||||
<td align="center" valign="top">No</td> | <td align="center" valign="top">No</td> | ||||
</tr> | </tr> | ||||
@@ -262,7 +262,10 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||||
cmd.createArgument().setValue(encoding); | cmd.createArgument().setValue(encoding); | ||||
} | } | ||||
if (debug) { | if (debug) { | ||||
if (useDebugLevel) { | |||||
if (useDebugLevel | |||||
&& Project.getJavaVersion() != Project.JAVA_1_0 | |||||
&& Project.getJavaVersion() != Project.JAVA_1_1) { | |||||
String debugLevel = attributes.getDebugLevel(); | String debugLevel = attributes.getDebugLevel(); | ||||
if (debugLevel != null) { | if (debugLevel != null) { | ||||
cmd.createArgument().setValue("-g:" + debugLevel); | cmd.createArgument().setValue("-g:" + debugLevel); | ||||
@@ -325,13 +328,17 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||||
return cmd; | return cmd; | ||||
} | } | ||||
protected Commandline setupJavacCommand() { | |||||
return setupJavacCommand(false); | |||||
} | |||||
/** | /** | ||||
* Does the command line argument processing for classic and adds | * Does the command line argument processing for classic and adds | ||||
* the files to compile as well. | * the files to compile as well. | ||||
*/ | */ | ||||
protected Commandline setupJavacCommand() { | |||||
protected Commandline setupJavacCommand(boolean debugLevelCheck) { | |||||
Commandline cmd = new Commandline(); | Commandline cmd = new Commandline(); | ||||
setupJavacCommandlineSwitches(cmd); | |||||
setupJavacCommandlineSwitches(cmd, debugLevelCheck); | |||||
logAndAddFilesToCompile(cmd); | logAndAddFilesToCompile(cmd); | ||||
return cmd; | return cmd; | ||||
} | } | ||||
@@ -71,14 +71,14 @@ import java.lang.reflect.Method; | |||||
* | * | ||||
* @author James Davidson <a href="mailto:duncan@x180.com">duncan@x180.com</a> | * @author James Davidson <a href="mailto:duncan@x180.com">duncan@x180.com</a> | ||||
* @author Robin Green <a href="mailto:greenrd@hotmail.com">greenrd@hotmail.com</a> | * @author Robin Green <a href="mailto:greenrd@hotmail.com">greenrd@hotmail.com</a> | ||||
* @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a> | |||||
* @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a> | |||||
* @author <a href="mailto:jayglanville@home.com">J D Glanville</a> | * @author <a href="mailto:jayglanville@home.com">J D Glanville</a> | ||||
*/ | */ | ||||
public class Javac12 extends DefaultCompilerAdapter { | public class Javac12 extends DefaultCompilerAdapter { | ||||
public boolean execute() throws BuildException { | public boolean execute() throws BuildException { | ||||
attributes.log("Using classic compiler", Project.MSG_VERBOSE); | attributes.log("Using classic compiler", Project.MSG_VERBOSE); | ||||
Commandline cmd = setupJavacCommand(); | |||||
Commandline cmd = setupJavacCommand(true); | |||||
OutputStream logstr = new LogOutputStream(attributes, Project.MSG_WARN); | OutputStream logstr = new LogOutputStream(attributes, Project.MSG_WARN); | ||||
try { | try { | ||||