/** * Helper method to set result property to the * passed in value if appropriate. * * @param result the exit code */ protected void maybeSetResultPropertyValue(int result) { String res = Integer.toString(result); if (resultProperty != null) { getProject().setNewProperty(resultProperty, res); } }
/** * Set the working dir of the new process. * @param exe executable. * @throws BuildException if the dir doesn't exist. */ private void setupWorkingDir(Execute exe) { if (dir == null) { dir = getProject().getBaseDir(); } else if (!dir.isDirectory()) { throw new BuildException(dir.getAbsolutePath() + " is not a valid directory", getLocation()); } exe.setWorkingDirectory(dir); }
/** * Add a path to the modulepath. * * @return created modulepath. * @since 1.9.7 */ public Path createModulepath() { return getCommandLine().createModulepath(getProject()).createPath(); }
/** * Add a path to the upgrademodulepath. * * @return created upgrademodulepath. * @since 1.9.7 */ public Path createUpgrademodulepath() { return getCommandLine().createUpgrademodulepath(getProject()).createPath(); }
/** * Add a path to the classpath. * * @return created classpath. */ public Path createClasspath() { return getCommandLine().createClasspath(getProject()).createPath(); }
/** * Add a path to the bootclasspath. * @since Ant 1.6 * * @return created bootclasspath. */ public Path createBootclasspath() { return getCommandLine().createBootclasspath(getProject()).createPath(); }
/** * Do all configuration for an executable that * is common across the {@link #fork(String[])} and * {@link #spawn(String[])} methods. * @param exe executable. * @param command command to execute. */ private void setupExecutable(Execute exe, String[] command) { exe.setAntRun(getProject()); setupWorkingDir(exe); setupEnvironment(exe); setupCommandLine(exe, command); }
/** * Set up properties on the redirector that we needed to store locally. */ protected void setupRedirector() { redirector.setInput(input); redirector.setInputString(inputString); redirector.setOutput(output); redirector.setError(error); if (redirectorElement != null) { redirectorElement.configure(redirector); } if (!spawn && input == null && inputString == null) { // #24918: send standard input to the process by default. redirector.setInputStream( new KeepAliveInputStream(getProject().getDefaultInputStream())); } }
/** * Executes the given classname with the given arguments as it * were a command line application. * @param command CommandlineJava. */ private void run(CommandlineJava command) throws BuildException { try { ExecuteJava exe = new ExecuteJava(); exe.setJavaCommand(command.getJavaCommand()); exe.setClasspath(command.getClasspath()); exe.setSystemProperties(command.getSystemProperties()); exe.setPermissions(perm); exe.setTimeout(timeout); redirector.createStreams(); exe.execute(getProject()); redirector.complete(); if (exe.killedProcess()) { throw new BuildException(TIMEOUT_MESSAGE); } } catch (IOException e) { throw new BuildException(e); } }
String returnProperty = getFindbugsEngine().getProject().getProperty(execReturnCodeIdentifier); int rc = returnProperty == null ? 0 : Integer.parseInt(returnProperty);
getProject().log( "spawn does not allow attributes related to input, output, error, result", Project.MSG_ERR); getProject().log("spawn also does not allow timeout", Project.MSG_ERR); getProject().log( "finally, spawn is not compatible with a nested I/O <redirector>", Project.MSG_ERR);
public boolean run() { try { log.debug(javaTask.getCommandLine().toString()); javaTask.getProject().executeTarget("run-workflow"); return true; } catch (Exception e) { log.error(e.getClass().getSimpleName()+" occurred while running workflow: "+e.getMessage()); log.debug(e); return false; } }
private void addBuildListener(Java java) { boolean foundBuildListener = false; for (Object listenerObject : java.getProject().getBuildListeners()) { if (listenerObject instanceof AntBuildListener) { foundBuildListener = true; break; } } if (!foundBuildListener) { java.getProject().addBuildListener(new AntBuildListener(logger)); } }
private void addBuildListener(Java java) { boolean foundBuildListener = false; for (Object listenerObject : java.getProject().getBuildListeners()) { if (listenerObject instanceof AntBuildListener) { foundBuildListener = true; break; } } if (!foundBuildListener) { java.getProject().addBuildListener(new AntBuildListener(logger)); } }
/** * {@inheritDoc} */ @Override public JvmLauncher createJvmLauncher(JvmLauncherRequest request) { Loggable loggable = request.getLoggable(); Java java = (Java) antUtils.createAntTask(request.isSsh() ? "sshjava" : "java"); java.setFork(true); if (!request.isSpawned()) { java.setLogError(true); } boolean foundBuildListener = false; for (Object listenerObject : java.getProject().getBuildListeners()) { if (listenerObject instanceof AntBuildListener) { foundBuildListener = true; break; } } if (!foundBuildListener) { java.getProject().addBuildListener( new AntBuildListener(loggable.getLogger(), loggable.getClass().getName())); } return new DefaultJvmLauncher(java); }
protected void setup(Java java) { if (jarFile != null) { java.setJar(jarFile); } else { if (classPath == null) { java.setClasspath(Path.systemClasspath); } else { java.setClasspath(new Path(java.getProject(), classPath)); } java.setClassname(mainClass); } if (jvmArgs != null) { final Argument jvmArg = java.createJvmarg(); jvmArg.setLine(jvmArgs); } if (args != null) { final Argument taskArgs = java.createArg(); taskArgs.setLine(args); } java.getProject().addBuildListener(new SimpleListener(java, outputOut, outputErr)); java.setCloneVm(cloneVM); }
String returnProperty = getFindbugsEngine().getProject().getProperty(execReturnCodeIdentifier); int rc = returnProperty == null ? 0 : Integer.parseInt(returnProperty);
String returnProperty = getFindbugsEngine().getProject().getProperty(execReturnCodeIdentifier); int rc = returnProperty == null ? 0 : Integer.parseInt(returnProperty);