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())); })); }
@Override void configure(Task task) { super.configure(task); Task prepareMonitorEnvTask = project.getTasks().findByName(AzurePlugin.PREPARE_MONITOR_ENV_TASK); Test t = (Test)task; t.setDescription("Test execution of the azureTest source set against production deployment."); t.dependsOn(prepareMonitorEnvTask); t.setClasspath(sourceSet.getRuntimeClasspath()); t.setTestClassesDirs(sourceSet.getOutput().getClassesDirs()); t.systemProperty("testEnvPath", azure.getMonitorEnvFile().get().getAsFile().getAbsolutePath()); t.setBinResultsDir(new File(project.getBuildDir(), "monitor-test-results/binary/test")); t.getReports().getHtml().setDestination(new File(project.getBuildDir(), "reports/monitor-test-results" )); t.getReports().getJunitXml().setDestination(new File(project.getBuildDir(), "monitor-test-results" )); } }
@Override public void apply( Project project ) { project.getTasks().withType( Test.class ).configureEach( task -> { task.useJUnitPlatform(); task.testLogging( log -> log.info( info -> info.getEvents().add( TestLogEvent.PASSED ) ) ); task.reports( reports -> { reports.getJunitXml().setEnabled( true ); reports.getHtml().setEnabled( false ); } ); } ); } }
@Override public void apply( Project project ) { project.getPluginManager().apply( JavaLibraryPlugin.class ); DependencyHandler deps = project.getDependencies(); deps.add( TEST_IMPL, String.join( D, Junit.G, Junit.Api.A ) ); deps.add( TEST_IMPL, String.join( D, Junit.G, Junit.Param.A ) ); deps.add( TEST_RUN, String.join( D, Junit.G, Junit.Engine.A ) ); deps.add( TEST_IMPL, String.join( D, AssertJ.G, AssertJ.A ) ); project.getTasks().withType( Test.class ).configureEach( task -> { task.useJUnitPlatform(); task.testLogging( log -> log.info( info -> info.getEvents().add( TestLogEvent.PASSED ) ) ); task.reports( reports -> { reports.getJunitXml().setEnabled( true ); reports.getHtml().setEnabled( false ); } ); } ); } }
@Override public void apply( Project project ) { project.getPluginManager().apply( JavaLibraryPlugin.class ); DependencyHandler deps = project.getDependencies(); deps.add( TEST_IMPL, String.join( D, Junit.G, Junit.Api.A ) ); deps.add( TEST_IMPL, String.join( D, Junit.G, Junit.Param.A ) ); deps.add( TEST_RUN, String.join( D, Junit.G, Junit.Engine.A ) ); deps.add( TEST_IMPL, String.join( D, AssertJ.G, AssertJ.A ) ); project.getTasks().withType( Test.class ).configureEach( task -> { task.useJUnitPlatform(); task.testLogging( log -> log.info( info -> info.getEvents().add( TestLogEvent.PASSED ) ) ); task.reports( reports -> { reports.getJunitXml().setEnabled( true ); reports.getHtml().setEnabled( false ); } ); } ); project.getTasks().withType( JavaCompile.class ).configureEach( task -> { CompileOptions options = task.getOptions(); options.setAnnotationProcessorGeneratedSourcesDirectory( Paths.get( "build/generated/src" ).toFile() ); options.getCompilerArgs().addAll( Arrays.asList( "-parameters", "-Xlint:deprecation" ) ); } ); } }
runTestsTask.getName())); ConfigurableReport htmlReport = testTaskReports.getHtml(); htmlReport.setDestination( new File(
testTaskReports.getJunitXml(), testTaskReports.getHtml()}) { report.setDestination(new File(report.getDestination(), testedVariantData.getName()));