本文整理汇总了Java中org.gradle.api.Task.getProject方法的典型用法代码示例。如果您正苦于以下问题:Java Task.getProject方法的具体用法?Java Task.getProject怎么用?Java Task.getProject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.gradle.api.Task
的用法示例。
在下文中一共展示了Task.getProject方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import org.gradle.api.Task; //导入方法依赖的package包/类
public TaskDetails create(final Task task) {
final String path;
Project project = task.getProject();
if (projects.contains(project)) {
path = this.project.relativeProjectPath(task.getPath());
} else {
path = task.getPath();
}
return new TaskDetails() {
public Path getPath() {
return Path.path(path);
}
public String getDescription() {
return task.getDescription();
}
};
}
示例2: buildFromTask
import org.gradle.api.Task; //导入方法依赖的package包/类
public static <T extends LaunchableGradleTask> T buildFromTask(T target, Task task) {
Project project = task.getProject();
target.setPath(task.getPath())
.setName(task.getName())
.setGroup(task.getGroup())
.setDisplayName(task.toString())
.setDescription(task.getDescription())
.setPublic(PublicTaskSpecification.INSTANCE.isSatisfiedBy(task))
.setProjectIdentifier(new DefaultProjectIdentifier(project.getRootDir(), project.getPath()));
return target;
}
示例3: afterExecute
import org.gradle.api.Task; //导入方法依赖的package包/类
public void afterExecute(Task task, TaskState state) {
long now = timeProvider.getCurrentTime();
Project project = task.getProject();
ProjectProfile projectProfile = buildProfile.getProjectProfile(project.getPath());
TaskExecution taskExecution = projectProfile.getTaskProfile(task.getPath());
taskExecution.setFinish(now);
taskExecution.completed(state);
}
示例4: isSatisfiedBy
import org.gradle.api.Task; //导入方法依赖的package包/类
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;
}
示例5: graphPopulated
import org.gradle.api.Task; //导入方法依赖的package包/类
@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();
}
}
}
示例6: beforeExecute
import org.gradle.api.Task; //导入方法依赖的package包/类
public void beforeExecute(Task task) {
long now = timeProvider.getCurrentTime();
Project project = task.getProject();
ProjectProfile projectProfile = buildProfile.getProjectProfile(project.getPath());
projectProfile.getTaskProfile(task.getPath()).setStart(now);
}
示例7: 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));
}