本文整理汇总了Java中org.apache.tools.ant.types.Commandline.size方法的典型用法代码示例。如果您正苦于以下问题:Java Commandline.size方法的具体用法?Java Commandline.size怎么用?Java Commandline.size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tools.ant.types.Commandline
的用法示例。
在下文中一共展示了Commandline.size方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import org.apache.tools.ant.types.Commandline; //导入方法依赖的package包/类
/**
* Performs a compile using the Javac externally.
* @return true if the compilation succeeded
* @throws BuildException on error
*/
@Override
public boolean execute() throws BuildException {
attributes.log("Using external javac compiler", Project.MSG_VERBOSE);
Commandline cmd = new Commandline();
cmd.setExecutable(getJavac().getJavacExecutable());
if (!assumeJava11() && !assumeJava12()) {
setupModernJavacCommandlineSwitches(cmd);
} else {
setupJavacCommandlineSwitches(cmd, true);
}
int firstFileName = assumeJava11() ? -1 : cmd.size();
logAndAddFilesToCompile(cmd);
//On VMS platform, we need to create a special java options file
//containing the arguments and classpath for the javac command.
//The special file is supported by the "-V" switch on the VMS JVM.
if (Os.isFamily("openvms")) {
return execOnVMS(cmd, firstFileName);
}
return
executeExternalCompile(cmd.getCommandline(), firstFileName,
true)
== 0;
}
示例2: compile
import org.apache.tools.ant.types.Commandline; //导入方法依赖的package包/类
/**
* Perform the compilation.
*/
private void compile() {
if (compileList.length > 0) {
log("Compiling " + compileList.length + " source file"
+ (compileList.length == 1 ? "" : "s")
+ (destDir != null ? " to " + destDir : ""));
if (listFiles) {
for (int i = 0; i < compileList.length; i++) {
String filename = compileList[i].getAbsolutePath();
log(filename);
}
}
// Set up the command line.
Commandline cmd = new Commandline();
setupKawaCommandline(cmd);
int firstFileName = cmd.size();
logAndAddFilesToCompile(cmd);
// Do the compilation
int rc = executeExternalCompile(cmd.getCommandline(),
firstFileName, true);
if (rc != 0) { // Failure
taskSuccess = false;
if (errorProperty != null) {
getProject().setNewProperty(errorProperty, "true");
}
if (failOnError) {
throw new BuildException(FAIL_MSG, getLocation());
} else {
log(FAIL_MSG, Project.MSG_ERR);
}
}
}
}
示例3: forkeExecute
import org.apache.tools.ant.types.Commandline; //导入方法依赖的package包/类
public boolean forkeExecute() throws Exception {
Commandline cmd = new Commandline();
F3AntTask task = (F3AntTask)getJavac();
String executable = getJavac().getExecutable();
if (executable != null) {
cmd.setExecutable(executable);
if (((F3AntTask) getJavac()).compilerClassPath != null) {
getJavac().log("Ignoring attribute compilerclasspath, because executable is set.", Project.MSG_WARN);
}
} else {
cmd.setExecutable(JavaEnvUtils.getJdkExecutable("java"));
if (memoryInitialSize != null) {
cmd.createArgument().setValue("-Xms" + memoryInitialSize);
memoryInitialSize = null; // don't include it in setupJavacCommandlineSwitches()
}
if (memoryMaximumSize != null) {
cmd.createArgument().setValue("-Xmx" + memoryMaximumSize);
memoryMaximumSize = null; // don't include it in setupJavacCommandlineSwitches()
}
if (task.jdwpPort != 0) {
cmd.createArgument().setValue("-Xrunjdwp:transport=dt_socket,address=" + task.jdwpPort+",server=y,suspend=y");
}
if (task.enableAssertions) {
cmd.createArgument().setValue("-ea");
}
String cp = "-Xbootclasspath/p:" +
((F3AntTask) getJavac()).compilerClassPath.toString();
cmd.createArgument().setValue(cp);
cmd.createArgument().setValue(F3_ENTRY_POINT);
}
String profile = ((F3AntTask) getJavac()).profile;
if (profile != null) {
cmd.createArgument().setLine("-profile " + profile);
}
setupJavacCommandlineSwitches(cmd, true);
int firstFileName = cmd.size();
logAndAddFilesToCompile(cmd);
return executeExternalCompile(cmd.getCommandline(), firstFileName, true) == 0;
}
示例4: execute
import org.apache.tools.ant.types.Commandline; //导入方法依赖的package包/类
/**
* Performs a compile using the sj compiler from Symantec.
* @return true if the compilation succeeded
* @throws BuildException on error
*/
@Override
public boolean execute() throws BuildException {
attributes.log("Using symantec java compiler", Project.MSG_VERBOSE);
Commandline cmd = setupJavacCommand();
String exec = getJavac().getExecutable();
cmd.setExecutable(exec == null ? "sj" : exec);
int firstFileName = cmd.size() - compileList.length;
return
executeExternalCompile(cmd.getCommandline(), firstFileName) == 0;
}
示例5: execute
import org.apache.tools.ant.types.Commandline; //导入方法依赖的package包/类
/**
* Performs a compile using the gcj compiler.
* @return true if the compilation succeeded
* @throws BuildException on error
*/
@Override
public boolean execute() throws BuildException {
attributes.log("Using gcj compiler", Project.MSG_VERBOSE);
Commandline cmd = setupGCJCommand();
int firstFileName = cmd.size();
logAndAddFilesToCompile(cmd);
return
executeExternalCompile(cmd.getCommandline(), firstFileName) == 0;
}
示例6: execute
import org.apache.tools.ant.types.Commandline; //导入方法依赖的package包/类
public boolean execute() throws BuildException {
attributes.log("Using DominoJ compiler", Project.MSG_INFO);
Commandline cmd = setupJavacCommand();
String exec = getJavac().getExecutable();
cmd.setExecutable(exec == null ? "dominojc" : exec);
int firstFileName = cmd.size() - compileList.length;
return executeExternalCompile(cmd.getCommandline(), firstFileName)==0;
}
示例7: execute
import org.apache.tools.ant.types.Commandline; //导入方法依赖的package包/类
@Override
public boolean execute() throws BuildException {
if (getJavac().isForkedJavac()) {
attributes.log("Using external Error Prone compiler", Project.MSG_VERBOSE);
Commandline cmd = new Commandline();
cmd.setExecutable(JavaEnvUtils.getJdkExecutable("java"));
if (memoryStackSize != null) {
cmd.createArgument().setValue("-Xss" + memoryStackSize);
}
String memoryParameterPrefix = "-X";
if (memoryInitialSize != null) {
cmd.createArgument().setValue(memoryParameterPrefix + "ms" + this.memoryInitialSize);
// Prevent setupModernJavacCommandlineSwitches() from doing it also
memoryInitialSize = null;
}
if (memoryMaximumSize != null) {
cmd.createArgument().setValue(memoryParameterPrefix + "mx" + this.memoryMaximumSize);
// Prevent setupModernJavacCommandlineSwitches() from doing it also
memoryMaximumSize = null;
}
for (Argument arg : jvmArgs) {
for (String part : arg.getParts()) {
cmd.createArgument().setValue(part);
}
}
Path bootclasspath = new Path(getProject());
addResourceSource(
bootclasspath, "com/google/errorprone/ErrorProneExternalCompilerAdapter.class");
cmd.createArgument().setValue("-Xbootclasspath/p:" + bootclasspath);
if (classpath != null) {
cmd.createArgument().setValue("-classpath");
cmd.createArgument().setPath(classpath);
}
cmd.createArgument().setValue(ErrorProneCompiler.class.getName());
// This is the first argument that may be spilled to a file.
// The ant API describes it as the first argument which is a
// file, but in fact only uses it for spilling. Putting the
// break here allows long classpath arguments to be handled.
int firstSpillableArgument = cmd.size();
setupModernJavacCommandlineSwitches(cmd);
logAndAddFilesToCompile(cmd);
return executeExternalCompile(cmd.getCommandline(), firstSpillableArgument, true) == 0;
} else {
attributes.log(
"You must set fork=\"yes\" to use the external Error Prone compiler", Project.MSG_ERR);
return false;
}
}