private void _addTasksExpandSoyCompileDependencies(
      TranspileJSTask transpileJSTask, Configuration configuration) {

    Project project = transpileJSTask.getProject();

    RenameDependencyClosure renameDependencyClosure =
        new RenameDependencyClosure(project, configuration.getName());

    for (File file : configuration) {
      Copy copy =
          _addTaskExpandCompileDependency(
              project,
              file,
              project.getBuildDir(),
              "expandSoyCompileDependency",
              renameDependencyClosure);

      transpileJSTask.dependsOn(copy);

      String path = FileUtil.getAbsolutePath(copy.getDestinationDir());

      path += "/META-INF/resources/**/*.soy";

      transpileJSTask.soyDependency(path);
    }
  }
  private DefaultGradleProject<LaunchableGradleTask> buildHierarchy(Project project) {
    List<DefaultGradleProject<LaunchableGradleTask>> children =
        new ArrayList<DefaultGradleProject<LaunchableGradleTask>>();
    for (Project child : project.getChildProjects().values()) {
      children.add(buildHierarchy(child));
    }

    DefaultGradleProject<LaunchableGradleTask> gradleProject =
        new DefaultGradleProject<LaunchableGradleTask>()
            .setPath(project.getPath())
            .setName(project.getName())
            .setDescription(project.getDescription())
            .setBuildDirectory(project.getBuildDir())
            .setProjectDirectory(project.getProjectDir())
            .setChildren(children);

    gradleProject.getBuildScript().setSourceFile(project.getBuildFile());
    gradleProject.setTasks(tasks(gradleProject, (TaskContainerInternal) project.getTasks()));

    for (DefaultGradleProject child : children) {
      child.setParent(gradleProject);
    }

    return gradleProject;
  }
  protected <T extends AbstractArchiveTask> T addTaskDistBundle(
      final Project project,
      String taskName,
      Class<T> clazz,
      final Configuration bundleConfiguration,
      WorkspaceExtension workspaceExtension) {

    T task = GradleUtil.addTask(project, taskName, clazz);

    configureTaskCopyBundle(task, bundleConfiguration);

    task.from(
        project.file("configs/common"),
        project.file("configs/" + workspaceExtension.getEnvironment()));

    task.setBaseName(project.getName());
    task.setDescription("Assembles the bundle and zips it up.");
    task.setDestinationDir(project.getBuildDir());
    task.setIncludeEmptyDirs(false);

    return task;
  }
    @Finalize
    public void createTestTasks(final TaskContainer tasks, BinaryContainer binaries) {
      for (NativeTestSuiteBinarySpec testBinary :
          binaries.withType(NativeTestSuiteBinarySpec.class)) {
        NativeBinarySpecInternal binary = (NativeBinarySpecInternal) testBinary;
        final BinaryNamingScheme namingScheme = binary.getNamingScheme();

        RunTestExecutable runTask =
            tasks.create(namingScheme.getTaskName("run"), RunTestExecutable.class);
        final Project project = runTask.getProject();
        runTask.setDescription(String.format("Runs the %s", binary));

        final InstallExecutable installTask =
            binary.getTasks().withType(InstallExecutable.class).iterator().next();
        runTask.getInputs().files(installTask.getOutputs().getFiles());
        runTask.setExecutable(installTask.getRunScript().getPath());
        runTask.setOutputDir(
            new File(
                project.getBuildDir(), "/test-results/" + namingScheme.getOutputDirectoryBase()));

        testBinary.getTasks().add(runTask);
      }
    }
 protected File getUnzippedJarDir(Project project) {
   return new File(project.getBuildDir(), "unzipped-jar");
 }