當前位置: 首頁>>代碼示例>>Java>>正文


Java Task.dependsOn方法代碼示例

本文整理匯總了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));
    }
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:19,代碼來源:ComponentModelBasePlugin.java

示例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);
}
 
開發者ID:jonas-l,項目名稱:gradle-capsule-plugin,代碼行數:20,代碼來源:Plugin.java

示例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
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:37,代碼來源:BinarySourceTransformations.java

示例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);
            }
        }
    }
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:12,代碼來源:TestingModelBasePlugin.java

示例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);
            }
        });
    }
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:31,代碼來源:NativeComponents.java

示例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);
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:12,代碼來源:DistributionPlugin.java

示例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 + ".");
        }
    }
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:13,代碼來源:BuildConfigurationRule.java

示例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());
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:11,代碼來源:JavaBasePlugin.java

示例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());
		}
	}
}
 
開發者ID:crnk-project,項目名稱:crnk-framework,代碼行數:29,代碼來源:TSGeneratorPlugin.java

示例10: setBuildTask

import org.gradle.api.Task; //導入方法依賴的package包/類
@Override
public void setBuildTask(Task buildTask) {
    this.buildTask = buildTask;
    buildTask.dependsOn(buildTaskDependencies);
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:6,代碼來源:AbstractBuildableComponentSpec.java

示例11: setCheckTask

import org.gradle.api.Task; //導入方法依賴的package包/類
@Override
public void setCheckTask(Task checkTask) {
    this.checkTask = checkTask;
    checkTask.dependsOn(checkTaskDependencies);
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:6,代碼來源:AbstractBuildableComponentSpec.java

示例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");
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:66,代碼來源:ProjectReportsPlugin.java

示例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));
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:18,代碼來源:JavaPlugin.java


注:本文中的org.gradle.api.Task.dependsOn方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。