Browse Source

Classic compiler, so long as it is not Version 1.0 or 1.1.x, also recognizes

debuglevel.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269986 13f79535-47bb-0310-9956-ffa450edef68
master
Magesh Umasankar 23 years ago
parent
commit
b7f51d116b
4 changed files with 22 additions and 11 deletions
  1. +4
    -2
      WHATSNEW
  2. +6
    -4
      docs/manual/CoreTasks/javac.html
  3. +10
    -3
      src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
  4. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/compilers/Javac12.java

+ 4
- 2
WHATSNEW View File

@@ -49,8 +49,10 @@ Other changes:
select files from an archive for extraction. Filesets may be
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.



+ 6
- 4
docs/manual/CoreTasks/javac.html View File

@@ -231,10 +231,12 @@ files/directories from the CLASSPATH it passes to the compiler.</p>
<td valign="top">debuglevel</td>
<td valign="top">Keyword list to be appended to the <code>-g</code> command line
switch. This will be ignored by all implementations except
<code>modern</code>, legal values are &quot;none&quot; or a comma separated list of
the following keywords. Valid keywords are &quot;lines&quot;, &quot;vars&quot; and
&quot;source&quot; - 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
&quot;none&quot; or a comma separated list of the following keywords.
Valid keywords are &quot;lines&quot;, &quot;vars&quot; and &quot;source&quot;
- 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 align="center" valign="top">No</td>
</tr>


+ 10
- 3
src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java View File

@@ -262,7 +262,10 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter {
cmd.createArgument().setValue(encoding);
}
if (debug) {
if (useDebugLevel) {
if (useDebugLevel
&& Project.getJavaVersion() != Project.JAVA_1_0
&& Project.getJavaVersion() != Project.JAVA_1_1) {

String debugLevel = attributes.getDebugLevel();
if (debugLevel != null) {
cmd.createArgument().setValue("-g:" + debugLevel);
@@ -325,13 +328,17 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter {
return cmd;
}

protected Commandline setupJavacCommand() {
return setupJavacCommand(false);
}

/**
* Does the command line argument processing for classic and adds
* the files to compile as well.
*/
protected Commandline setupJavacCommand() {
protected Commandline setupJavacCommand(boolean debugLevelCheck) {
Commandline cmd = new Commandline();
setupJavacCommandlineSwitches(cmd);
setupJavacCommandlineSwitches(cmd, debugLevelCheck);
logAndAddFilesToCompile(cmd);
return cmd;
}


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/compilers/Javac12.java View File

@@ -71,14 +71,14 @@ import java.lang.reflect.Method;
*
* @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 <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>
*/
public class Javac12 extends DefaultCompilerAdapter {

public boolean execute() throws BuildException {
attributes.log("Using classic compiler", Project.MSG_VERBOSE);
Commandline cmd = setupJavacCommand();
Commandline cmd = setupJavacCommand(true);

OutputStream logstr = new LogOutputStream(attributes, Project.MSG_WARN);
try {


Loading…
Cancel
Save