Example #1
0
 private void createBinaryLifecycleTask(SourceSet sourceSet, Project target) {
   Task binaryLifecycleTask = target.task(sourceSet.getClassesTaskName());
   binaryLifecycleTask.setGroup(LifecycleBasePlugin.BUILD_GROUP);
   binaryLifecycleTask.setDescription(String.format("Assembles %s.", sourceSet));
   binaryLifecycleTask.dependsOn(sourceSet.getOutput().getDirs());
   binaryLifecycleTask.dependsOn(sourceSet.getCompileJavaTaskName());
   binaryLifecycleTask.dependsOn(sourceSet.getProcessResourcesTaskName());
 }
Example #2
0
 private void attachTasksToBinary(
     ClassDirectoryBinarySpecInternal binary, SourceSet sourceSet, Project target) {
   Task compileTask = target.getTasks().getByPath(sourceSet.getCompileJavaTaskName());
   Task resourcesTask = target.getTasks().getByPath(sourceSet.getProcessResourcesTaskName());
   Task classesTask = target.getTasks().getByPath(sourceSet.getClassesTaskName());
   binary.getTasks().add(compileTask);
   binary.getTasks().add(resourcesTask);
   binary.getTasks().add(classesTask);
   binary.setBuildTask(classesTask);
 }
Example #3
0
 private void createProcessResourcesTaskForBinary(
     final SourceSet sourceSet, JvmResourceSet resourceSet, final Project target) {
   Copy resourcesTask =
       target.getTasks().create(sourceSet.getProcessResourcesTaskName(), ProcessResources.class);
   resourcesTask.setDescription(String.format("Processes %s.", resourceSet));
   new DslObject(resourcesTask)
       .getConventionMapping()
       .map(
           "destinationDir",
           new Callable<File>() {
             public File call() throws Exception {
               return sourceSet.getOutput().getResourcesDir();
             }
           });
   resourcesTask.from(resourceSet.getSource());
 }