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 void _configureTaskTranspileJSForJavaPlugin(TranspileJSTask transpileJSTask) {

    transpileJSTask.mustRunAfter(JavaPlugin.PROCESS_RESOURCES_TASK_NAME);

    Project project = transpileJSTask.getProject();

    final SourceSet sourceSet = GradleUtil.getSourceSet(project, SourceSet.MAIN_SOURCE_SET_NAME);

    transpileJSTask.setSourceDir(
        new Callable<File>() {

          @Override
          public File call() throws Exception {
            File resourcesDir = _getSrcDir(sourceSet.getResources());

            return new File(resourcesDir, "META-INF/resources");
          }
        });

    transpileJSTask.setWorkingDir(
        new Callable<File>() {

          @Override
          public File call() throws Exception {
            SourceSetOutput sourceSetOutput = sourceSet.getOutput();

            return new File(sourceSetOutput.getResourcesDir(), "META-INF/resources");
          }
        });

    Task classesTask = GradleUtil.getTask(project, JavaPlugin.CLASSES_TASK_NAME);

    classesTask.dependsOn(transpileJSTask);
  }
  private void _addTasksExpandJSCompileDependencies(
      TranspileJSTask transpileJSTask, NpmInstallTask npmInstallTask, Configuration configuration) {

    Project project = transpileJSTask.getProject();

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

    for (File file : configuration) {
      Copy copy =
          _addTaskExpandCompileDependency(
              project,
              file,
              npmInstallTask.getNodeModulesDir(),
              "expandJSCompileDependency",
              renameDependencyClosure);

      transpileJSTask.dependsOn(copy);
    }
  }