From 996c99bd04cd838d797654241ffe952aa4391ad0 Mon Sep 17 00:00:00 2001 From: Luke Whiting Date: Wed, 18 Jun 2025 11:20:36 +0100 Subject: [PATCH] Add new option to allow full delegation of IntelliJ tests to Gradle (#126772) * Add new option to allow full delegation of tests to gradle in IntelliJ plus docs * Update CONTRIBUTING.md Co-authored-by: Rene Groeschke * Update CONTRIBUTING.md Fix typo in settings file name in docs --------- Co-authored-by: Rene Groeschke --- CONTRIBUTING.md | 12 ++++++++++++ .../src/main/groovy/elasticsearch.ide.gradle | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 06d241a87e3d..326b35af4d19 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -203,6 +203,18 @@ Alternative manual steps for IntelliJ. 3. Navigate to the file `build-conventions/formatterConfig.xml` 4. Click "OK" +#### Options + +When importing to IntelliJ, we offer a few options that can be used to +configure the behaviour of the import: + +| Property | Description | Values (* = default) | +|--------------------------------------------|------------------------------------------------------------------------------------------------------|----------------------| +| `org.elasticsearch.idea-configuration-cache` | Should IntelliJ enable the Gradle Configuration cache to speed up builds when generating run configs | *`true`, `false` | +| `org.elasticsearch.idea-delegate-to-gradle` | Should IntelliJ use Gradle for all generated run / test configs or prompt each time | `true`, *`false` | + +These options can be set anywhere on the Gradle config path including in `~/.gradle/gradle.properties` + ### REST endpoint conventions Elasticsearch typically uses singular nouns rather than plurals in URLs. diff --git a/build-tools-internal/src/main/groovy/elasticsearch.ide.gradle b/build-tools-internal/src/main/groovy/elasticsearch.ide.gradle index 5ed55ab0d5a0..665f4f8b276b 100644 --- a/build-tools-internal/src/main/groovy/elasticsearch.ide.gradle +++ b/build-tools-internal/src/main/groovy/elasticsearch.ide.gradle @@ -180,6 +180,7 @@ if (providers.systemProperty('idea.active').getOrNull() == 'true') { // this path is produced by the extractLibs task above String testLibraryPath = TestUtil.getTestLibraryPath("${elasticsearchProject.left()}/libs/native/libraries/build/platform") def enableIdeaCC = providers.gradleProperty("org.elasticsearch.idea-configuration-cache").getOrElse("true").toBoolean() + def delegateToGradle = providers.gradleProperty("org.elasticsearch.idea-delegate-to-gradle").getOrElse("false").toBoolean() idea { project { vcs = 'Git' @@ -188,7 +189,7 @@ if (providers.systemProperty('idea.active').getOrNull() == 'true') { settings { delegateActions { delegateBuildRunToGradle = false - testRunner = 'choose_per_test' + testRunner = delegateToGradle ? 'gradle' : 'choose_per_test' } taskTriggers { afterSync tasks.named('configureIdeCheckstyle'),