本文整理汇总了Java中org.gradle.process.ExecSpec类的典型用法代码示例。如果您正苦于以下问题:Java ExecSpec类的具体用法?Java ExecSpec怎么用?Java ExecSpec使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExecSpec类属于org.gradle.process包,在下文中一共展示了ExecSpec类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: send
import org.gradle.process.ExecSpec; //导入依赖的package包/类
@Override
public void send(final String title, final String message) {
final File exe = OperatingSystem.current().findInPath("notify-send");
if (exe == null) {
throw new AnnouncerUnavailableException("Could not find 'notify-send' in the path.");
}
processOperations.exec(new Action<ExecSpec>() {
@Override
public void execute(ExecSpec execSpec) {
execSpec.executable(exe);
File icon = iconProvider.getIcon(32, 32);
if (icon != null) {
execSpec.args("-i", icon.getAbsolutePath());
}
execSpec.args("--hint=int:transient:1");
execSpec.args(title, message);
}
});
}
示例2: send
import org.gradle.process.ExecSpec; //导入依赖的package包/类
@Override
public void send(final String title, final String message) {
final File exe = OperatingSystem.current().findInPath("growlnotify");
if (exe == null) {
throw new AnnouncerUnavailableException("Could not find 'growlnotify' in path.");
}
processOperations.exec(new Action<ExecSpec>() {
@Override
public void execute(ExecSpec execSpec) {
execSpec.executable(exe);
execSpec.args("-m", message);
File icon = iconProvider.getIcon(48, 48);
if (icon != null) {
execSpec.args("--image", icon.getAbsolutePath());
}
execSpec.args("-t", title);
}
});
}
示例3: exec
import org.gradle.process.ExecSpec; //导入依赖的package包/类
@TaskAction
void exec() {
getProject().exec(new Action<ExecSpec>() {
@Override
public void execute(ExecSpec execSpec) {
try {
if (dexMergerExecutable == null) {
dexMergerExecutable = Utils.dexMergerExecutable();
}
execSpec.setExecutable(dexMergerExecutable);
execSpec.args(destination.getCanonicalPath());
execSpec.args(source.getFiles());
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
});
}
示例4: doZipAlign
import org.gradle.process.ExecSpec; //导入依赖的package包/类
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;
}
示例5: getGitTags
import org.gradle.process.ExecSpec; //导入依赖的package包/类
static Integer getGitTags(final Project project) {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final ExecResult res = project.exec(new Action<ExecSpec>() {
@Override
public void execute(final ExecSpec execSpec) {
execSpec.commandLine("git", "tag");
execSpec.setStandardOutput(baos);
}
});
System.out.println(String.format("getGitTags:exit '%d'", res.getExitValue()));
if (res.getExitValue() == 0) {
final String str = baos.toString().trim();
final int numTags = (str == null || str.length() == 0) ? 1 : str.split("\n").length;
System.out.println(String.format("getGitTags 'num=%d'", numTags));
return numTags;
} else {
return 1;
}
}
示例6: ignoreResult
import org.gradle.process.ExecSpec; //导入依赖的package包/类
public static Action<ExecSpec> ignoreResult() {
return new Action<ExecSpec>() {
public void execute(ExecSpec spec) {
spec.setIgnoreExitValue(true);
}
};
}
示例7: getGitTagDescriptions
import org.gradle.process.ExecSpec; //导入依赖的package包/类
static String getGitTagDescriptions(final Project project) {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final ExecResult res = project.exec(new Action<ExecSpec>() {
@Override
public void execute(final ExecSpec execSpec) {
execSpec.setWorkingDir(project.getProjectDir());
execSpec.commandLine("git", "describe", "--tags", "--long");
execSpec.setStandardOutput(baos);
}
});
System.out.println(String.format("getGitTagDescriptions:exit '%d'", res.getExitValue()));
if (res.getExitValue() == 0) {
final String str = baos.toString().trim();
if (str == null || str.length() == 0) {
return "1.0.0";
} else {
final String[] arr = str.split("-");
// [0] - fullVersionTag
// [1] - versionBuild
// [2] - gitSHA
System.out.println(String.format("getGitTagDescriptions '%s' {fullVersion=%s}", str, arr[0]));
return arr[0];
}
} else {
return "1.0.0";
}
}
示例8: zipAlign
import org.gradle.process.ExecSpec; //导入依赖的package包/类
@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());
}
});
}
示例9: ExecSpecBackedArgCollector
import org.gradle.process.ExecSpec; //导入依赖的package包/类
public ExecSpecBackedArgCollector(ExecSpec action) {
this.action = action;
}
示例10: contributeCommandLineOptions
import org.gradle.process.ExecSpec; //导入依赖的package包/类
@Override
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
}
示例11: exec
import org.gradle.process.ExecSpec; //导入依赖的package包/类
public ExecResult exec(Action<? super ExecSpec> action) {
return getProcessOperations().exec(action);
}
示例12: exec
import org.gradle.process.ExecSpec; //导入依赖的package包/类
public ExecResult exec(Action<? super ExecSpec> action) {
ExecAction execAction = instantiator.newInstance(DefaultExecAction.class, fileResolver);
action.execute(execAction);
return execAction.execute();
}
示例13: exec
import org.gradle.process.ExecSpec; //导入依赖的package包/类
@Override
public ExecResult exec(Action<? super ExecSpec> action) {
return processOperations.exec(action);
}
示例14: apply
import org.gradle.process.ExecSpec; //导入依赖的package包/类
@Override
public void apply(Project project) {
project.getPlugins().apply(NodePlugin.class);
YarnTask initTask = project.getTasks().create("init", YarnTask.class);
initTask.setArgs(ImmutableList.of("init", "--yes", "--private"));
initTask.finalizedBy(
project
.getTasks()
.create(
"initAddDependency",
YarnTask.class,
task -> {
task.setArgs(ImmutableList.of("add", "@curiostack/cloudbuild-github"));
task.onlyIf(t -> !project.file("package.json").exists());
}),
"yarn");
initTask.onlyIf(t -> !project.file("package.json").exists());
ImmutableGcloudExtension gcloudConfig =
project.getRootProject().getExtensions().getByType(GcloudExtension.class);
Map<String, String> defaultEnvironment =
ImmutableMap.of("GCLOUD_PROJECT", gcloudConfig.clusterProject());
YarnTask setupTask = project.getTasks().create("setup", YarnTask.class);
setupTask.setArgs(ImmutableList.of("run", "cloudbuild-cli", "setup", "--defaults"));
setupTask.dependsOn(initTask);
setupTask.onlyIf(t -> !project.file("config.yml").exists());
setupTask.setExecOverrides(
LambdaClosure.of(
((ExecSpec exec) -> exec.setStandardInput(System.in).setStandardOutput(System.out))));
setupTask.setEnvironment(defaultEnvironment);
Map<String, String> environment =
gcloudConfig.download()
? ImmutableMap.<String, String>builder()
.put(
"PATH",
gcloudConfig.platformConfig().gcloudBinDir()
+ File.pathSeparator
+ System.getenv("PATH"))
.putAll(defaultEnvironment)
.build()
: defaultEnvironment;
YarnTask deployTask = project.getTasks().create("deploy", YarnTask.class);
deployTask.setArgs(ImmutableList.of("run", "cloudbuild-cli", "deploy", "--delete"));
deployTask.dependsOn(setupTask);
deployTask.setEnvironment(environment);
deployTask.dependsOn(":gcloudSetup");
}
示例15: getSetupAction
import org.gradle.process.ExecSpec; //导入依赖的package包/类
/**
* The action that configures the execution of command line
*/
public Action<ExecSpec> getSetupAction() {
return setupAction;
}