org.gradle.api.tasks.testing.Test.getInputs()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(120)

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

Test.getInputs介绍

暂无

代码示例

代码示例来源:origin: com.amazon.device.tools.build/gradle-core

private static void fixTestTaskSources(@NonNull Test testTask) {
  // We are running in afterEvaluate, so the JavaBasePlugin has already added a
  // callback to add test classes to the list of source files of the newly created task.
  // The problem is that we haven't configured the test classes yet (JavaBasePlugin
  // assumes all Test tasks are fully configured at this point), so we have to remove the
  // "directory null" entry from source files and add the right value.
  //
  // This is an ugly hack, since we assume sourceFiles is an instance of
  // DefaultConfigurableFileCollection.
  ((DefaultConfigurableFileCollection) testTask.getInputs().getSourceFiles()).getFrom().clear();
}

代码示例来源:origin: gradle.plugin.org.gradle.java/experimental-jigsaw

private void configureTestTask(final Project project) {
  final Test testTask = (Test) project.getTasks().findByName(JavaPlugin.TEST_TASK_NAME);
  final SourceSet test = ((SourceSetContainer) project.getProperties().get("sourceSets")).getByName("test");
  final JavaModule module = (JavaModule) project.getExtensions().getByName(EXTENSION_NAME);
  testTask.getInputs().property("moduleName", module.geName());
  testTask.doFirst(new Action<Task>() {
    @Override
    public void execute(Task task) {
      List<String> args = new ArrayList<>();
      args.add("--module-path");
      args.add(testTask.getClasspath().getAsPath());
      args.add("--add-modules");
      args.add("ALL-MODULE-PATH");
      args.add("--add-reads");
      args.add(module.geName() + "=junit");
      args.add("--patch-module");
      args.add(module.geName() + "=" + test.getJava().getOutputDir());
      testTask.setJvmArgs(args);
      testTask.setClasspath(project.files());
    }
  });
}

相关文章