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);
  }
Exemple #2
0
  private File _getResourcesDir(Project project) {
    SourceSet sourceSet = GradleUtil.getSourceSet(project, SourceSet.MAIN_SOURCE_SET_NAME);

    return _getSrcDir(sourceSet.getResources());
  }