本文整理汇总了Java中org.gradle.api.Task.dependsOn方法的典型用法代码示例。如果您正苦于以下问题:Java Task.dependsOn方法的具体用法?Java Task.dependsOn怎么用?Java Task.dependsOn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.gradle.api.Task
的用法示例。
在下文中一共展示了Task.dependsOn方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: attachBinariesToAssembleLifecycle
import org.gradle.api.Task; //导入方法依赖的package包/类
@Mutate
void attachBinariesToAssembleLifecycle(@Path("tasks.assemble") Task assemble, ComponentSpecContainer components) {
List<BinarySpecInternal> notBuildable = Lists.newArrayList();
boolean hasBuildableBinaries = false;
for (VariantComponentSpec component : components.withType(VariantComponentSpec.class)) {
for (BinarySpecInternal binary : component.getBinaries().withType(BinarySpecInternal.class)) {
if (binary.isBuildable()) {
assemble.dependsOn(binary);
hasBuildableBinaries = true;
} else {
notBuildable.add(binary);
}
}
}
if (!hasBuildableBinaries && !notBuildable.isEmpty()) {
assemble.doFirst(new CheckForNotBuildableBinariesAction(notBuildable));
}
}
示例2: apply
import org.gradle.api.Task; //导入方法依赖的package包/类
@Override public void apply(Project project) {
project.getPluginManager().apply(JavaPlugin.class);
project.getConfigurations().create("capsule").defaultDependencies(dependencySet -> {
dependencySet.add(project.getDependencies().create("co.paralleluniverse:capsule:1.0.3"));
});
project.getTasks().withType(Capsule.class).all(task -> task.executesInside(project));
Capsule capsuleTask = project.getTasks().create("capsule", Capsule.class);
capsuleTask.setGroup(BUILD_GROUP);
capsuleTask.setDescription("Assembles a jar archive containing Capsule, caplets, and necessary jars to run an application.");
Task assembleTask = project.getTasks().findByName("assemble");
assembleTask.dependsOn(capsuleTask);
Task jarTask = project.getTasks().findByName("jar");
capsuleTask.dependsOn(jarTask);
}
示例3: createTasksFor
import org.gradle.api.Task; //导入方法依赖的package包/类
public void createTasksFor(BinarySpecInternal binary) {
Set<LanguageSourceSetInternal> sourceSetsToCompile = getSourcesToCompile(binary);
for (LanguageTransform<?, ?> languageTransform : prioritizedTransforms) {
if (!languageTransform.applyToBinary(binary)) {
continue;
}
LanguageSourceSetInternal sourceSetToCompile;
while ((sourceSetToCompile = findSourceFor(languageTransform, sourceSetsToCompile)) != null) {
sourceSetsToCompile.remove(sourceSetToCompile);
final SourceTransformTaskConfig taskConfig = languageTransform.getTransformTask();
String taskName = getTransformTaskName(languageTransform, taskConfig, binary, sourceSetToCompile);
Task task = tasks.create(taskName, taskConfig.getTaskType());
taskConfig.configureTask(task, binary, sourceSetToCompile, serviceRegistry);
task.dependsOn(sourceSetToCompile);
binary.getTasks().add(task);
if (binary.hasCodependentSources() && taskConfig instanceof JointCompileTaskConfig) {
JointCompileTaskConfig jointCompileTaskConfig = (JointCompileTaskConfig) taskConfig;
Iterator<LanguageSourceSetInternal> candidateSourceSets = sourceSetsToCompile.iterator();
while (candidateSourceSets.hasNext()) {
LanguageSourceSetInternal candidate = candidateSourceSets.next();
if (jointCompileTaskConfig.canTransform(candidate)) {
jointCompileTaskConfig.configureAdditionalTransform(task, candidate);
candidateSourceSets.remove();
}
}
}
}
}
// Should really fail here if sourcesToCompile is not empty: no transform for this source set in this binary
}
示例4: attachBinariesCheckTasksToCheckLifecycle
import org.gradle.api.Task; //导入方法依赖的package包/类
@Finalize
void attachBinariesCheckTasksToCheckLifecycle(@Path("tasks.check") Task checkTask, @Path("binaries") ModelMap<BinarySpec> binaries) {
for (BinarySpec binary : binaries) {
if (binary.isBuildable()) {
Task binaryCheckTask = binary.getCheckTask();
if (binaryCheckTask != null) {
checkTask.dependsOn(binaryCheckTask);
}
}
}
}
示例5: wireBuildDependentTasks
import org.gradle.api.Task; //导入方法依赖的package包/类
public static void wireBuildDependentTasks(final ModelMap<Task> tasks, BinaryContainer binaries, final DependentBinariesResolver dependentsResolver, final ProjectModelResolver projectModelResolver) {
final ModelMap<NativeBinarySpecInternal> nativeBinaries = binaries.withType(NativeBinarySpecInternal.class);
for (final BinarySpecInternal binary : nativeBinaries) {
Task assembleDependents = tasks.get(binary.getNamingScheme().getTaskName(ASSEMBLE_DEPENDENTS_TASK_NAME));
Task buildDependents = tasks.get(binary.getNamingScheme().getTaskName(BUILD_DEPENDENTS_TASK_NAME));
// Wire build dependent components tasks dependencies
Task assembleDependentComponents = tasks.get(getAssembleDependentComponentsTaskName(binary.getComponent()));
if (assembleDependentComponents != null) {
assembleDependentComponents.dependsOn(assembleDependents);
}
Task buildDependentComponents = tasks.get(getBuildDependentComponentsTaskName(binary.getComponent()));
if (buildDependentComponents != null) {
buildDependentComponents.dependsOn(buildDependents);
}
// Wire build dependent binaries tasks dependencies
// Defer dependencies gathering as we need to resolve across project's boundaries
assembleDependents.dependsOn(new Callable<Iterable<Task>>() {
@Override
public Iterable<Task> call() {
return getDependentTaskDependencies(ASSEMBLE_DEPENDENTS_TASK_NAME, binary, dependentsResolver, projectModelResolver);
}
});
buildDependents.dependsOn(new Callable<Iterable<Task>>() {
@Override
public Iterable<Task> call() {
return getDependentTaskDependencies(BUILD_DEPENDENTS_TASK_NAME, binary, dependentsResolver, projectModelResolver);
}
});
}
}
示例6: addAssembleTask
import org.gradle.api.Task; //导入方法依赖的package包/类
private void addAssembleTask(Project project, Distribution distribution, Task... tasks) {
String taskName = TASK_ASSEMBLE_NAME;
if (!MAIN_DISTRIBUTION_NAME.equals(distribution.getName())) {
taskName = "assemble" + StringGroovyMethods.capitalize(distribution.getName()) + "Dist";
}
Task assembleTask = project.getTasks().create(taskName);
assembleTask.setDescription("Assembles the " + distribution.getName() + " distributions");
assembleTask.setGroup(DISTRIBUTION_GROUP);
assembleTask.dependsOn((Object[]) tasks);
}
示例7: apply
import org.gradle.api.Task; //导入方法依赖的package包/类
public void apply(String taskName) {
if (taskName.startsWith(PREFIX)) {
String configurationName = StringUtils.uncapitalize(taskName.substring(PREFIX.length()));
Configuration configuration = configurations.findByName(configurationName);
if (configuration != null) {
Task task = tasks.create(taskName);
task.dependsOn(configuration.getAllArtifacts());
task.setDescription("Builds the artifacts belonging to " + configuration + ".");
}
}
}
示例8: createBinaryLifecycleTask
import org.gradle.api.Task; //导入方法依赖的package包/类
private void createBinaryLifecycleTask(SourceSet sourceSet, Project target) {
sourceSet.compiledBy(sourceSet.getClassesTaskName());
Task binaryLifecycleTask = target.task(sourceSet.getClassesTaskName());
binaryLifecycleTask.setGroup(LifecycleBasePlugin.BUILD_GROUP);
binaryLifecycleTask.setDescription("Assembles " + sourceSet.getOutput() + ".");
binaryLifecycleTask.dependsOn(sourceSet.getOutput().getDirs());
binaryLifecycleTask.dependsOn(sourceSet.getCompileJavaTaskName());
binaryLifecycleTask.dependsOn(sourceSet.getProcessResourcesTaskName());
}
示例9: setupRuntimeDependencies
import org.gradle.api.Task; //导入方法依赖的package包/类
private void setupRuntimeDependencies(Project project, Task generateTask) {
TSGeneratorConfig config = project.getExtensions().getByType(TSGeneratorConfig.class);
String runtimeConfiguration = config.getRuntime().getConfiguration();
if (runtimeConfiguration != null) {
String runtimeConfigurationFirstUpper =
Character.toUpperCase(runtimeConfiguration.charAt(0)) + runtimeConfiguration.substring(1);
// make sure applications is compiled in order to startup and extract meta information
String processResourcesName = "process" + runtimeConfigurationFirstUpper + "Resources";
String compileJavaName = "compile" + runtimeConfigurationFirstUpper + "Java";
TaskContainer tasks = project.getTasks();
Task processResourceTask = tasks.findByName(processResourcesName);
Task compileJavaTask = tasks.findByName(compileJavaName);
if (processResourceTask != null) {
generateTask.dependsOn(processResourceTask);
}
if (compileJavaTask != null) {
generateTask.dependsOn(compileJavaTask, compileJavaTask);
}
// setup up-to-date checking
Configuration compileConfiguration = project.getConfigurations().findByName(runtimeConfiguration);
if (compileConfiguration != null) {
generateTask.getInputs().file(compileConfiguration.getFiles());
generateTask.getOutputs().dir(config.getGenDir());
}
}
}
示例10: setBuildTask
import org.gradle.api.Task; //导入方法依赖的package包/类
@Override
public void setBuildTask(Task buildTask) {
this.buildTask = buildTask;
buildTask.dependsOn(buildTaskDependencies);
}
示例11: setCheckTask
import org.gradle.api.Task; //导入方法依赖的package包/类
@Override
public void setCheckTask(Task checkTask) {
this.checkTask = checkTask;
checkTask.dependsOn(checkTaskDependencies);
}
示例12: apply
import org.gradle.api.Task; //导入方法依赖的package包/类
@Override
public void apply(Project project) {
project.getPluginManager().apply(ReportingBasePlugin.class);
final ProjectReportsPluginConvention convention = new ProjectReportsPluginConvention(project);
project.getConvention().getPlugins().put("projectReports", convention);
TaskReportTask taskReportTask = project.getTasks().create(TASK_REPORT, TaskReportTask.class);
taskReportTask.setDescription("Generates a report about your tasks.");
taskReportTask.conventionMapping("outputFile", new Callable<Object>() {
public Object call() throws Exception {
return new File(convention.getProjectReportDir(), "tasks.txt");
}
});
taskReportTask.conventionMapping("projects", new Callable<Object>() {
public Object call() throws Exception {
return convention.getProjects();
}
});
PropertyReportTask propertyReportTask = project.getTasks().create(PROPERTY_REPORT, PropertyReportTask.class);
propertyReportTask.setDescription("Generates a report about your properties.");
propertyReportTask.conventionMapping("outputFile", new Callable<Object>() {
public Object call() throws Exception {
return new File(convention.getProjectReportDir(), "properties.txt");
}
});
propertyReportTask.conventionMapping("projects", new Callable<Object>() {
public Object call() throws Exception {
return convention.getProjects();
}
});
DependencyReportTask dependencyReportTask = project.getTasks().create(DEPENDENCY_REPORT,
DependencyReportTask.class);
dependencyReportTask.setDescription("Generates a report about your library dependencies.");
dependencyReportTask.conventionMapping("outputFile", new Callable<Object>() {
public Object call() throws Exception {
return new File(convention.getProjectReportDir(), "dependencies.txt");
}
});
dependencyReportTask.conventionMapping("projects", new Callable<Object>() {
public Object call() throws Exception {
return convention.getProjects();
}
});
HtmlDependencyReportTask htmlDependencyReportTask = project.getTasks().create(HTML_DEPENDENCY_REPORT,
HtmlDependencyReportTask.class);
htmlDependencyReportTask.setDescription("Generates an HTML report about your library dependencies.");
new DslObject(htmlDependencyReportTask.getReports().getHtml()).getConventionMapping().map("destination", new Callable<Object>() {
public Object call() throws Exception {
return new File(convention.getProjectReportDir(), "dependencies");
}
});
htmlDependencyReportTask.conventionMapping("projects", new Callable<Object>() {
public Object call() throws Exception {
return convention.getProjects();
}
});
Task projectReportTask = project.getTasks().create(PROJECT_REPORT);
projectReportTask.dependsOn(TASK_REPORT, PROPERTY_REPORT, DEPENDENCY_REPORT, HTML_DEPENDENCY_REPORT);
projectReportTask.setDescription("Generates a report about your project.");
projectReportTask.setGroup("reporting");
}
示例13: addDependsOnTaskInOtherProjects
import org.gradle.api.Task; //导入方法依赖的package包/类
/**
* Adds a dependency on tasks with the specified name in other projects. The other projects are determined from
* project lib dependencies using the specified configuration name. These may be projects this project depends on or
* projects that depend on this project based on the useDependOn argument.
*
* @param task Task to add dependencies to
* @param useDependedOn if true, add tasks from projects this project depends on, otherwise use projects that depend
* on this one.
* @param otherProjectTaskName name of task in other projects
* @param configurationName name of configuration to use to find the other projects
*/
private void addDependsOnTaskInOtherProjects(final Task task, boolean useDependedOn, String otherProjectTaskName,
String configurationName) {
Project project = task.getProject();
final Configuration configuration = project.getConfigurations().getByName(configurationName);
task.dependsOn(configuration.getTaskDependencyFromProjectDependency(useDependedOn, otherProjectTaskName));
}