aboutsummaryrefslogtreecommitdiff
path: root/libjava/gnu/java/rmi/rmic/CompilerProcess.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/gnu/java/rmi/rmic/CompilerProcess.java')
-rw-r--r--libjava/gnu/java/rmi/rmic/CompilerProcess.java31
1 files changed, 27 insertions, 4 deletions
diff --git a/libjava/gnu/java/rmi/rmic/CompilerProcess.java b/libjava/gnu/java/rmi/rmic/CompilerProcess.java
index 09f8d9c..d7b2998 100644
--- a/libjava/gnu/java/rmi/rmic/CompilerProcess.java
+++ b/libjava/gnu/java/rmi/rmic/CompilerProcess.java
@@ -59,11 +59,27 @@ public abstract class CompilerProcess extends Compiler
public static String[] computeTypicalArguments(String[] compilerArgs,
String destination, String filename)
{
+ return computeTypicalArguments(compilerArgs, null, destination, filename);
+ }
+ /**
+ * This is used to compute the command line for the process.
+ * Most compilers typically arrange their arguments as in
+ * <compiler name and arguments> <optional destination> <filename>.
+ * This method builds an argument array out that. It should be used
+ * to define computeArguments for those compilers that follow the
+ * argument convention described above.
+ */
+ public static String[] computeTypicalArguments(String[] compilerArgs,
+ String classpath,
+ String destination,
+ String filename)
+ {
/* length of compiler specific arguments */
- final int len = compilerArgs.length;
+ int len = compilerArgs.length;
/* length of returned array of arguments */
- final int arglen = len + (destination == null ? 0 : 2) + 1;
+ final int arglen = len + (classpath == null ? 0 : 2) +
+ (destination == null ? 0 : 2) + 1;
/* Allocate String array for computed arguments. */
String [] args = new String[arglen];
@@ -71,11 +87,18 @@ public abstract class CompilerProcess extends Compiler
/* Fill in compiler arguments. */
System.arraycopy(compilerArgs, 0, args, 0, len);
+ /* Fill in classpath argument if necessary. */
+ if (classpath != null)
+ {
+ args[len++] = "-classpath";
+ args[len++] = classpath;
+ }
+
/* Fill in destination argument if necessary. */
if (destination != null)
{
- args[len] = "-d";
- args[len + 1] = destination;
+ args[len++] = "-d";
+ args[len++] = destination;
}
/* Fill in filename */