|
@@ -99,12 +99,14 @@ class BuildPlugin implements Plugin<Project> {
|
|
|
configureSourcesJar(project)
|
|
|
configurePomGeneration(project)
|
|
|
|
|
|
+ applyCommonTestConfig(project)
|
|
|
configureTest(project)
|
|
|
configurePrecommit(project)
|
|
|
configureDependenciesInfo(project)
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
/** Performs checks on the build environment and prints information about the build environment. */
|
|
|
static void globalBuildInfo(Project project) {
|
|
|
if (project.rootProject.ext.has('buildChecksDone') == false) {
|
|
@@ -776,9 +778,8 @@ class BuildPlugin implements Plugin<Project> {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /** Returns a closure of common configuration shared by unit and integration tests. */
|
|
|
- static Closure commonTestConfig(Project project) {
|
|
|
- return {
|
|
|
+ static void applyCommonTestConfig(Project project) {
|
|
|
+ project.tasks.withType(RandomizedTestingTask) {
|
|
|
jvm "${project.runtimeJavaHome}/bin/java"
|
|
|
parallelism System.getProperty('tests.jvms', 'auto')
|
|
|
ifNoTests System.getProperty('tests.ifNoTests', 'fail')
|
|
@@ -873,6 +874,8 @@ class BuildPlugin implements Plugin<Project> {
|
|
|
|
|
|
exclude '**/*$*.class'
|
|
|
|
|
|
+ dependsOn(project.tasks.testClasses)
|
|
|
+
|
|
|
project.plugins.withType(ShadowPlugin).whenPluginAdded {
|
|
|
// Test against a shadow jar if we made one
|
|
|
classpath -= project.tasks.compileJava.outputs.files
|
|
@@ -884,23 +887,9 @@ class BuildPlugin implements Plugin<Project> {
|
|
|
|
|
|
/** Configures the test task */
|
|
|
static Task configureTest(Project project) {
|
|
|
- RandomizedTestingTask test = project.tasks.getByName('test')
|
|
|
- test.configure(commonTestConfig(project))
|
|
|
- test.configure {
|
|
|
+ project.tasks.getByName('test') {
|
|
|
include '**/*Tests.class'
|
|
|
}
|
|
|
-
|
|
|
- // Add a method to create additional unit tests for a project, which will share the same
|
|
|
- // randomized testing setup, but by default run no tests.
|
|
|
- project.extensions.add('additionalTest', { String name, Closure config ->
|
|
|
- RandomizedTestingTask additionalTest = project.tasks.create(name, RandomizedTestingTask.class)
|
|
|
- additionalTest.classpath = test.classpath
|
|
|
- additionalTest.testClassesDirs = test.testClassesDirs
|
|
|
- additionalTest.configure(commonTestConfig(project))
|
|
|
- additionalTest.configure(config)
|
|
|
- additionalTest.dependsOn(project.tasks.testClasses)
|
|
|
- project.check.dependsOn(additionalTest)
|
|
|
- });
|
|
|
}
|
|
|
|
|
|
private static configurePrecommit(Project project) {
|