public void execute(ExecSpec spec) { spec.setIgnoreExitValue(true); } };
public void execute(ExecSpec spec) { spec.setIgnoreExitValue(true); } };
public void execute(ExecSpec spec) { spec.setIgnoreExitValue(true); spec.setWorkingDir(workingDir); } };
public void execute(ExecSpec spec) { spec.setIgnoreExitValue(true); spec.setWorkingDir(workingDir); } };
public static PythonVersion parsePythonVersion(final Project project, final File pythonInterpreter) { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); ExecResult execResult = project.exec(execSpec -> { execSpec.setExecutable(pythonInterpreter.getAbsolutePath()); execSpec.setArgs(Collections.singletonList("--version")); execSpec.setStandardOutput(outputStream); execSpec.setErrorOutput(outputStream); execSpec.setIgnoreExitValue(true); }); String output = outputStream.toString(); if (execResult.getExitValue() != 0) { throw new GradleException(output); } String versionString = output.trim().split(" ")[1]; return new PythonVersion(versionString); } }
@Override public void execute(ExecSpec execSpec) { if (OSDetector.isWindows()) { execSpec.args( "/MIR", "/NDL", "/NFL", "/NJH", "/NJS", "/NP", sourceDir.getAbsolutePath(), targetDir.getAbsolutePath()); execSpec.setExecutable("robocopy"); } else { execSpec.args( "--archive", "--delete", sourceDir.getAbsolutePath() + File.separator, targetDir.getAbsolutePath()); execSpec.setExecutable("rsync"); } execSpec.setIgnoreExitValue(true); }
@Override public void execute(ExecSpec execSpec) { if (OSDetector.isWindows()) { execSpec.args( "/MIR", "/NDL", "/NFL", "/NJH", "/NJS", "/NP", sourceDir.getAbsolutePath(), targetDir.getAbsolutePath()); execSpec.setExecutable("robocopy"); } else { execSpec.args( "--archive", "--delete", sourceDir.getAbsolutePath() + File.separator, targetDir.getAbsolutePath()); execSpec.setExecutable("rsync"); } execSpec.setIgnoreExitValue(true); }
public static PythonVersion parsePythonVersion(final Project project, final File pythonInterpreter) { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); ExecResult execResult = project.exec(execSpec -> { execSpec.setExecutable(pythonInterpreter.getAbsolutePath()); execSpec.setArgs(Collections.singletonList("--version")); execSpec.setStandardOutput(outputStream); execSpec.setErrorOutput(outputStream); execSpec.setIgnoreExitValue(true); }); String output = outputStream.toString(); if (execResult.getExitValue() != 0) { throw new GradleException(output); } String versionString = output.trim().split(" ")[1]; return new PythonVersion(versionString); } }
@TaskAction void generateKey() throws IOException { String pathKeyFile = this.outputDir + File.separatorChar + this.keyFile; // execute openssl cmd to create private key getProject().exec(execSpec -> { execSpec.setIgnoreExitValue(true); execSpec.workingDir("."); execSpec.setExecutable("openssl"); List<String> args = Arrays.asList( "genrsa", "-des3", "-out", pathKeyFile, "-passout", "pass:"+this.keyPassword ); execSpec.setArgs(args); }); }
@TaskAction void generateJKS() { String pathJksFile = this.outputDir + File.separatorChar + this.jksFile; String pathPkcs12File = this.outputDir + File.separatorChar + this.pkcs12File; getProject().exec(execSpec -> { execSpec.setIgnoreExitValue(true); execSpec.workingDir("."); execSpec.setExecutable("keytool"); List<String> args = Arrays.asList( "-importkeystore", "-srcstoretype", "PKCS12", "-srckeystore", pathPkcs12File, "-srcstorepass", this.pkcs12Password, "-destkeystore", pathJksFile, "-storepass", this.jksPassword ); execSpec.setArgs(args); }); }
@TaskAction void generateCert() { String pathCertFile = this.outputDir + File.separatorChar + this.certFile; String pathKeyFile = this.outputDir + File.separatorChar + this.keyFile; // execute openssl cmd to create public cert getProject().exec(execSpec -> { execSpec.setIgnoreExitValue(true); execSpec.workingDir("."); execSpec.setExecutable("openssl"); List<String> args = Arrays.asList( "req", "-new", "-x509", "-key", pathKeyFile, "-out", pathCertFile, "-passin", "pass:"+this.keyPassword, "-subj", "/C=US" ); execSpec.setArgs(args); }); }
public void exec(HelmExecSpec spec) { project.getLogger().warn("Executing: " + spec.getCommandLine()); String[] args = spec.getCommandLine().split("\\s+"); args[0] = getClient().getBinPath(); project.exec(execSpec -> { String tillerNamespace = getTillerNamespace(); Map<String, String> env = new HashMap(); env.putAll(System.getenv()); if (tillerNamespace != null) { env.put("TILLER_NAMESPACE", tillerNamespace); } execSpec.setEnvironment(env); execSpec.setIgnoreExitValue(spec.isIgnoreExitValue()); execSpec.setCommandLine(Arrays.asList(args)); }); }
ExecResult execCommand(Map<String, String> mergedEnv, List<String> commandLine, OutputStream stream) { return externalExec.exec(execSpec -> { execSpec.environment(mergedEnv); execSpec.commandLine(commandLine); execSpec.setStandardOutput(stream); execSpec.setErrorOutput(stream); execSpec.setIgnoreExitValue(true); }); }
@Override public void execute(ExecSpec execSpec) { /* * Gradle doesn't work correctly when there are empty args. */ List<String> args = processInfo.getArgs().stream() .map(a -> a.isEmpty()? "\"\"" : a) .collect(Collectors.toList()); execSpec.setExecutable(processInfo.getExecutable()); execSpec.args(args); execSpec.environment(processInfo.getEnvironment()); execSpec.setStandardOutput(processOutput.getStandardOutput()); execSpec.setErrorOutput(processOutput.getErrorOutput()); // we want the caller to be able to do its own thing. execSpec.setIgnoreExitValue(true); } }
@Override public void execute(ExecSpec execSpec) { execSpec.commandLine(pythonExtension.getDetails().getVirtualEnvInterpreter()); execSpec.args(pythonExtension.getDetails().getVirtualEnvironment().getPex()); System.out.println(outputFile.getAbsolutePath()); execSpec.args(Arrays.asList("--no-pypi", "--cache-dir", pexCache.getAbsolutePath(), "--output-file", outputFile.getAbsolutePath(), "--repo", wheelCache.getAbsolutePath(), "--python-shebang", pexShebang.getAbsolutePath())); if (entryPoint != null) { execSpec.args(Arrays.asList("--entry-point", entryPoint)); } execSpec.args(pexOptions); execSpec.args(pexRequirements(dependencies)); execSpec.setStandardOutput(outputStream); execSpec.setErrorOutput(outputStream); execSpec.setIgnoreExitValue(true); }
@Override public void execute(ExecSpec execSpec) { execSpec.commandLine(pythonExtension.getDetails().getVirtualEnvInterpreter()); execSpec.args(pythonExtension.getDetails().getVirtualEnvironment().getPex()); System.out.println(outputFile.getAbsolutePath()); execSpec.args(Arrays.asList("--no-pypi", "--cache-dir", pexCache.getAbsolutePath(), "--output-file", outputFile.getAbsolutePath(), "--repo", wheelCache.getAbsolutePath(), "--python-shebang", pexShebang.getAbsolutePath())); if (entryPoint != null) { execSpec.args(Arrays.asList("--entry-point", entryPoint)); } execSpec.args(pexOptions); execSpec.args(pexRequirements(dependencies)); execSpec.setStandardOutput(outputStream); execSpec.setErrorOutput(outputStream); execSpec.setIgnoreExitValue(true); }
@Override public void execute(ExecSpec execSpec) { if (workingDirectory != null) { execSpec.setWorkingDir(workingDirectory); } execSpec.setCommandLine((Object[])Commandline.translateCommandline(command)); execSpec.setIgnoreExitValue(ignoreExitValue); if (logStandardOutput) { execSpec.setStandardOutput(standardOutputStream); } execSpec.setErrorOutput(errorOutputStream); } });
ExecResult execCommand(Map<String, String> mergedEnv, List<String> commandLine, OutputStream stream) { return externalExec.exec(execSpec -> { execSpec.environment(mergedEnv); execSpec.commandLine(commandLine); execSpec.setStandardOutput(stream); execSpec.setErrorOutput(stream); execSpec.setIgnoreExitValue(true); }); }
@Override public void execute(ExecSpec spec) { spec.setIgnoreExitValue(true); spec.commandLine(execCommand.getCommandLine()); spec.setStandardOutput(new ExternalProcessStream(execCommand.getLoggingPrefix(), System.out)); spec.setErrorOutput(new ExternalProcessStream(execCommand.getLoggingPrefix(), System.err)); execCommand.getSetupAction().execute(spec); LOG.lifecycle(" " + execCommand.getDescription() + ":\n " + StringUtil.join(execCommand.getCommandLine(), " ")); } });
@Override public void execute(ExecSpec spec) { spec.setIgnoreExitValue(true); spec.commandLine(execCommand.getCommandLine()); spec.setStandardOutput(new ExternalProcessStream(execCommand.getLoggingPrefix(), System.out)); spec.setErrorOutput(new ExternalProcessStream(execCommand.getLoggingPrefix(), System.err)); execCommand.getSetupAction().execute(spec); LOG.lifecycle(" " + execCommand.getDescription() + ":\n " + StringUtil.join(execCommand.getCommandLine(), " ")); } });