org.gradle.api.Task.finalizedBy()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(332)

本文整理了Java中org.gradle.api.Task.finalizedBy()方法的一些代码示例,展示了Task.finalizedBy()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Task.finalizedBy()方法的具体详情如下:
包路径:org.gradle.api.Task
类名称:Task
方法名:finalizedBy

Task.finalizedBy介绍

暂无

代码示例

代码示例来源:origin: gradle.plugin.org.shipkit/shipkit

public void execute(final Task t) {
    t.setDescription("Cleans up the working copy, useful after dry running the release");
    //using finalizedBy so that all clean up tasks run, even if one of them fails
    t.finalizedBy(GitPlugin.PERFORM_GIT_COMMIT_CLEANUP_TASK);
    t.finalizedBy(GitPlugin.TAG_CLEANUP_TASK);
  }
});

代码示例来源:origin: gradle.plugin.com.intershop.gradle.plugin.azure/azurePlugin

@Override
  void configure(Task task)
  {
    super.configure(task);

    Task cleanupTestEnvTask = project.getTasks().findByName(AzurePlugin.CLEANUP_TEST_ENV_TASK);

    Task createTestRGTask = project.getTasks().findByName(AzurePlugin.CREATE_TEST_RG_TASK);

    Task uploadTestTemplateTask = project.getTasks().findByPath(AzurePlugin.UPLOAD_TEST_TEMPLATE_TASK);

    task.setDescription("Ensures the deletion of all test resources after azureTest was called");

    task.finalizedBy(cleanupTestEnvTask);

    createTestRGTask.mustRunAfter(task);

    uploadTestTemplateTask.mustRunAfter(task);
  }
}

代码示例来源:origin: gradle.plugin.com.intershop.gradle.plugin.azure/azurePlugin

@Override
  void configure(Task task)
  {
    super.configure(task);

    Task deleteTestBlobDirTask = project.getTasks().findByName(AzurePlugin.DELETE_TEST_BLOB_DIR);

    Task deleteTestRGTask = project.getTasks().findByName(AzurePlugin.DELETE_TEST_RG_TASK);

    Task cleanTask = project.getTasks().findByName("clean");

    task.setDescription("Cleanup after a test run");

    task.finalizedBy(deleteTestBlobDirTask, deleteTestRGTask);

    if(cleanTask != null) cleanTask.dependsOn(task);

    task.doLast(new Action() {
      @Override public void execute(Object o)
      {
        File file = azure.getTestEnvFile().get().getAsFile();

        if (file.exists())
        {
          file.delete();
        }
      }
    });
  }
}

代码示例来源:origin: gradle.plugin.com.xiaoquan.gradle.plugin/support-plugin

project.getTasks().getByName(JavaPlugin.CLASSES_TASK_NAME).finalizedBy(jibxBind);
jibxBind.getOutputs().upToDateWhen(element -> false);

代码示例来源:origin: gradle.plugin.org.hibernate.build/database-profile-plugin

profileTestTask.finalizedBy( testTask );
profileResourcesTask.getInputs().property( "profileName", name );
profileResourcesTask.dependsOn( resourcesTask );
profileResourcesTask.finalizedBy( applyTask );
profileResourcesTask.doFirst(
    task -> {

代码示例来源:origin: palantir/gradle-baseline

public static void registerFinalizer(
    Task task,
    TaskTimer timer,
    FailuresSupplier failuresSupplier,
    Path reportDir) {
  CircleStyleFinalizer finalizer = Tasks.createTask(
      task.getProject().getTasks(),
      task.getName() + "CircleFinalizer",
      CircleStyleFinalizer.class);
  if (finalizer == null) {
    // Already registered (happens if the user applies us to the root project and subprojects)
    return;
  }
  finalizer.setStyleTask(task);
  finalizer.setTaskTimer(timer);
  finalizer.setFailuresSupplier(failuresSupplier);
  finalizer.setTargetFile(
      reportDir.resolve(task.getProject().getName() + "-" + task.getName() + ".xml").toFile());
  finalizer.setReportDir(reportDir);
  task.finalizedBy(finalizer);
}

代码示例来源:origin: com.palantir.baseline/gradle-circle-style

public static void registerFinalizer(
    Task task,
    TaskTimer timer,
    FailuresSupplier failuresSupplier,
    Path reportDir) {
  CircleStyleFinalizer finalizer = Tasks.createTask(
      task.getProject().getTasks(),
      task.getName() + "CircleFinalizer",
      CircleStyleFinalizer.class);
  if (finalizer == null) {
    // Already registered (happens if the user applies us to the root project and subprojects)
    return;
  }
  finalizer.setStyleTask(task);
  finalizer.setTaskTimer(timer);
  finalizer.setFailuresSupplier(failuresSupplier);
  finalizer.setTargetFile(
      reportDir.resolve(task.getProject().getName() + "-" + task.getName() + ".xml").toFile());
  finalizer.setReportDir(reportDir);
  task.finalizedBy(finalizer);
}

代码示例来源:origin: gradle.plugin.com.sedmelluq/jdaction

@Override
protected void configureForSourceSet(SourceSet sourceSet, NoActionVerificationTask task) {
 task.setSource(sourceSet.getAllJava());
 ConventionMapping taskMapping = task.getConventionMapping();
 taskMapping.map("classes", new Callable<FileCollection>() {
  @Override
  public FileCollection call() {
   return project.fileTree(sourceSet.getOutput().getClassesDir()).builtBy(sourceSet.getOutput());
  }
 });
 for (Task classesTask : project.getTasksByName(sourceSet.getClassesTaskName(), false)) {
  classesTask.finalizedBy(task.getPath());
 }
}

代码示例来源:origin: palantir/gradle-circle-style

public static void registerFinalizer(
    Task task,
    StyleTaskTimer timer,
    FailuresSupplier failuresSupplier,
    File reportDir) {
  CircleStyleFinalizer finalizer = Tasks.createTask(
      task.getProject().getTasks(),
      task.getName() + "CircleFinalizer",
      CircleStyleFinalizer.class);
  if (finalizer == null) {
    // Already registered (happens if the user applies us to the root project and subprojects)
    return;
  }
  finalizer.setStyleTask(task);
  finalizer.setStyleTaskTimer(timer);
  finalizer.setFailuresSupplier(failuresSupplier);
  finalizer.setTargetFile(new File(reportDir, task.getProject().getName() + "-" + task.getName() + ".xml"));
  task.finalizedBy(finalizer);
}

代码示例来源:origin: gradle.plugin.org.openstreetmap.josm/gradle-josm-plugin

task.getLogger().lifecycle("Distribution *.jar (version {}) has ben written into {}", task.getProject().getVersion(), outDir.getAbsolutePath());
});
pro.getTasks().getByName("jar").finalizedBy(dist, localDist);

代码示例来源:origin: io.freefair.gradle/war-plugin

private void configureOverlay(WarOverlay overlay, ExternalDependency dependency) {
  War warTask = overlay.getWarTask();
  String capitalizedWarTaskName = StringGroovyMethods.capitalize((CharSequence) warTask.getName());
  String capitalizedOverlayName = StringGroovyMethods.capitalize((CharSequence) overlay.getName());
  dependency.setTransitive(false);
  Configuration configuration = project.getConfigurations().create(overlay.getConfigurationName());
  configuration.setDescription(String.format("Contents of the overlay '%s' for the task '%s'.", overlay.getName(), warTask.getName()));
  configuration.getDependencies().add(dependency);
  File destinationDir = new File(project.getBuildDir(), String.format("overlays/%s/%s", warTask.getName(), overlay.getName()));
  Action<CopySpec> extractOverlay = copySpec -> {
    copySpec.into(destinationDir);
    copySpec.from((Callable<FileTree>) () -> project.zipTree(configuration.getSingleFile()));
  };
  Sync extractOverlayTask = project.getTasks().create(String.format("extract%s%sOverlay", capitalizedOverlayName, capitalizedWarTaskName), Sync.class, extractOverlay);
  overlay.getWarCopySpec().from(extractOverlayTask);
  if (overlay.isEnableCompilation()) {
    if (!destinationDir.exists() || isEmpty(destinationDir)) {
      project.sync(extractOverlay);
    }
    project.getTasks().getByName(CLEAN_TASK_NAME).finalizedBy(extractOverlayTask);
    ConfigurableFileCollection classes = project.files(new File(destinationDir, "WEB-INF/classes"))
        .builtBy(extractOverlayTask);
    project.getDependencies().add(COMPILE_CLASSPATH_CONFIGURATION_NAME, classes);
    project.getDependencies().add(TEST_COMPILE_CLASSPATH_CONFIGURATION_NAME, classes);
    FileTree libs = project.files(extractOverlayTask).builtBy(extractOverlayTask).getAsFileTree()
        .matching(patternFilterable -> patternFilterable.include("WEB-INF/lib/**"));
    project.getDependencies().add(COMPILE_CLASSPATH_CONFIGURATION_NAME, libs);
    project.getDependencies().add(TEST_COMPILE_CLASSPATH_CONFIGURATION_NAME, libs);
  }
}

代码示例来源:origin: mockito/shipkit

t.finalizedBy(GitPlugin.PERFORM_GIT_COMMIT_CLEANUP_TASK);
  t.finalizedBy(GitPlugin.TAG_CLEANUP_TASK);
});

代码示例来源:origin: org.shipkit/shipkit

t.finalizedBy(GitPlugin.PERFORM_GIT_COMMIT_CLEANUP_TASK);
  t.finalizedBy(GitPlugin.TAG_CLEANUP_TASK);
});

代码示例来源:origin: gradle.plugin.org.mockito/release

task.finalizedBy(postStep);

代码示例来源:origin: gradle.plugin.com.github.anolivetree/gradle-clojure-plugin

variant.getJavaCompiler().finalizedBy(compile);
 variant.registerPostJavacGeneratedBytecode(compile.getOutputs().getFiles());
});

相关文章