Browse Source

Added encoding attribute to <javac>.

Submitted by:	Hiroaki Nakamura <hnakamur@mc.neweb.ne.jp>,
                Eric VanLydegraf <ericv@kinzan.com>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267954 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 25 years ago
parent
commit
1f04dfb4f5
2 changed files with 22 additions and 0 deletions
  1. +5
    -0
      docs/index.html
  2. +17
    -0
      src/main/org/apache/tools/ant/taskdefs/Javac.java

+ 5
- 0
docs/index.html View File

@@ -2336,6 +2336,11 @@ inclusion/exclusion of files works, and how to write patterns.</p>
<td valign="top">location of installed extensions.</td>
<td align="center" valign="top">No</td>
</tr>
<tr>
<td valign="top">encoding</td>
<td valign="top">encoding of source files.</td>
<td align="center" valign="top">No</td>
</tr>
<tr>
<td valign="top">debug</td>
<td valign="top">indicates whether there should be compiled with debug


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

@@ -75,6 +75,7 @@ import java.util.*;
* <li>extdirs
* <li>optimize
* <li>debug
* <li>encoding
* <li>target
* </ul>
* Of these arguments, the <b>sourcedir</b> and <b>destdir</b> are required.
@@ -100,6 +101,7 @@ public class Javac extends MatchingTask {
private Path src;
private File destDir;
private Path compileClasspath;
private String encoding;
private Vector classpathReferences = new Vector();
private boolean debug = false;
private boolean optimize = false;
@@ -248,6 +250,13 @@ public class Javac extends MatchingTask {
this.deprecation = deprecation;
}

/**
* Set the Java source file encoding name.
*/
public void setEncoding(String encoding) {
this.encoding = encoding;
}

/**
* Set the debug flag.
*/
@@ -515,6 +524,10 @@ public class Javac extends MatchingTask {
cmd.createArgument().setValue(target);
}
}
if (encoding != null) {
cmd.createArgument().setValue("-encoding");
cmd.createArgument().setValue(encoding);
}
if (debug) {
cmd.createArgument().setValue("-g");
}
@@ -608,6 +621,10 @@ public class Javac extends MatchingTask {
cmd.createArgument().setValue("-classpath");
cmd.createArgument().setPath(classpath);

if (encoding != null) {
cmd.createArgument().setValue("-encoding");
cmd.createArgument().setValue(encoding);
}
if (debug) {
cmd.createArgument().setValue("-g");
}


Loading…
Cancel
Save