本文整理了Java中org.gradle.api.tasks.testing.Test.getExtensions()
方法的一些代码示例,展示了Test.getExtensions()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Test.getExtensions()
方法的具体详情如下:
包路径:org.gradle.api.tasks.testing.Test
类名称:Test
方法名:getExtensions
暂无
代码示例来源:origin: com.tngtech.jgiven/jgiven-gradle-plugin
@Override
public File call() {
return test.getExtensions().getByType( JGivenTaskExtension.class ).getResultsDir();
}
} );
代码示例来源:origin: org.sonarsource.scanner.gradle/sonarqube-gradle-plugin
private static void configureJaCoCoCoverageReport(final Test testTask, final boolean addForGroovy, Project project, final Map<String, Object> properties) {
project.getPlugins().withType(JacocoPlugin.class, jacocoPlugin -> {
JacocoTaskExtension jacocoTaskExtension = testTask.getExtensions().getByType(JacocoTaskExtension.class);
File destinationFile = jacocoTaskExtension.getDestinationFile();
if (destinationFile.exists()) {
properties.put("sonar.jacoco.reportPath", destinationFile);
appendProp(properties, "sonar.jacoco.reportPaths", destinationFile);
if (addForGroovy) {
properties.put("sonar.groovy.jacoco.reportPath", destinationFile);
}
}
});
}
代码示例来源:origin: SonarSource/sonar-scanner-gradle
private static void configureJaCoCoCoverageReport(final Test testTask, final boolean addForGroovy, Project project, final Map<String, Object> properties) {
project.getPlugins().withType(JacocoPlugin.class, jacocoPlugin -> {
JacocoTaskExtension jacocoTaskExtension = testTask.getExtensions().getByType(JacocoTaskExtension.class);
File destinationFile = jacocoTaskExtension.getDestinationFile();
if (destinationFile.exists()) {
properties.put("sonar.jacoco.reportPath", destinationFile);
appendProp(properties, "sonar.jacoco.reportPaths", destinationFile);
if (addForGroovy) {
properties.put("sonar.groovy.jacoco.reportPath", destinationFile);
}
}
});
}
代码示例来源:origin: gradle.plugin.org.javamodularity/moduleplugin
testJava.getExtensions().create("moduleOptions", TestModuleOptions.class, project);
TestModuleOptions testModuleOptions = testJava.getExtensions().getByType(TestModuleOptions.class);
if (testModuleOptions.isRunOnClasspath()) {
LOGGER.lifecycle("Running tests on classpath");
代码示例来源:origin: steffenschaefer/gwt-gradle-plugin
@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);
}});
}
});
代码示例来源:origin: com.tngtech.jgiven/jgiven-gradle-plugin
private void applyTo( Test test ) {
final String testName = test.getName();
final JGivenTaskExtension extension = test.getExtensions().create( "jgiven", JGivenTaskExtension.class );
final Project project = test.getProject();
( (IConventionAware) extension ).getConventionMapping().map( "resultsDir", new Callable<File>() {
@Override
public File call() {
return project.file( String.valueOf( project.getBuildDir() ) + "/jgiven-results/" + testName );
}
} );
File resultsDir = extension.getResultsDir();
if( resultsDir != null ) {
test.getOutputs().dir(resultsDir).withPropertyName("jgiven.resultsDir");
}
test.prependParallelSafeAction( new Action<Task>() {
@Override
public void execute( Task task ) {
Test test = (Test) task;
test.systemProperty( Config.JGIVEN_REPORT_DIR, extension.getResultsDir().getAbsolutePath() );
}
} );
}
内容来源于网络,如有侵权,请联系作者删除!