/** * Finds or creates dropwizard task * * @param name task suffix * @return existing or created task, null if existing task has other type */ public DropwizardExec command(String name) { String taskName = taskName(prefix, name); Task task = tasks.findByPath(taskName); if (task == null) { return tasks.create(taskName, DropwizardExec.class); } if (task instanceof DropwizardExec) { return (DropwizardExec) task; } return null; }
private Set<String> getAssembleDependencies(Project project, String taskName) { Task task = project.getTasks().findByPath(taskName); return task.getDependsOn() .stream() .filter(t -> t instanceof Task) .map(t -> (Task) t) .filter(t -> t.getName().equals(BasePlugin.ASSEMBLE_TASK_NAME)) .map(Task::getPath) .collect(Collectors.toSet()); }
if (project.getTasks().findByPath("classes") != null) { task.dependsOn("classes"); if (project.getTasks().findByPath("compileJava") != null) { task.dependsOn("compileJava"); if (project.getTasks().findByPath("compileTestJava") != null) { task.dependsOn("compileTestJava"); if (project.getTasks().findByPath("testClasses") != null) { task.dependsOn("testClasses");
@Override void configure(Task task) { super.configure(task); Task cleanupTestEnvTask = project.getTasks().findByName(AzurePlugin.CLEANUP_TEST_ENV_TASK); Task createTestRGTask = project.getTasks().findByName(AzurePlugin.CREATE_TEST_RG_TASK); Task uploadTestTemplateTask = project.getTasks().findByPath(AzurePlugin.UPLOAD_TEST_TEMPLATE_TASK); task.setDescription("Ensures the deletion of all test resources after azureTest was called"); task.finalizedBy(cleanupTestEnvTask); createTestRGTask.mustRunAfter(task); uploadTestTemplateTask.mustRunAfter(task); } }
/** * Returns the appengine service directory for this project and modifies the task dependencies of * run/start to ensure {@code serviceProject} is built first. */ public File projectAsService(Project serviceProject) { if (!serviceProject.equals(project)) { project.evaluationDependsOn(serviceProject.getPath()); } project .getTasks() .findByName(AppEngineStandardPlugin.RUN_TASK_NAME) .dependsOn(serviceProject.getTasks().findByPath(BasePlugin.ASSEMBLE_TASK_NAME)); project .getTasks() .findByName(AppEngineStandardPlugin.START_TASK_NAME) .dependsOn(serviceProject.getTasks().findByPath(BasePlugin.ASSEMBLE_TASK_NAME)); return serviceProject .getTasks() .findByName(AppEngineStandardPlugin.EXPLODE_WAR_TASK_NAME) .getOutputs() .getFiles() .getSingleFile(); }