本文整理汇总了Java中org.gradle.api.Task.getName方法的典型用法代码示例。如果您正苦于以下问题:Java Task.getName方法的具体用法?Java Task.getName怎么用?Java Task.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.gradle.api.Task
的用法示例。
在下文中一共展示了Task.getName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findTask
import org.gradle.api.Task; //导入方法依赖的package包/类
public static <T extends Task> List<T> findTask(Project project, Class<T> clazz, BaseVariantData vod) {
Task[] androidTasks = project.getTasks().withType(clazz).toArray(new Task[0]);
String variantName = vod.getName();
List<Task> taskList = new ArrayList();
for (Task task : androidTasks) {
if (task instanceof DefaultAndroidTask) {
if (variantName.equals(((DefaultAndroidTask)task).getVariantName())) {
taskList.add(task);
}
} else {
String name = task.getName();
if (name.toLowerCase().contains(variantName)) {
taskList.add(task);
}
}
}
return (List<T>)taskList;
}
示例2: findTask
import org.gradle.api.Task; //导入方法依赖的package包/类
protected List<Task> findTask(Class<Task> clazz, String variantName) {
Task[] androidTasks = project.getTasks().withType(clazz).toArray(new Task[0]);
List<Task> taskList = new ArrayList();
for (Task task : androidTasks) {
if (task.getName().endsWith("TestJavaWithJavac")){
continue;
}
if (task instanceof DefaultAndroidTask) {
if (variantName.equals(((DefaultAndroidTask)task).getVariantName())) {
taskList.add(task);
}
} else {
String name = task.getName();
if (name.toLowerCase().contains(variantName)) {
taskList.add(task);
}
}
}
return taskList;
}
示例3: addTasks
import org.gradle.api.Task; //导入方法依赖的package包/类
/**
* Adds the tasks from the project to the GradleProject.
*
* @param project the source parent project. Where we get the sub projects from.
* @param projectView the destination of the tasks from project.
*/
private void addTasks(Project project, ProjectView projectView) {
List<String> defaultTasks = project.getDefaultTasks();
for (Task task : taskLister.listProjectTasks(project)) {
String taskName = task.getName();
boolean isDefault = defaultTasks.contains(taskName);
projectView.createTask(taskName, task.getDescription(), isDefault);
}
}
示例4: create
import org.gradle.api.Task; //导入方法依赖的package包/类
public Task create(Map<String, ?> options) {
Map<String, Object> mutableOptions = new HashMap<String, Object>(options);
Object replaceStr = mutableOptions.remove(Task.TASK_OVERWRITE);
boolean replace = replaceStr != null && "true".equals(replaceStr.toString());
Task task = taskFactory.createTask(mutableOptions);
String name = task.getName();
if (placeholders.remove(name)) {
modelNode.removeLink(name);
}
Task existing = findByNameWithoutRules(name);
if (existing != null) {
if (replace) {
remove(existing);
} else {
throw new InvalidUserDataException(String.format(
"Cannot add %s as a task with that name already exists.", task));
}
}
add(task);
return task;
}
示例5: beforeExecute
import org.gradle.api.Task; //导入方法依赖的package包/类
public void beforeExecute(Task task) {
String currentTaskName = task.getProject().getName() + ":" + task.getName();
client.sendMessage(ProtocolConstants.TASK_STARTED_TYPE, currentTaskName, new Float(percentComplete));
}
示例6: afterExecute
import org.gradle.api.Task; //导入方法依赖的package包/类
public void afterExecute(Task task, TaskState state) {
totalTasksExecuted++;
percentComplete = (totalTasksExecuted / totalTasksToExecute) * 100;
String currentTaskName = task.getProject().getName() + ":" + task.getName();
client.sendMessage(ProtocolConstants.TASK_COMPLETE_TYPE, currentTaskName, new Float(percentComplete));
}