private void configurePluginsForArtifacts(Project project) { String circleArtifactsDir = System.getenv("CIRCLE_ARTIFACTS"); if (circleArtifactsDir == null) { project.getLogger().info("$CIRCLE_ARTIFACTS variable is not set, not configuring junit/profiling reports"); return; } try { Files.createDirectories(Paths.get(circleArtifactsDir), PERMS_ATTRIBUTE); } catch (IOException e) { throw new RuntimeException("failed to create CIRCLE_ARTIFACTS directory", e); } project.getRootProject().allprojects(proj -> proj.getTasks().withType(Test.class, test -> { test.getReports().getHtml().setEnabled(true); test.getReports().getHtml().setDestination(junitPath(circleArtifactsDir, test.getPath())); })); }
proj.getTasks().withType(Test.class, test -> { test.getReports().getJunitXml().setEnabled(true); test.getReports().getJunitXml().setDestination(junitPath(circleReportsDir, test.getPath())); }); proj.getTasks().withType(Checkstyle.class, checkstyle ->
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; }