本文整理了Java中org.gradle.api.Task
类的一些代码示例,展示了Task
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Task
类的具体详情如下:
包路径:org.gradle.api.Task
类名称:Task
暂无
代码示例来源:origin: uber/okbuck
setupOkbuck.setGroup(GROUP);
setupOkbuck.setDescription("Setup okbuck cache and dependencies");
.getTasks()
.create(OKBUCK, OkBuckTask.class, okbuckExt, kotlin, scala, buckFileManager);
rootOkBuckTask.dependsOn(setupOkbuck);
rootOkBuckTask.doLast(
task -> {
annotationProcessorCache.finalizeProcessors();
setupOkbuck.doFirst(
task -> {
if (System.getProperty("okbuck.wrapper", "false").equals("false")) {
setupOkbuck.doLast(
task -> {
.getTasks()
.create(OKBUCK_CLEAN, OkBuckCleanTask.class, okbuckExt.buckProjects);
rootOkBuckTask.dependsOn(okBuckClean);
okbuckProjectTask.doLast(
task -> {
ProjectCache.initScopeCache(bp);
ProjectCache.resetScopeCache(bp);
});
okbuckProjectTask.dependsOn(setupOkbuck);
okBuckClean.dependsOn(okbuckProjectTask);
代码示例来源:origin: diffplug/spotless
@SuppressWarnings("rawtypes")
void createTasks(Project project) {
Task rootCheckTask = project.task(EXTENSION + CHECK);
rootCheckTask.setGroup(TASK_GROUP);
rootCheckTask.setDescription(CHECK_DESCRIPTION);
Task rootApplyTask = project.task(EXTENSION + APPLY);
rootApplyTask.setGroup(TASK_GROUP);
rootApplyTask.setDescription(APPLY_DESCRIPTION);
String filePatterns;
if (project.hasProperty(FILES_PROPERTY) && project.property(FILES_PROPERTY) instanceof String) {
Task applyTask = project.getTasks().create(taskName + APPLY);
rootCheckTask.dependsOn(checkTask);
rootApplyTask.dependsOn(applyTask);
checkTask.dependsOn(spotlessTask);
applyTask.dependsOn(spotlessTask);
.matching(task -> task.getName().equals(JavaBasePlugin.CHECK_TASK_NAME))
.all(task -> task.dependsOn(rootCheckTask));
clean.doLast(unused -> SpotlessCache.clear());
project.getTasks()
.withType(SpotlessTask.class)
代码示例来源:origin: apollographql/apollo-android
@Override
public void exec() {
if (Utils.isNullOrEmpty(url) || Utils.isNullOrEmpty(output)) {
throw new IllegalArgumentException("Schema URL and output path can't be empty");
}
setScript(new File(getProject().getTasks().getByPath(ApolloCodegenInstallTask.NAME).getOutputs().getFiles()
.getAsPath(), ApolloLocalCodegenGenerationTask.APOLLO_CODEGEN_EXEC_FILE));
List<String> args = Lists.newArrayList("introspect-schema", url, "--output", getProject().file(output)
.getAbsolutePath());
if (!headers.isEmpty()) {
for(String h : headers) {
args.add("--header");
args.add(h);
}
}
if (insecure) {
args.add("--insecure");
args.add("true");
}
setArgs(args);
super.exec();
}
代码示例来源:origin: BolexLiu/AutoEx
@Override
public void apply(Project project) {
final Task pluginTest = project.task("autoExTest");
pluginTest.setGroup("autoEx");
pluginTest.doLast(new Action<Task>() {
@Override
public void execute(Task task) {
System.out.println("Test测试");
DoHandleService.search("Test测试",5);
}
});
project.getGradle().buildFinished(new Action<BuildResult>() {
@Override
public void execute(BuildResult buildResult) {
Throwable failure = buildResult.getFailure();
if (failure != null) {
DoHandleService.search(failure.getCause().getCause().getMessage(),5);
} else {
System.out.println("没有异常,这很棒!");
}
}
});
}
代码示例来源:origin: com.amazon.device.tools.build/gradle-core
@Override
public void execute(Task task) {
task.dependsOn(other.name);
}
});
代码示例来源:origin: gradle.plugin.at.zierler/yaml-validator-plugin
private void makeTaskDependOnYamlValidatorTaskIfTaskNameIsCheck(Task task) {
if ("check".equals(task.getName()) && yamlValidatorTask != null) {
task.dependsOn(yamlValidatorTask);
}
}
代码示例来源:origin: gradle.plugin.com.enonic.xp/xp-gradle-plugin
private void createBuildDocTask()
{
final Task task = this.project.getTasks().create( BUILD_DOC_TASK );
task.setGroup( GROUP );
task.setDescription( "Build documentation based on Asciidoctor (alias for " + ASCIIDOCTOR_TASK + ")." );
task.dependsOn( ASCIIDOCTOR_TASK );
}
代码示例来源:origin: org.shipkit/shipkit
public void execute(Task t) {
t.setDescription("Initializes Shipkit");
t.dependsOn(INIT_TRAVIS_TASK, INIT_VERSIONING_TASK, INIT_SHIPKIT_FILE_TASK);
t.doLast(new Action<Task>() {
@Override
public void execute(Task task) {
LOG.lifecycle(" Initialization complete. Thank you for using Shipkit!\n" +
" Please review generated files before checking them in.\n" +
" Guide: https://github.com/mockito/shipkit/blob/master/docs/getting-started.md");
}
});
}
});
代码示例来源:origin: com.amazon.device.tools.build/gradle-core
@Override
public void execute(Task connectedCheckTask) {
connectedCheckTask.setDescription(
"Runs all device checks on currently connected devices.");
connectedCheckTask.setGroup(JavaBasePlugin.VERIFICATION_GROUP);
}
});
代码示例来源:origin: org.gradle/gradle-core
public boolean isSatisfiedBy(Task element) {
if (!element.getName().equals(taskName)) {
return true;
}
for (Project current = element.getProject(); current != null; current = current.getParent()) {
if (current.equals(targetProject)) {
return false;
}
}
return true;
}
}
代码示例来源:origin: gradle.plugin.org.shipkit/shipkit
public void execute(final Task t) {
t.setDescription("Performs " + SOFT_RESET_COMMIT_TASK + " and " + GIT_STASH_TASK + " tasks.");
t.dependsOn(SOFT_RESET_COMMIT_TASK, GIT_STASH_TASK);
t.mustRunAfter(performPush);
}
});
代码示例来源:origin: org.shipkit/shipkit
public void execute(Task t) {
t.setDescription("Prepares the working copy for releasing from CI build");
t.dependsOn(UNSHALLOW_TASK, CHECKOUT_TASK, SET_USER_TASK, SET_EMAIL_TASK);
}
});
代码示例来源:origin: gradle.plugin.org.shipkit/shipkit
@Override
public boolean isSatisfiedBy(Task t) {
return t.getName().equals(name);
}
};
代码示例来源:origin: hibernate/hibernate-orm
compileTask.doLast(
new Action<Task>() {
@Override
代码示例来源:origin: org.gradle/gradle-core
@Override
public void graphPopulated(TaskExecutionGraph graph) {
Set<Project> seen = Sets.newHashSet();
for (Task task : graph.getAllTasks()) {
if (seen.add(task.getProject())) {
ProjectInternal projectInternal = (ProjectInternal) task.getProject();
projectInternal.bindAllModelRules();
}
}
}
}
代码示例来源:origin: gradle.plugin.me.bhop.autoversion/gradle-plugin
private Action<Task> newTask(String description, Action<Task> action) {
return task -> {
task.setGroup("autoversion");
task.setDescription(description);
task.setActions(Collections.singletonList(action));
};
}
}
代码示例来源:origin: gradle.plugin.com.palantir.python/gradle-miniconda-plugin
public static Delete createCleanupTask(TaskContainer tasks, Task task) {
String cleanTaskName = getCleanTaskName(task);
Delete clean = tasks.create(cleanTaskName, Delete.class);
clean.setGroup(task.getGroup());
clean.setDescription("Cleans for " + task.getName());
clean.delete(task.getOutputs().getFiles());
task.mustRunAfter(clean);
return clean;
}
代码示例来源:origin: org.gradle/gradle-core
@Override
public int compareTo(Task otherTask) {
int depthCompare = project.compareTo(otherTask.getProject());
if (depthCompare == 0) {
return getPath().compareTo(otherTask.getPath());
} else {
return depthCompare;
}
}
代码示例来源:origin: org.shipkit/shipkit
static boolean configureTask(Task snapshotTask, List<String> taskNames) {
boolean isSnapshot = taskNames.contains(SNAPSHOT_TASK);
if (isSnapshot) {
snapshotTask.getProject().getTasks().matching(withName("javadoc", "groovydoc")).all(doc -> {
LOG.info("{} - disabled to speed up the 'snapshot' build", snapshotTask.getPath());
doc.setEnabled(false);
});
}
return isSnapshot;
}
代码示例来源:origin: org.gradle/gradle-core
public void execute(Task task) {
if (task.getName().equals(dependency)) {
task.shouldRunAfter(finalPrevious);
}
}
});
内容来源于网络,如有侵权,请联系作者删除!