1 18 19 package org.apache.tools.ant.taskdefs.compilers; 20 21 import org.apache.tools.ant.BuildException; 22 import org.apache.tools.ant.Project; 23 import org.apache.tools.ant.types.Commandline; 24 import org.apache.tools.ant.types.Path; 25 26 33 public class Jvc extends DefaultCompilerAdapter { 34 35 40 public boolean execute() throws BuildException { 41 attributes.log("Using jvc compiler", Project.MSG_VERBOSE); 42 43 Path classpath = new Path(project); 44 45 Path p = getBootClassPath(); 48 if (p.size() > 0) { 49 classpath.append(p); 50 } 51 52 if (includeJavaRuntime) { 53 classpath.addExtdirs(extdirs); 56 } 57 58 classpath.append(getCompileClasspath()); 59 60 if (compileSourcepath != null) { 63 classpath.append(compileSourcepath); 64 } else { 65 classpath.append(src); 66 } 67 68 Commandline cmd = new Commandline(); 69 String exec = getJavac().getExecutable(); 70 cmd.setExecutable(exec == null ? "jvc" : exec); 71 72 if (destDir != null) { 73 cmd.createArgument().setValue("/d"); 74 cmd.createArgument().setFile(destDir); 75 } 76 77 cmd.createArgument().setValue("/cp:p"); 79 cmd.createArgument().setPath(classpath); 80 81 boolean msExtensions = true; 82 String mse = getProject().getProperty("build.compiler.jvc.extensions"); 83 if (mse != null) { 84 msExtensions = Project.toBoolean(mse); 85 } 86 87 if (msExtensions) { 88 cmd.createArgument().setValue("/x-"); 90 cmd.createArgument().setValue("/nomessage"); 92 } 93 94 cmd.createArgument().setValue("/nologo"); 96 97 if (debug) { 98 cmd.createArgument().setValue("/g"); 99 } 100 if (optimize) { 101 cmd.createArgument().setValue("/O"); 102 } 103 if (verbose) { 104 cmd.createArgument().setValue("/verbose"); 105 } 106 107 addCurrentCompilerArgs(cmd); 108 109 int firstFileName = cmd.size(); 110 logAndAddFilesToCompile(cmd); 111 112 return 113 executeExternalCompile(cmd.getCommandline(), firstFileName) == 0; 114 } 115 } 116 | Popular Tags |