Here's a patch for 1.35 Javac
The original I think was based on older javac.java
-----Original Message-----
From: Hiroaki Nakamura [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 30, 2000 10:29 AM
To: [EMAIL PROTECTED]
Subject: [PATCH] add -encoding option support for Javac task
Hi, this is my first post to ant-dev.
Attached is a patch for adding -encoding option support for Javac task.
This change is needed when you compile a Java source file whose encoding
is different from the OS native encoding, for example, the file encoding
is SJIS and the OS encoding is EUCJIS. This is a usual case when you
develop on multi OSes like Solaris and Windows.
I hope this patch is useful and will be included soon.
Thank you.
--
)Hiroaki Nakamura) [EMAIL PROTECTED]
Index: Javac.java
===================================================================
RCS file:
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Javac.java,v
retrieving revision 1.35
diff -u -r1.35 Javac.java
--- Javac.java 2000/08/15 13:34:19 1.35
+++ Javac.java 2000/09/02 00:54:47
@@ -75,6 +75,7 @@
* <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 @@
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;
@@ -249,6 +251,13 @@
}
/**
+ * Set the Java source file encoding name.
+ */
+ public void setEncoding(String encoding) {
+ this.encoding = encoding;
+ }
+
+ /**
* Set the debug flag.
*/
public void setDebug(boolean debug) {
@@ -513,6 +522,10 @@
cmd.createArgument().setValue(target);
}
}
+ if (encoding != null) {
+ cmd.createArgument().setValue("-encoding");
+ cmd.createArgument().setValue(encoding);
+ }
if (debug) {
cmd.createArgument().setValue("-g");
}
@@ -606,6 +619,10 @@
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");
}