org.gradle.api.invocation.Gradle.buildFinished()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(481)

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

Gradle.buildFinished介绍

暂无

代码示例

代码示例来源:origin: alipay/sofa-boot

private void unregisterUnresolvedDependenciesAnalyzer(Project project) {
  UnresolvedDependenciesAnalyzer unresolvedDependenciesAnalyzer = new UnresolvedDependenciesAnalyzer();
  project.getConfigurations().all((configuration) -> {
    ResolvableDependencies incoming = configuration.getIncoming();
    incoming.afterResolve((resolvableDependencies) -> {
      if (incoming.equals(resolvableDependencies)) {
        unresolvedDependenciesAnalyzer.analyze(configuration
            .getResolvedConfiguration().getLenientConfiguration()
            .getUnresolvedModuleDependencies());
      }
    });
  });
  project.getGradle().buildFinished(
      (buildResult) -> unresolvedDependenciesAnalyzer.buildFinished(project));
}

代码示例来源:origin: BolexLiu/AutoEx

@Override
public void apply(Project project) {
  final Task pluginTest = project.task("autoExTest");
  pluginTest.setGroup("autoEx");
  pluginTest.doLast(new Action<Task>() {
    @Override
    public void execute(Task task) {
      System.out.println("Test测试");
      DoHandleService.search("Test测试",5);
    }
  });
  project.getGradle().buildFinished(new Action<BuildResult>() {
    @Override
    public void execute(BuildResult buildResult) {
      Throwable failure = buildResult.getFailure();
      if (failure != null) {
        DoHandleService.search(failure.getCause().getCause().getMessage(),5);
      } else {
        System.out.println("没有异常,这很棒!");
      }
    }
  });
}

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

private void configureBuildFailureFinalizer(Project rootProject, String circleReportsDir) {
  int attemptNumber = 1;
  File targetFile = new File(new File(circleReportsDir, "gradle"), "build.xml");
  while (targetFile.exists()) {
    targetFile = new File(new File(circleReportsDir, "gradle"), "build" + (++attemptNumber) + ".xml");
  }
  Integer container;
  try {
    container = Integer.parseInt(System.getenv("CIRCLE_NODE_INDEX"));
  } catch (NumberFormatException e) {
    container = null;
  }
  CircleBuildFailureListener listener = new CircleBuildFailureListener();
  CircleBuildFinishedAction action = new CircleBuildFinishedAction(container, targetFile, listener);
  rootProject.getGradle().addListener(listener);
  rootProject.getGradle().buildFinished(action);
}

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

private static void configureBuildFailureFinalizer(Project rootProject, String circleReportsDir) {
    int attemptNumber = 1;
    File targetFile = new File(new File(circleReportsDir, "gradle"), "build.xml");
    while (targetFile.exists()) {
      targetFile = new File(new File(circleReportsDir, "gradle"), "build" + (++attemptNumber) + ".xml");
    }
    Integer container;
    try {
      container = Integer.parseInt(System.getenv("CIRCLE_NODE_INDEX"));
    } catch (NumberFormatException e) {
      container = null;
    }
    CircleBuildFailureListener listener = new CircleBuildFailureListener();
    CircleBuildFinishedAction action = new CircleBuildFinishedAction(container, targetFile, listener);
    rootProject.getGradle().addListener(listener);
    rootProject.getGradle().buildFinished(action);
  }
}

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

private static void configureBuildFailureFinalizer(Project rootProject, String circleReportsDir) {
    int attemptNumber = 1;
    Path targetFile = Paths.get(circleReportsDir, "gradle", "build.xml");
    while (targetFile.toFile().exists()) {
      targetFile = Paths.get(circleReportsDir, "gradle", "build" + (++attemptNumber) + ".xml");
    }
    Integer container;
    try {
      container = Integer.parseInt(System.getenv("CIRCLE_NODE_INDEX"));
    } catch (NumberFormatException e) {
      container = null;
    }
    CircleBuildFailureListener listener = new CircleBuildFailureListener();
    CircleBuildFinishedAction action = new CircleBuildFinishedAction(container, targetFile, listener);
    rootProject.getGradle().addListener(listener);
    rootProject.getGradle().buildFinished(action);
  }
}

代码示例来源:origin: gradle.plugin.com.github.honourednihilist/gradle-postgresql-embedded

@Override
public void apply(Project project) {
  project.getExtensions().create(PostgresqlEmbeddedExtension.NAME, PostgresqlEmbeddedExtension.class);
  StartPostgresTask startTask = project.getTasks().create(StartPostgresTask.NAME, StartPostgresTask.class);
  project.afterEvaluate(pro -> {
    PostgresqlEmbeddedExtension extension = pro.getExtensions().getByType(PostgresqlEmbeddedExtension.class);
    EmbeddedPostgres postgres = new EmbeddedPostgres(parseVersion(extension.getVersion()),
        extension.getHost(),
        extension.getPort(),
        extension.getDbName(),
        extension.getUsername(),
        extension.getPassword(),
        extension.getArtifactStorePath());
    startTask.setPostgres(postgres);
    if (extension.isStopWhenBuildFinished()) {
      project.getGradle().buildFinished(buildResult -> startTask.stop());
    }
  });
}

相关文章