You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2025/06/16 16:30:31 UTC

(lucene) branch main updated: Add logical test option groups for the allOptions task. (#14795)

This is an automated email from the ASF dual-hosted git repository.

dweiss pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/main by this push:
     new f83587416ec Add logical test option groups for the allOptions task. (#14795)
f83587416ec is described below

commit f83587416ecaa7b5fb201dd3938fd06e2af95aba
Author: Dawid Weiss <da...@carrotsearch.com>
AuthorDate: Mon Jun 16 18:30:26 2025 +0200

    Add logical test option groups for the allOptions task. (#14795)
---
 .../groovy/lucene.all-projects.conventions.gradle  |  3 +
 .../build-infra/src/main/groovy/lucene.help.gradle |  3 +-
 .../plugins/help/BuildOptionGroupsPlugin.java      | 76 ++++++++++++++++++++++
 help/localSettings.txt                             |  8 +--
 4 files changed, 85 insertions(+), 5 deletions(-)

diff --git a/build-tools/build-infra/src/main/groovy/lucene.all-projects.conventions.gradle b/build-tools/build-infra/src/main/groovy/lucene.all-projects.conventions.gradle
index 4a7f915da6f..eb360661650 100644
--- a/build-tools/build-infra/src/main/groovy/lucene.all-projects.conventions.gradle
+++ b/build-tools/build-infra/src/main/groovy/lucene.all-projects.conventions.gradle
@@ -25,6 +25,9 @@ allprojects {project ->
   // All projects have the base plugin (convention tasks like 'check', etc.)
   apply plugin: 'base'
 
+  // Configure build option groups.
+  project.plugins.apply(org.apache.lucene.gradle.plugins.help.BuildOptionGroupsPlugin)
+
   // Project group and version.
   group = "org.apache.lucene"
   version = rootProject.version
diff --git a/build-tools/build-infra/src/main/groovy/lucene.help.gradle b/build-tools/build-infra/src/main/groovy/lucene.help.gradle
index b93fe908728..ff35c4b5b55 100644
--- a/build-tools/build-infra/src/main/groovy/lucene.help.gradle
+++ b/build-tools/build-infra/src/main/groovy/lucene.help.gradle
@@ -108,7 +108,8 @@ tasks.named("help").configure {
     }
 
     println ""
-    println "For the impatient, build the project with 'gradlew assemble', run all tests with 'gradlew check'."
+    println "For the impatient, build the project with 'gradlew assemble', run all tests with 'gradlew check', check " +
+        "your current build options with 'gradlew allOptions'."
     throw new StopExecutionException()
   }
 }
diff --git a/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/plugins/help/BuildOptionGroupsPlugin.java b/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/plugins/help/BuildOptionGroupsPlugin.java
new file mode 100644
index 00000000000..78d488c501e
--- /dev/null
+++ b/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/plugins/help/BuildOptionGroupsPlugin.java
@@ -0,0 +1,76 @@
+package org.apache.lucene.gradle.plugins.help;
+
+import com.carrotsearch.gradle.buildinfra.buildoptions.BuildOptionsTask;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import org.gradle.api.Plugin;
+import org.gradle.api.Project;
+
+/** Group related Lucene build options into higher level categories. */
+public class BuildOptionGroupsPlugin implements Plugin<Project> {
+  @Override
+  public void apply(Project project) {
+    project
+        .getTasks()
+        .withType(BuildOptionsTask.class)
+        .configureEach(
+            task -> {
+              task.optionGroups(
+                  optionGroups -> {
+                    optionGroups.group("Lucene version strings", "version\\.(.*)");
+
+                    optionGroups.group("IDE-tweaking options", "eclipse\\.(.+)");
+
+                    optionGroups.group(
+                        "Optional testing and test resources",
+                        explicitList(
+                            "tests.hunspell.regressions",
+                            "validation.errorprone",
+                            "hunspell.corpora",
+                            "hunspell.dictionaries",
+                            "hunspell.repo.path",
+                            "validation.owasp",
+                            "validation.owasp.apikey",
+                            "validation.owasp.threshold"));
+
+                    optionGroups.group("Test profiling", "tests\\.profile\\.(.*)");
+
+                    optionGroups.group(
+                        "Test repetition control",
+                        explicitList("tests.iters", "tests.dups", "tests.failfast"));
+
+                    optionGroups.group(
+                        "Test randomization and all test-related options", "tests\\.(.*)");
+
+                    optionGroups.group(
+                        "Local tool paths",
+                        "(lucene\\.tool\\.(.*))|" + explicitList("runtime.java.home"));
+
+                    optionGroups.group(
+                        "Options configuring the :lucene:benchmark:run task",
+                        explicitList("maxHeapSize", "standardOutput", "taskAlg"));
+
+                    optionGroups.group(
+                        "Options useful for release managers",
+                        explicitList("lucene.javadoc.url", "sign", "useGpg"));
+
+                    optionGroups.group(
+                        "Build control and information",
+                        explicitList(
+                            "task.times",
+                            "javac.failOnWarnings",
+                            "tests.slowestSuites",
+                            "tests.slowestSuites.minTime",
+                            "tests.slowestTests",
+                            "tests.slowestTests.minTime"));
+                  });
+            });
+  }
+
+  private static String explicitList(String... explicitOptions) {
+    return Stream.of(explicitOptions)
+        .map(opt -> "(" + Pattern.quote(opt) + ")")
+        .collect(Collectors.joining("|"));
+  }
+}
diff --git a/help/localSettings.txt b/help/localSettings.txt
index c8a33f965c6..50089c81c1f 100644
--- a/help/localSettings.txt
+++ b/help/localSettings.txt
@@ -17,14 +17,14 @@ coverage or profiling).
 
 To see the current values of all these options, run:
 
-./gradlew buildOptions
+./gradlew allOptions
 
-this prints all build options for each module. You can also scope
-this task to just one module, for example:
+this prints all build options for all modules. You can print all options
+for a single module too, for example:
 
 ./gradlew -p lucene/core buildOptions
 
-The output of this task shows all options, their current values
+The output of both tasks shows the options, their current values
 and their current value's "source". All build option values can be
 overridden by, in order of priority: