/** * Configures the {@link Test} task to produces a shorter output when executing tests. * * @param project * the {@link Project} that the {@link Plugin} is applied to */ private void configureTestTask(Project project) { Test test = (Test) project.getTasks().getByName("test"); TestLoggingContainer testLogging = test.getTestLogging(); testLogging.events("failed", "passed"); testLogging.setExceptionFormat(TestExceptionFormat.FULL); testLogging.setShowStackTraces(false); }
@Override public void execute(final Test testTask) { testTask.getTestLogging().setShowStandardStreams(true); final GwtTestExtension testExtension = testTask.getExtensions().create("gwt", GwtTestExtension.class); testExtension.configure(gwtPluginExtension, (IConventionAware) testExtension); project.afterEvaluate(new Action<Project>() { @Override public void execute(Project t) { String gwtArgs = testExtension.getParameterString(); testTask.systemProperty("gwt.args", gwtArgs); logger.info("Using gwt.args for test: "+ gwtArgs); if (testExtension.getCacheDir() != null) { testTask.systemProperty("gwt.persistentunitcachedir", testExtension.getCacheDir()); testExtension.getCacheDir().mkdirs(); logger.info("Using gwt.persistentunitcachedir for test: {0}", testExtension.getCacheDir()); } } }); project.getPlugins().withType(GwtWarPlugin.class, new Action<GwtWarPlugin>() { @Override public void execute(GwtWarPlugin t) { testTask.dependsOn(GwtWarPlugin.TASK_WAR_TEMPLATE); }}); } });
@Override public void apply(Project project) { project.getPluginManager().apply(JavaPlugin.class); JavaPluginConvention javaPluginConv = project.getConvention().findPlugin(JavaPluginConvention.class); javaPluginConv.setSourceCompatibility(JavaVersion.VERSION_1_8); javaPluginConv.setTargetCompatibility(JavaVersion.VERSION_1_8); project.getPluginManager().apply(IdeaPlugin.class); project.getRepositories().mavenCentral(); project.getDependencies().add("testCompile", "junit:junit:4.12"); Wrapper wrapper = project.getTasks().create("wrapper", Wrapper.class); wrapper.setGradleVersion("3.5"); Test test = (Test) project.getTasks().getByName("test"); TestLoggingContainer testLogging = test.getTestLogging(); testLogging.events("failed", "passed"); testLogging.setExceptionFormat(TestExceptionFormat.FULL); testLogging.setShowStackTraces(false); } }