Ejemplo n.º 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());
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 3
0
 private void createCompileJavaTaskForBinary(
     final SourceSet sourceSet, final JavaSourceSet javaSourceSet, Project target) {
   JavaCompile compileTask =
       target.getTasks().create(sourceSet.getCompileJavaTaskName(), JavaCompile.class);
   compileTask.setDescription(String.format("Compiles %s.", javaSourceSet));
   compileTask.setSource(javaSourceSet.getSource());
   compileTask.dependsOn(javaSourceSet);
   ConventionMapping conventionMapping = compileTask.getConventionMapping();
   conventionMapping.map(
       "classpath",
       new Callable<Object>() {
         public Object call() throws Exception {
           return javaSourceSet.getCompileClasspath().getFiles();
         }
       });
   conventionMapping.map(
       "destinationDir",
       new Callable<Object>() {
         public Object call() throws Exception {
           return sourceSet.getOutput().getClassesDir();
         }
       });
 }