Browse Source

New debuglevel attribute for Javac - will be used only when the modern

complier is used.

PR: 4127


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269971 13f79535-47bb-0310-9956-ffa450edef68
master
Magesh Umasankar 23 years ago
parent
commit
072028843a
4 changed files with 70 additions and 24 deletions
  1. +4
    -0
      WHATSNEW
  2. +32
    -21
      docs/manual/CoreTasks/javac.html
  3. +17
    -0
      src/main/org/apache/tools/ant/taskdefs/Javac.java
  4. +17
    -3
      src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java

+ 4
- 0
WHATSNEW View File

@@ -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 <cvs/> task



+ 32
- 21
docs/manual/CoreTasks/javac.html View File

@@ -178,40 +178,40 @@ files/directories from the CLASSPATH it passes to the compiler.</p>
<td align="center" valign="top">No</td>
</tr>
<tr>
<td valign="top">includeAntRuntime</td>
<td valign="top">includeAntRuntime</td>
<td valign="top">whether to include the Ant run-time libraries;
defaults to <code>yes</code>.</td>
<td align="center" valign="top">No</td>
</tr>
<tr>
<td valign="top">includeJavaRuntime</td>
<td valign="top">includeJavaRuntime</td>
<td valign="top">whether to include the default run-time
libraries from the executing VM; defaults to <code>no</code>.</td>
<td align="center" valign="top">No</td>
</tr>
<tr>
<td valign="top">fork</td>
<td valign="top">fork</td>
<td valign="top">whether to execute Javac using the JDK compiler
externally; defaults to <code>no</code>. You can also give a
complete path to the javac executable to use instead of
<code>yes</code>, which would run the compiler of the Java
vesrion that is currently running Ant.</td>
<td align="center" valign="top">No</td>
</tr>
</tr>
<tr>
<td valign="top">memoryInitialSize</td>
<td valign="top">memoryInitialSize</td>
<td valign="top">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: <code>83886080</code>, <code>81920k</code>, or <code>80m</code>)</td>
<td align="center" valign="top">No</td>
</tr>
</tr>
<tr>
<td valign="top">memoryMaximumSize</td>
<td valign="top">memoryMaximumSize</td>
<td valign="top">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: <code>83886080</code>, <code>81920k</code>, or <code>80m</code>)</td>
<td align="center" valign="top">No</td>
</tr>
</tr>
<tr>
<td valign="top">failonerror</td> <td valign="top">
indicates whether the build will continue even if there are compilation errors; defaults to <code>true</code>.
@@ -219,14 +219,25 @@ files/directories from the CLASSPATH it passes to the compiler.</p>
<td align="center" valign="top">No</td>
</tr>
<tr>
<td valign="top">source</td>
<td valign="top">source</td>
<td valign="top">Value of the <code>-source</code> command line
switch, will be ignored by all implementations except
<code>modern</code>, legal values are &quot;1.3&quot; and
&quot;1.4&quot; - by default, no <code>-source</code> argument
will be used at all.</td>
<td align="center" valign="top">No</td>
</tr>
</tr>
<tr>
<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>
</td>
<td align="center" valign="top">No</td>
</tr>
</table>

<h3>Parameters specified as nested elements</h3>
@@ -259,21 +270,21 @@ used.</p>
<td width="10%" valign="top"><b>Required</b></td>
</tr>
<tr>
<td valign="top">value</td>
<td valign="top">value</td>
<td align="center" rowspan="4">See <a href="../using.html#arg">here</a></td>
<td align="center" rowspan="4">Exactly one of these.</td>
</tr>
<tr>
<td valign="top">line</td>
<td valign="top">line</td>
</tr>
<tr>
<td valign="top">file</td>
<td valign="top">file</td>
</tr>
<tr>
<td valign="top">path</td>
<td valign="top">path</td>
</tr>
<tr>
<td valign="top">implementation</td>
<td valign="top">implementation</td>
<td align="center">Only use this argument if the chosen
implementation matches this attribute. Possible choices are the
same as those of the build.compiler property.</td>
@@ -355,7 +366,7 @@ This problem may occur with all JDKs &lt; 1.2.</p>

<p><b>Note:</b> 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.</p>

<h3>Jikes Notes</h3>
@@ -371,7 +382,7 @@ build.compiler.warnings is &quot;true&quot; while all others are &quot;false&quo
<tr>
<td valign="top">
build.compiler.emacs
</td>
</td>
<td valign="top">
Enable emacs compatible error messages
</td>
@@ -381,7 +392,7 @@ build.compiler.warnings is &quot;true&quot; while all others are &quot;false&quo
build.compiler.warnings<br>
<b>This property has been deprecated, use the nowarn attribute
instead</b>
</td>
</td>
<td valign="top">
don't disable warning messages
</td>
@@ -389,7 +400,7 @@ build.compiler.warnings is &quot;true&quot; while all others are &quot;false&quo
<tr>
<td valign="top">
build.compiler.pedantic
</td>
</td>
<td valign="top">
enable pedantic warnings
</td>
@@ -397,9 +408,9 @@ build.compiler.warnings is &quot;true&quot; while all others are &quot;false&quo
<tr>
<td valign="top">
build.compiler.fulldepend
</td>
</td>
<td valign="top">
enable full dependency checking,<br>
enable full dependency checking,<br>
&quot;+F&quot; in the jikes manual.
</td>
</tr>


+ 17
- 0
src/main/org/apache/tools/ant/taskdefs/Javac.java View File

@@ -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.


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

@@ -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());


Loading…
Cancel
Save