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

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

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

Test.getCandidateClassFiles介绍

暂无

代码示例

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

/**
 * Returns the test class files.
 *
 * <p>This is the special case we need to handle - if getCandidateClassFiles is called
 * too early, i.e. before the task is fully configured, return an empty FileTree. The
 * default is to create a FileTree using getTestClassesDir(), but that creates a
 * FileTree with a null root, which fails later on.
 *
 * @see ConfigAction#configureSources(AndroidUnitTest)
 */
@Override
public FileTree getCandidateClassFiles() {
  if (getTestClassesDir() == null) {
    return getProject().files().getAsFileTree();
  } else {
    return super.getCandidateClassFiles();
  }
}

代码示例来源:origin: gradle.plugin.de.monkeyworks.buildmonkey/gradle.pde

private List<String> collectTestNames(Test testTask) {
  ClassNameCollectingProcessor processor = new ClassNameCollectingProcessor();
  Runnable detector;
  final FileTree testClassFiles = testTask.getCandidateClassFiles();
  if (testTask.isScanForTestClasses()) {
    TestFrameworkDetector testFrameworkDetector = testTask.getTestFramework().getDetector();
    testFrameworkDetector.setTestClassesDirectory(testTask.getTestClassesDir());
    testFrameworkDetector.setTestClasspath(testTask.getClasspath());
    detector = new PluginTestClassScanner(testClassFiles, processor);
  } else {
    detector = new PluginTestClassScanner(testClassFiles, processor);
  }
  final Object testTaskOperationId = OperationIdGenerator.generateId(testTask);
  new TestMainAction(detector, processor, new NoOpTestResultProcessor(), new TrueTimeProvider(), testTaskOperationId, testTask.getPath(), String.format("Gradle Eclipse Test Run %s", testTask.getPath())).run();
  LOGGER.info("collected test class names: {}", processor.classNames);
  return processor.classNames;
}

相关文章