Skip to content

Apache Lucene open-source search software

LUCENE-10255: add support for .tests subprojects which contain module tests.

Dawid Weiss328b3cc55feb
diff --git a/gradle/documentation/render-javadoc.gradle b/gradle/documentation/render-javadoc.gradle
index 50093a6e4e5..b84f6030c0a 100644
--- a/gradle/documentation/render-javadoc.gradle
+++ b/gradle/documentation/render-javadoc.gradle
@@ -57,7 +57,9 @@ allprojects {
outputDir = project.javadoc.destinationDir
}
- if (project.path != ':lucene:luke') {
+ if (project.path == ':lucene:luke' || project.path.endsWith(".tests")) {
+ // Do nothing, these projects are not part of the public API.
+ } else {
task renderSiteJavadoc(type: RenderJavadocTask) {
description "Generates Javadoc API documentation for the site (relative links)."
group "documentation"
diff --git a/gradle/maven/publications.gradle b/gradle/maven/publications.gradle
index f4a48009743..cc9bc9682d0 100644
--- a/gradle/maven/publications.gradle
+++ b/gradle/maven/publications.gradle
@@ -31,7 +31,7 @@
configure(rootProject) {
ext {
mavenProjects = project(":lucene").subprojects.findAll {subproject ->
- return !(subproject.path in [
+ def excluded = [
// Exclude distribution assembly, tests & documentation.
":lucene:distribution",
":lucene:documentation",
@@ -39,7 +39,11 @@ configure(rootProject) {
":lucene:analysis",
// Exclude the native module.
":lucene:misc:native"
- ])
+ ]
+
+ // Exclude all subprojects that are modular test projects and those explicitly
+ // excluded above.
+ return !(subproject.path.endsWith(".tests") || subproject.path in excluded)
}
}
}
diff --git a/gradle/testing/randomization.gradle b/gradle/testing/randomization.gradle
index fc6c991875d..eb540f5dd70 100644
--- a/gradle/testing/randomization.gradle
+++ b/gradle/testing/randomization.gradle
@@ -164,7 +164,9 @@ allprojects {
// Enable security manager, if requested. We could move the selection of security manager and security policy
// to each project's build/ configuration but it seems compact enough to keep it here for now.
if (Boolean.parseBoolean(testOptionsResolved["tests.useSecurityManager"])) {
- if (project.path == ":lucene:replicator") {
+ if (project.path == ":lucene:distribution-tests" || project.path.endsWith(".tests")) {
+ // LUCENE-10301: for now, do not use the security manager for modular tests (test framework is not available).
+ } else if (project.path == ":lucene:replicator") {
systemProperty 'java.security.manager', "org.apache.lucene.util.TestSecurityManager"
systemProperty 'java.security.policy', file("${resources}/policies/replicator-tests.policy")
} else if (project.path.startsWith(":lucene")) {
diff --git a/gradle/validation/ecj-lint.gradle b/gradle/validation/ecj-lint.gradle
index 278986d79ed..a2947303f6b 100644
--- a/gradle/validation/ecj-lint.gradle
+++ b/gradle/validation/ecj-lint.gradle
@@ -31,6 +31,11 @@ def resources = scriptResources(buildscript)
allprojects {
plugins.withType(JavaPlugin) {
+ // For now, turn off ECJ linting of module test projects.
+ if (project.path.endsWith(".tests")) {
+ return
+ }
+
// Create a [sourceSetName]EcjLint task for each source set
// with a non-empty java.srcDirs. These tasks are then
// attached to project's "ecjLint" task.