Пример #1
0
 // build tasks without project reference
 private List<LaunchableGradleTask> tasks(Project project) {
   List<LaunchableGradleTask> tasks = Lists.newArrayList();
   for (Task task : taskLister.listProjectTasks(project)) {
     tasks.add(buildFromTask(new LaunchableGradleTask(), task));
   }
   return tasks;
 }
Пример #2
0
  private void findTasks(
      Project project,
      Map<String, LaunchableGradleTaskSelector> taskSelectors,
      Collection<String> visibleTasks) {
    for (Project child : project.getChildProjects().values()) {
      findTasks(child, taskSelectors, visibleTasks);
    }

    for (Task task : taskLister.listProjectTasks(project)) {
      // in the map, store a minimally populated LaunchableGradleTaskSelector that contains just the
      // description and the path
      // replace the LaunchableGradleTaskSelector stored in the map iff we come across a task with
      // the same name whose path has a smaller ordering
      // this way, for each task selector, its description will be the one from the selected task
      // with the 'smallest' path
      if (!taskSelectors.containsKey(task.getName())) {
        LaunchableGradleTaskSelector taskSelector =
            new LaunchableGradleTaskSelector()
                .setDescription(task.getDescription())
                .setPath(task.getPath());
        taskSelectors.put(task.getName(), taskSelector);
      } else {
        LaunchableGradleTaskSelector taskSelector = taskSelectors.get(task.getName());
        if (hasPathWithLowerOrdering(task, taskSelector)) {
          taskSelector.setDescription(task.getDescription()).setPath(task.getPath());
        }
      }

      // visible tasks are specified as those that have a non-empty group
      if (PublicTaskSpecification.INSTANCE.isSatisfiedBy(task)) {
        visibleTasks.add(task.getName());
      }
    }
  }