本文整理了Java中org.gradle.api.Task.setEnabled()
方法的一些代码示例,展示了Task.setEnabled()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Task.setEnabled()
方法的具体详情如下:
包路径:org.gradle.api.Task
类名称:Task
方法名:setEnabled
暂无
代码示例来源:origin: gradle.plugin.org.mockito/release
public void afterExecute(Task task, TaskState taskState) {
//when one of the main step tasks fails, enable all rollback tasks
if (taskState.getFailure() != null && ext.steps.contains(task)) {
for (Task rollback : ext.postSteps) {
rollback.setEnabled(true);
}
}
}
}
代码示例来源:origin: gradle.plugin.com.digitalascent/digitalascent-gradle-project
private void registerPublishArtifactsTask(Project project) {
Action<DefaultTask> configureAction = task -> {
task.dependsOn("release", "bintrayUpload", "artifactoryPublish");
task.setGroup("publishing");
Task bintrayUploadTask = project.getTasksByName("bintrayUpload", false).stream().findFirst().orElseThrow(() -> new IllegalStateException("Unable to find bintrayUpload task"));
Task artifactoryPublishTask = project.getTasksByName("artifactoryPublish", false).stream().findFirst().orElseThrow(() -> new IllegalStateException("Unable to find artifactoryPublish task"));
artifactoryPublishTask.setEnabled(false);
bintrayUploadTask.setEnabled(false);
// TODO - can these come from gradle-info-plugin?
String tag = System.getenv("TRAVIS_TAG");
String branch = System.getenv("TRAVIS_BRANCH");
String pullRequest = System.getenv("TRAVIS_PULL_REQUEST");
if ((tag != null && !tag.isEmpty()) || ("master".equals(branch) && "false".equals(pullRequest))) {
if (tag != null && !tag.isEmpty()) {
bintrayUploadTask.setEnabled(true);
} else {
artifactoryPublishTask.setEnabled(true);
}
}
project.getLogger().lifecycle("Publish artifacts task configured; tag={}, branch={}, pullRequest={},bintrayUploadTask.enabled={},artifactoryPublishTask={}",
tag, branch, pullRequest, bintrayUploadTask.getEnabled(), artifactoryPublishTask.getEnabled());
};
project.getTasks().create("publishArtifacts", DefaultTask.class, configureAction);
}
代码示例来源:origin: com.android.tools.build/gradle-core
public void doCall(TaskExecutionGraph taskGraph) {
if (taskGraph.hasTask(LINT)) {
project.getTasks().getByName(lintReleaseCheck.getName()).setEnabled(false);
}
}
});
代码示例来源: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: mockito/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: com.android.tools.build/gradle-core
private <T extends Task> void disableTask(AndroidTask<T> task) {
LOG.info("Disabling task {}", task.getName());
transformVariantScope.getGlobalScope().getProject().getTasks().getByName(task.getName())
.setEnabled(false);
}
代码示例来源:origin: linkedin/pygradle
task.setDescription("Backward compatibility place-holder task for packaging web app");
task.dependsOn(project.getTasks().getByName(TASK_BUILD_WEB_APPLICATION));
task.setEnabled(false);
});
代码示例来源:origin: gradle.plugin.com.linkedin.pygradle/pygradle-plugin
task.setDescription("Backward compatibility place-holder task for packaging web app");
task.dependsOn(project.getTasks().getByName(TASK_BUILD_WEB_APPLICATION));
task.setEnabled(false);
});
代码示例来源:origin: Putnami/putnami-gradle-plugin
@TaskAction
public void exec() {
PutnamiExtension putnami = getProject().getExtensions().getByType(PutnamiExtension.class);
CompilerOption compilerOptions = putnami.getCompile();
if (!Strings.isNullOrEmpty(putnami.getSourceLevel()) &&
Strings.isNullOrEmpty(compilerOptions.getSourceLevel())) {
compilerOptions.setSourceLevel(putnami.getSourceLevel());
}
CompileCommandBuilder commandBuilder = new CompileCommandBuilder();
commandBuilder.configure(getProject(), compilerOptions, getSrc(), getWar(), getModules());
JavaAction compileAction = commandBuilder.buildJavaAction();
compileAction.execute(this);
compileAction.join();
if (compileAction.exitValue() != 0) {
throw new RuntimeException("Fail to compile GWT modules");
}
getProject().getTasks().getByName(GwtCheckTask.NAME).setEnabled(false);
}
代码示例来源:origin: gradle.plugin.de.esoco.gwt/gwt-gradle-plugin
@TaskAction
public void exec() {
GwtExtension extension = getProject().getExtensions().getByType(GwtExtension.class);
CompilerOption compilerOptions = extension.getCompile();
if (!Strings.isNullOrEmpty(extension.getSourceLevel()) &&
Strings.isNullOrEmpty(compilerOptions.getSourceLevel())) {
compilerOptions.setSourceLevel(extension.getSourceLevel());
}
CompileCommandBuilder commandBuilder = new CompileCommandBuilder();
commandBuilder.configure(getProject(), compilerOptions, getSrc(), getWar(), getModules());
JavaAction compileAction = commandBuilder.buildJavaAction();
compileAction.execute(this);
compileAction.join();
if (compileAction.exitValue() != 0) {
throw new RuntimeException("Fail to compile GWT modules");
}
getProject().getTasks().getByName(GwtCheckTask.NAME).setEnabled(false);
}
代码示例来源:origin: io.github.gradle-clojure/gradle-clojure-plugin
toDisable.forEach(task -> task.setEnabled(false));
代码示例来源:origin: gradle-clojure/gradle-clojure
toDisable.forEach(task -> task.setEnabled(false));
代码示例来源:origin: gradle.plugin.org.mockito/release
postStep.setEnabled(false);
内容来源于网络,如有侵权,请联系作者删除!