Browse Source

Added support for jvc (Microsofts Java compiler) to <javac>.

Submitted by:	Nico Seessle <nico@seessle.de>


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

+ 2
- 0
WHATSNEW View File

@@ -30,6 +30,8 @@ behavior has been dropped.

* <ejbjar> task syntax has been changed significantly

* build.compiler supports now jvc as well.

Other changes:
--------------



+ 2
- 0
docs/index.html View File

@@ -2258,6 +2258,8 @@ inclusion/exclusion of files works, and how to write patterns.</p>
<li>jikes (the <a
href="http://oss.software.ibm.com/developerworks/opensource/jikes/project">Jikes</a>
compiler)</li>
<li>jvc (the Command-Line Compiler from Microsoft's SDK for Java /
Visual J++)</li>
</ul>
<p>For JDK 1.1/1.2 is classic the default. For JDK 1.3 is modern the default.</p>
<h3>Parameters</h3>


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

@@ -326,6 +326,8 @@ public class Javac extends MatchingTask {
doModernCompile();
} else if (compiler.equalsIgnoreCase("jikes")) {
doJikesCompile();
} else if (compiler.equalsIgnoreCase("jvc")) {
doJvcCompile();
} else {
String msg = "Don't know how to use compiler " + compiler;
throw new BuildException(msg);
@@ -776,5 +778,58 @@ public class Javac extends MatchingTask {
}
}
private void doJvcCompile() throws BuildException {
log("Using jvc compiler", Project.MSG_VERBOSE);

Path classpath = new Path(project);

// jvc doesn't support bootclasspath dir (-bootclasspath)
// so we'll emulate it for compatibility and convenience.
if (bootclasspath != null || bootClasspathReferences.size() > 0) {
addReferencesToPath(bootClasspathReferences, createBootclasspath());
classpath.append(bootclasspath);
}

classpath.append(getCompileClasspath(true));

// jvc doesn't support an extension dir (-extdir)
// so we'll emulate it for compatibility and convenience.
addExtdirsToClasspath(classpath);

// jvc has no option for source-path so we
// will add it to classpath.
classpath.append(src);

Commandline cmd = new Commandline();
cmd.setExecutable("jvc");

cmd.createArgument().setValue("/d");
cmd.createArgument().setFile(destDir);
// Add the Classpath before the "internal" one.
cmd.createArgument().setValue("/cp:p");
cmd.createArgument().setPath(classpath);

// Enable MS-Extensions and ...
cmd.createArgument().setValue("/x-");
// ... do not display a Message about this.
cmd.createArgument().setValue("/nomessage");
// Do not display Logo
cmd.createArgument().setValue("/nologo");

if (debug) {
cmd.createArgument().setValue("/g");
}
if (optimize) {
cmd.createArgument().setValue("/O");
}

int firstFileName = cmd.size();
logAndAddFilesToCompile(cmd);

if (executeJikesCompile(cmd.getCommandline(), firstFileName) != 0) {
String msg = "Compile failed, messages should have been provided.";
throw new BuildException(msg);
}
}
}


Loading…
Cancel
Save