org.gradle.process.ExecSpec Java Examples
The following examples show how to use
org.gradle.process.ExecSpec.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExecCustomizer.java From curiostack with MIT License | 6 votes |
void copyTo(ExecSpec exec) { if (executable != null) { exec.executable(executable); } if (arguments != null) { exec.args(arguments); } if (environment != null) { exec.environment(environment); } if (ignoreExitValue != null) { exec.setIgnoreExitValue(ignoreExitValue); } if (workingDir != null) { exec.workingDir(workingDir); } if (standardInput != null) { exec.setStandardInput(standardInput); } if (standardOutput != null) { exec.setStandardOutput(standardOutput); } if (standardError != null) { exec.setErrorOutput(standardError); } }
Example #2
Source File: ExternalExecUtil.java From curiostack with MIT License | 6 votes |
/** * Executes an external program by customizing a {@link ExecSpec} with the supplied {@link * Action}. If the customized {@link ExecSpec} is serializable, the execution will happen in * parallel with others by running in {@link WorkerExecutor}, otherwise it will be invoked * serially. */ public static void exec( Project project, WorkerExecutor workerExecutor, Action<? super ExecSpec> action) { var customizer = new ExecCustomizer(project); action.execute(customizer); if (customizer.isSerializable()) { project.getLogger().info("Executing command in worker executor."); workerExecutor .noIsolation() .submit( ExecWorkAction.class, parameters -> parameters.getExecCustomizer().set(customizer)); } else { project.getLogger().info("Executing command serially."); project.exec(customizer::copyTo); } }
Example #3
Source File: ZipAlignUtils.java From atlas with Apache License 2.0 | 6 votes |
public static synchronized File doZipAlign(final AndroidBuilder androidBuilder, Project project, final File apkFile) { final File zipalignedFile = new File(apkFile.getParent(), apkFile.getName().replace(".apk", "-zipaligned.apk")); project.exec(new Action<ExecSpec>() { @Override public void execute(ExecSpec execSpec) { String path = androidBuilder.getTargetInfo() .getBuildTools().getPath(ZIP_ALIGN); execSpec.executable(new File(path)); execSpec.args("-f", "4"); execSpec.args(apkFile); execSpec.args(zipalignedFile); } }); return zipalignedFile; }
Example #4
Source File: BuildHelper.java From atlas with Apache License 2.0 | 6 votes |
public static synchronized File doZipAlign(final AndroidBuilder androidBuilder, Project project, final File apkFile) { final File zipalignedFile = new File(apkFile.getParent(), apkFile.getName().replace(".apk", "-zipaligned.apk")); project.exec(new Action<ExecSpec>() { @Override public void execute(ExecSpec execSpec) { String path = androidBuilder.getTargetInfo() .getBuildTools().getPath(ZIP_ALIGN); execSpec.executable(new File(path)); execSpec.args("-f", "4"); execSpec.args(apkFile); execSpec.args(zipalignedFile); } }); return zipalignedFile; }
Example #5
Source File: PexExecSpecAction.java From pygradle with Apache License 2.0 | 6 votes |
@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); }
Example #6
Source File: GoExecUtil.java From curiostack with MIT License | 5 votes |
public static void goExec(ExecSpec exec, Project project, String command, Iterable<String> args) { var toolManager = DownloadedToolManager.get(project); exec.executable(toolManager.getBinDir("go").resolve(command)); exec.args(args); exec.environment("GOROOT", toolManager.getToolDir("go").resolve("go")); exec.environment( "GOPATH", project.getExtensions().getByType(ExtraPropertiesExtension.class).get("gopath")); if (!"true" .equals(project.getRootProject().findProperty("org.curioswitch.curiostack.goModUpdate"))) { exec.environment("GOFLAGS", "-mod=readonly"); } toolManager.addAllToPath(exec); }
Example #7
Source File: ExecCustomizer.java From curiostack with MIT License | 5 votes |
@Override public ExecSpec commandLine(Iterable<?> args) { List<Object> argsList = ImmutableList.copyOf(args); executable(argsList.get(0)); setArgs(argsList.subList(1, argsList.size())); return this; }
Example #8
Source File: CondaExecUtil.java From curiostack with MIT License | 5 votes |
public static void addExecToProject(Project project) { project .getExtensions() .getExtraProperties() .set( "condaExec", (Action<Action<ExecSpec>>) execSpecAction -> project.exec( exec -> { execSpecAction.execute(exec); condaExec(exec, project); })); }
Example #9
Source File: GradleProcessExecutor.java From javaide with GNU General Public License v3.0 | 5 votes |
@Override public void execute(ExecSpec execSpec) { execSpec.setExecutable(processInfo.getExecutable()); execSpec.args(processInfo.getArgs()); 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); }
Example #10
Source File: ZipAlign.java From javaide with GNU General Public License v3.0 | 5 votes |
@TaskAction public void zipAlign() { getProject().exec(new Action<ExecSpec>() { @Override public void execute(ExecSpec execSpec) { execSpec.executable(getZipAlignExe()); execSpec.args("-f", "4"); execSpec.args(getInputFile()); execSpec.args(getOutputFile()); } }); }
Example #11
Source File: TerraformTask.java From curiostack with MIT License | 4 votes |
public TerraformTask setExecCustomizer(Action<ExecSpec> execCustomizer) { this.execCustomizer = requireNonNull(execCustomizer, "execCustomizer"); return this; }
Example #12
Source File: TerraformTask.java From curiostack with MIT License | 4 votes |
@Input public Action<ExecSpec> getExecCustomizer() { return execCustomizer; }
Example #13
Source File: CondaExecTask.java From curiostack with MIT License | 4 votes |
public CondaExecTask setExecCustomizer(Action<ExecSpec> execCustomizer) { this.execCustomizer = execCustomizer; return this; }
Example #14
Source File: CondaExecUtil.java From curiostack with MIT License | 4 votes |
public static void condaExec(ExecSpec exec, Project project) { condaExec(exec, DownloadedToolManager.get(project), "miniconda-build"); }
Example #15
Source File: ProjectExternalExec.java From pygradle with Apache License 2.0 | 4 votes |
@Override public ExecResult exec(Action<? super ExecSpec> action) { return project.exec(action); }
Example #16
Source File: TeeOutputContainer.java From pygradle with Apache License 2.0 | 4 votes |
public void setOutputs(ExecSpec execSpec) { execSpec.setStandardOutput(teeStdOut); execSpec.setErrorOutput(teeErrOut); }
Example #17
Source File: AbstractPythonMainSourceDefaultTask.java From pygradle with Apache License 2.0 | 4 votes |
public void configureExecution(ExecSpec spec) { }
Example #18
Source File: ExecCommand.java From shipkit with MIT License | 4 votes |
/** * The action that configures the execution of command line */ public Action<ExecSpec> getSetupAction() { return setupAction; }
Example #19
Source File: ExecCommandFactory.java From shipkit with MIT License | 4 votes |
public static Action<ExecSpec> ignoreResult() { return spec -> spec.setIgnoreExitValue(true); }
Example #20
Source File: ExecCommandFactory.java From shipkit with MIT License | 4 votes |
public static Action<ExecSpec> ignoreResult(final File workingDir) { return spec -> { spec.setIgnoreExitValue(true); spec.setWorkingDir(workingDir); }; }
Example #21
Source File: ExecSpecBackedArgCollector.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public ExecSpecBackedArgCollector(ExecSpec action) { this.action = action; }
Example #22
Source File: CoreJavadocOptions.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public void contributeCommandLineOptions(ExecSpec execHandleBuilder) { execHandleBuilder .args(GUtil.prefix("-J", jFlags)) // J flags can not be set in the option file .args(GUtil.prefix("@", GFileUtils.toPaths(optionFiles))); // add additional option files }
Example #23
Source File: AbstractProject.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public ExecResult exec(Closure closure) { return exec(new ClosureBackedAction<ExecSpec>(closure)); }
Example #24
Source File: AbstractProject.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public ExecResult exec(Action<? super ExecSpec> action) { return getProcessOperations().exec(action); }
Example #25
Source File: DefaultFileOperations.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public ExecResult exec(Action<? super ExecSpec> action) { ExecAction execAction = instantiator.newInstance(DefaultExecAction.class, fileResolver); action.execute(execAction); return execAction.execute(); }
Example #26
Source File: DefaultScript.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public ExecResult exec(Closure closure) { return processOperations.exec(new ClosureBackedAction<ExecSpec>(closure)); }
Example #27
Source File: DefaultScript.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public ExecResult exec(Action<? super ExecSpec> action) { return processOperations.exec(action); }
Example #28
Source File: Exec.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
/** * {@inheritDoc} */ public ExecSpec commandLine(Iterable<?> args) { execAction.commandLine(args); return this; }
Example #29
Source File: Exec.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
/** * {@inheritDoc} */ public ExecSpec setIgnoreExitValue(boolean ignoreExitValue) { execAction.setIgnoreExitValue(ignoreExitValue); return this; }
Example #30
Source File: ExecSpecBackedArgCollector.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public ExecSpecBackedArgCollector(ExecSpec action) { this.action = action; }