本文整理汇总了Java中org.apache.tools.ant.types.Commandline.setExecutable方法的典型用法代码示例。如果您正苦于以下问题:Java Commandline.setExecutable方法的具体用法?Java Commandline.setExecutable怎么用?Java Commandline.setExecutable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tools.ant.types.Commandline
的用法示例。
在下文中一共展示了Commandline.setExecutable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: compile
import org.apache.tools.ant.types.Commandline; //导入方法依赖的package包/类
/**
* Performs the actual compilation.
* @param javah the calling javah task.
* @return true if the compilation was successful.
* @throws BuildException if there is an error.
* @since Ant 1.6.3
*/
@Override
public boolean compile(Javah javah) throws BuildException {
Commandline cmd = setupJavahCommand(javah);
ExecuteJava ej = new ExecuteJava();
Class<?> c;
try {
try {
// first search for the "old" javah class in 1.4.2 tools.jar
c = Class.forName("com.sun.tools.javah.oldjavah.Main");
} catch (ClassNotFoundException cnfe) {
// assume older than 1.4.2 tools.jar
c = Class.forName("com.sun.tools.javah.Main");
}
} catch (ClassNotFoundException ex) {
throw new BuildException(
"Can't load javah", ex, javah.getLocation());
}
cmd.setExecutable(c.getName());
ej.setJavaCommand(cmd);
File f = Locator.getClassSource(c);
if (f != null) {
ej.setClasspath(new Path(javah.getProject(), f.getPath()));
}
return ej.fork(javah) == 0;
}
示例2: execute
import org.apache.tools.ant.types.Commandline; //导入方法依赖的package包/类
/**
* Executes the task.
* <p>
* Builds a command line to execute ccm and then calls Exec's run method
* to execute the command line.
* </p>
* @throws BuildException on error
*/
@Override
public void execute() throws BuildException {
Commandline commandLine = new Commandline();
// build the command line from what we got the format
// as specified in the CCM.EXE help
commandLine.setExecutable(getCcmCommand());
commandLine.createArgument().setValue(getCcmAction());
checkOptions(commandLine);
int result = run(commandLine);
if (Execute.isFailure(result)) {
throw new BuildException("Failed executing: " + commandLine,
getLocation());
}
}
示例3: lsCheckout
import org.apache.tools.ant.types.Commandline; //导入方法依赖的package包/类
/**
* Check to see if the element is checked out in the current view.
*/
private boolean lsCheckout() {
Commandline cmdl = new Commandline();
// build the command line from what we got the format is
// cleartool lsco [options...] [viewpath ...]
// as specified in the CLEARTOOL.EXE help
cmdl.setExecutable(getClearToolCommand());
cmdl.createArgument().setValue(COMMAND_LSCO);
cmdl.createArgument().setValue("-cview");
cmdl.createArgument().setValue("-short");
cmdl.createArgument().setValue("-d");
// viewpath
cmdl.createArgument().setValue(getViewPath());
String result = runS(cmdl);
return (result != null && result.length() > 0);
}
示例4: 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;
}
示例5: 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;
}
示例6: execute
import org.apache.tools.ant.types.Commandline; //导入方法依赖的package包/类
/**
* Executes the task.
* <p>
* Builds a command line to execute cleartool and then calls Exec's run method
* to execute the command line.
* @throws BuildException if the command fails and failonerr is set to true
*/
@Override
public void execute() throws BuildException {
Commandline commandLine = new Commandline();
Project aProj = getProject();
// Check for required attributes
if (getTypeName() == null) {
throw new BuildException("Required attribute TypeName not specified");
}
if (getTypeValue() == null) {
throw new BuildException("Required attribute TypeValue not specified");
}
// Default the viewpath to basedir if it is not specified
if (getViewPath() == null) {
setViewPath(aProj.getBaseDir().getPath());
}
// build the command line from what we got. the format is
// cleartool mkattr [options...] [viewpath ...]
// as specified in the CLEARTOOL help
commandLine.setExecutable(getClearToolCommand());
commandLine.createArgument().setValue(COMMAND_MKATTR);
checkOptions(commandLine);
if (!getFailOnErr()) {
getProject().log("Ignoring any errors that occur for: "
+ getViewPathBasename(), Project.MSG_VERBOSE);
}
// For debugging
// System.out.println(commandLine.toString());
int result = run(commandLine);
if (Execute.isFailure(result) && getFailOnErr()) {
throw new BuildException("Failed executing: " + commandLine,
getLocation());
}
}
示例7: execute
import org.apache.tools.ant.types.Commandline; //导入方法依赖的package包/类
/**
* Executes the task.
* <p>
* Builds a command line to execute cleartool and then calls Exec's run method
* to execute the command line.
* @throws BuildException if the command fails and failonerr is set to true
*/
@Override
public void execute() throws BuildException {
Commandline commandLine = new Commandline();
Project aProj = getProject();
// Default the viewpath to basedir if it is not specified
if (getViewPath() == null) {
setViewPath(aProj.getBaseDir().getPath());
}
// build the command line from what we got the format is
// cleartool lock [options...]
// as specified in the CLEARTOOL.EXE help
commandLine.setExecutable(getClearToolCommand());
commandLine.createArgument().setValue(COMMAND_UNLOCK);
// Check the command line options
checkOptions(commandLine);
// For debugging
// System.out.println(commandLine.toString());
if (!getFailOnErr()) {
getProject().log("Ignoring any errors that occur for: "
+ getOpType(), Project.MSG_VERBOSE);
}
int result = run(commandLine);
if (Execute.isFailure(result) && getFailOnErr()) {
throw new BuildException("Failed executing: " + commandLine,
getLocation());
}
}
示例8: buildCmdLine
import org.apache.tools.ant.types.Commandline; //导入方法依赖的package包/类
/**
* Builds a command line to execute ss.
* @return The constructed commandline.
*/
Commandline buildCmdLine() {
Commandline commandLine = new Commandline();
// first off, make sure that we've got a command and a vssdir...
if (getVsspath() == null) {
String msg = "vsspath attribute must be set!";
throw new BuildException(msg, getLocation());
}
// build the command line from what we got
// the format is:
// ss Create VSS items [-C] [-H] [-I-] [-N] [-O] [-S] [-Y] [-?]
// as specified in the SS.EXE help
commandLine.setExecutable(getSSCommand());
commandLine.createArgument().setValue(COMMAND_CREATE);
// VSS items
commandLine.createArgument().setValue(getVsspath());
// -C
commandLine.createArgument().setValue(getComment());
// -I- or -I-Y or -I-N
commandLine.createArgument().setValue(getAutoresponse());
// -O-
commandLine.createArgument().setValue(getQuiet());
// -Y
commandLine.createArgument().setValue(getLogin());
return commandLine;
}
示例9: buildCmdLine
import org.apache.tools.ant.types.Commandline; //导入方法依赖的package包/类
/**
* Builds a command line to execute ss.
* @return The constructed commandline.
*/
protected Commandline buildCmdLine() {
Commandline commandLine = new Commandline();
// first off, make sure that we've got a command and a localPath ...
if (getLocalpath() == null) {
String msg = "localPath attribute must be set!";
throw new BuildException(msg, getLocation());
}
// build the command line from what we got the format is
// ss Add VSS items [-B] [-C] [-D-] [-H] [-I-] [-K] [-N] [-O] [-R] [-W] [-Y] [-?]
// as specified in the SS.EXE help
commandLine.setExecutable(getSSCommand());
commandLine.createArgument().setValue(COMMAND_ADD);
// VSS items
commandLine.createArgument().setValue(getLocalpath());
// -I- or -I-Y or -I-N
commandLine.createArgument().setValue(getAutoresponse());
// -R
commandLine.createArgument().setValue(getRecursive());
// -W
commandLine.createArgument().setValue(getWritable());
// -Y
commandLine.createArgument().setValue(getLogin());
// -C
commandLine.createArgument().setValue(getComment());
return commandLine;
}
示例10: buildCmdLine
import org.apache.tools.ant.types.Commandline; //导入方法依赖的package包/类
/**
* Builds a command line to execute ss.
* @return The constructed commandline.
*/
Commandline buildCmdLine() {
Commandline commandLine = new Commandline();
// build the command line from what we got the format is
// ss Get VSS items [-G] [-H] [-I-] [-N] [-O] [-R] [-V] [-W] [-Y] [-?]
// as specified in the SS.EXE help
commandLine.setExecutable(getSSCommand());
commandLine.createArgument().setValue(COMMAND_GET);
if (getVsspath() == null) {
throw new BuildException("vsspath attribute must be set!", getLocation());
}
commandLine.createArgument().setValue(getVsspath());
// -GL
commandLine.createArgument().setValue(getLocalpath());
// -I- or -I-Y or -I-N
commandLine.createArgument().setValue(getAutoresponse());
// -O-
commandLine.createArgument().setValue(getQuiet());
// -R
commandLine.createArgument().setValue(getRecursive());
// -V
commandLine.createArgument().setValue(getVersionDateLabel());
// -W
commandLine.createArgument().setValue(getWritable());
// -Y
commandLine.createArgument().setValue(getLogin());
// -G
commandLine.createArgument().setValue(getFileTimeStamp());
// -GWS or -GWR
commandLine.createArgument().setValue(getWritableFiles());
return commandLine;
}
示例11: setupGcjhCommand
import org.apache.tools.ant.types.Commandline; //导入方法依赖的package包/类
private Commandline setupGcjhCommand(Javah javah) {
Commandline cmd = new Commandline();
cmd.setExecutable(JavaEnvUtils.getJdkExecutable("gcjh"));
if (javah.getDestdir() != null) {
cmd.createArgument().setValue("-d");
cmd.createArgument().setFile(javah.getDestdir());
}
if (javah.getOutputfile() != null) {
cmd.createArgument().setValue("-o");
cmd.createArgument().setFile(javah.getOutputfile());
}
Path cp = new Path(javah.getProject());
if (javah.getBootclasspath() != null) {
cp.append(javah.getBootclasspath());
}
cp = cp.concatSystemBootClasspath("ignore");
if (javah.getClasspath() != null) {
cp.append(javah.getClasspath());
}
if (cp.size() > 0) {
cmd.createArgument().setValue("--classpath");
cmd.createArgument().setPath(cp);
}
if (!javah.getOld()) {
cmd.createArgument().setValue("-jni");
}
cmd.addArguments(javah.getCurrentArgs());
javah.logAndAddFiles(cmd);
return cmd;
}
示例12: 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;
}
示例13: buildCmdLine
import org.apache.tools.ant.types.Commandline; //导入方法依赖的package包/类
/**
* Builds a command line to execute ss.
* @return The constructed commandline.
*/
protected Commandline buildCmdLine() {
Commandline commandLine = new Commandline();
// first off, make sure that we've got a command and a vssdir ...
if (getVsspath() == null) {
String msg = "vsspath attribute must be set!";
throw new BuildException(msg, getLocation());
}
// build the command line from what we got the format is
// ss Checkin VSS items [-H] [-C] [-I-] [-N] [-O] [-R] [-W] [-Y] [-?]
// as specified in the SS.EXE help
commandLine.setExecutable(getSSCommand());
commandLine.createArgument().setValue(COMMAND_CHECKIN);
// VSS items
commandLine.createArgument().setValue(getVsspath());
// -GL
commandLine.createArgument().setValue(getLocalpath());
// -I- or -I-Y or -I-N
commandLine.createArgument().setValue(getAutoresponse());
// -R
commandLine.createArgument().setValue(getRecursive());
// -W
commandLine.createArgument().setValue(getWritable());
// -Y
commandLine.createArgument().setValue(getLogin());
// -C
commandLine.createArgument().setValue(getComment());
return commandLine;
}
示例14: configureCommandline
import org.apache.tools.ant.types.Commandline; //导入方法依赖的package包/类
/**
* Configure a commandline element for things like cvsRoot, quiet, etc.
* @param c the command line which will be configured
* if the commandline is initially null, the function is a noop
* otherwise the function append to the commandline arguments concerning
* <ul>
* <li>
* cvs package
* </li>
* <li>
* compression
* </li>
* <li>
* quiet or reallyquiet
* </li>
* <li>cvsroot</li>
* <li>noexec</li>
* </ul>
*/
protected void configureCommandline(Commandline c) {
if (c == null) {
return;
}
c.setExecutable("cvs");
if (cvsPackage != null) {
c.createArgument().setLine(cvsPackage);
}
for (Module m : modules) {
c.createArgument().setValue(m.getName());
}
if (this.compression > 0
&& this.compression <= MAXIMUM_COMRESSION_LEVEL) {
c.createArgument(true).setValue("-z" + this.compression);
}
if (quiet && !reallyquiet) {
c.createArgument(true).setValue("-q");
}
if (reallyquiet) {
c.createArgument(true).setValue("-Q");
}
if (noexec) {
c.createArgument(true).setValue("-n");
}
if (cvsRoot != null) {
c.createArgument(true).setLine("-d" + cvsRoot);
}
}
示例15: execute
import org.apache.tools.ant.types.Commandline; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public boolean execute() throws BuildException {
getRmic().log("Using Kaffe rmic", Project.MSG_VERBOSE);
Commandline cmd = setupRmicCommand();
Class<?> c = getRmicClass();
if (c == null) {
StringBuilder buf = new StringBuilder(
"Cannot use Kaffe rmic, as it is not available. None of ");
for (int i = 0; i < RMIC_CLASSNAMES.length; i++) {
if (i != 0) {
buf.append(", ");
}
buf.append(RMIC_CLASSNAMES[i]);
}
buf.append(
" have been found. A common solution is to set the environment variable JAVA_HOME or CLASSPATH.");
throw new BuildException(buf.toString(),
getRmic().getLocation());
}
cmd.setExecutable(c.getName());
if (!c.getName().equals(RMIC_CLASSNAMES[RMIC_CLASSNAMES.length - 1])) { //NOSONAR
// only supported since Kaffe 1.1.2
cmd.createArgument().setValue("-verbose");
getRmic().log(Commandline.describeCommand(cmd));
}
ExecuteJava ej = new ExecuteJava();
ej.setJavaCommand(cmd);
return ej.fork(getRmic()) == 0;
}