当前位置: 首页>>代码示例>>Java>>正文


Java TaskContainer.findByName方法代码示例

本文整理汇总了Java中org.gradle.api.tasks.TaskContainer.findByName方法的典型用法代码示例。如果您正苦于以下问题:Java TaskContainer.findByName方法的具体用法?Java TaskContainer.findByName怎么用?Java TaskContainer.findByName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.gradle.api.tasks.TaskContainer的用法示例。


在下文中一共展示了TaskContainer.findByName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: constructTask

import org.gradle.api.tasks.TaskContainer; //导入方法依赖的package包/类
@Override
public Task constructTask(final TaskReference reference, TaskContainer tasks) {
    if (!(reference instanceof IncludedBuildTaskReference)) {
        return null;
    }

    final IncludedBuildTaskReference ref = (IncludedBuildTaskReference) reference;
    String delegateTaskName = ref.getBuildName();

    Task task = tasks.findByName(delegateTaskName);

    if (task == null) {
        return tasks.create(delegateTaskName, CompositeBuildTaskDelegate.class, new Action<CompositeBuildTaskDelegate>() {
            @Override
            public void execute(CompositeBuildTaskDelegate compositeBuildTaskDelegate) {
                compositeBuildTaskDelegate.setBuild(ref.getBuildName());
                compositeBuildTaskDelegate.addTask(ref.getTaskPath());
            }
        });
    }

    if (task instanceof CompositeBuildTaskDelegate) {
        CompositeBuildTaskDelegate delegateTask = (CompositeBuildTaskDelegate) task;
        Preconditions.checkState(((CompositeBuildTaskDelegate) task).getBuild().equals(ref.getBuildName()));
        delegateTask.addTask(ref.getTaskPath());
        return task;
    }

    throw new TaskInstantiationException("Cannot create delegating task '" + delegateTaskName + "' as task with same name already exists.");
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:31,代码来源:IncludedBuildTaskReferenceResolver.java

示例2: maybeAddTask

import org.gradle.api.tasks.TaskContainer; //导入方法依赖的package包/类
private static <T extends Task> void maybeAddTask(Project project, IdePlugin plugin, String taskName, Class<T> taskType, Action<T> action) {
    TaskContainer tasks = project.getTasks();
    if (tasks.findByName(taskName) != null) {
        return;
    }

    T task = tasks.create(taskName, taskType);
    action.execute(task);
    plugin.addWorker(task);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:11,代码来源:EclipsePlugin.java

示例3: setupRuntimeDependencies

import org.gradle.api.tasks.TaskContainer; //导入方法依赖的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


注:本文中的org.gradle.api.tasks.TaskContainer.findByName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。