From 0b2cde39b61e9a2504ed01f86bbee8cdfadf52c3 Mon Sep 17 00:00:00 2001 From: Rene Groeschke Date: Tue, 4 Mar 2025 09:54:52 +0100 Subject: [PATCH] [IDEA] Enable Gradle Configuration Cache for Gradle Test Runner (#123552) (#123624) * [IDEA] Enable Gradle Configuration Cache for Gradle Runner This should speedup repetitives usages of the Gradle Runner for the majority of test executions We added a flag to disable it explicitly if it does not work for certain scenarios --- .../src/main/groovy/elasticsearch.build-scan.gradle | 3 +++ .../src/main/groovy/elasticsearch.ide.gradle | 7 ++++++- gradle.properties | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/build-tools-internal/src/main/groovy/elasticsearch.build-scan.gradle b/build-tools-internal/src/main/groovy/elasticsearch.build-scan.gradle index 8702f5a9bf0e..4113e1c1c9d2 100644 --- a/build-tools-internal/src/main/groovy/elasticsearch.build-scan.gradle +++ b/build-tools-internal/src/main/groovy/elasticsearch.build-scan.gradle @@ -133,6 +133,9 @@ develocity { } } else { tag 'LOCAL' + if (providers.systemProperty('idea.active').present) { + tag 'IDEA' + } } } } diff --git a/build-tools-internal/src/main/groovy/elasticsearch.ide.gradle b/build-tools-internal/src/main/groovy/elasticsearch.ide.gradle index 323b4cc30d94..d33975a0a388 100644 --- a/build-tools-internal/src/main/groovy/elasticsearch.ide.gradle +++ b/build-tools-internal/src/main/groovy/elasticsearch.ide.gradle @@ -144,7 +144,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() idea { project { vcs = 'Git' @@ -171,6 +171,11 @@ if (providers.systemProperty('idea.active').getOrNull() == 'true') { } } runConfigurations { + defaults(org.jetbrains.gradle.ext.Gradle) { + scriptParameters = enableIdeaCC ? [ + '--configuration-cache' + ].join(' ') : '' + } defaults(JUnit) { vmParameters = [ '-ea', diff --git a/gradle.properties b/gradle.properties index aa38a61ab005..7c781d859cea 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,3 +19,6 @@ org.gradle.dependency.verification.console=verbose # allow user to specify toolchain via the RUNTIME_JAVA_HOME environment variable org.gradle.java.installations.fromEnv=RUNTIME_JAVA_HOME + +# if configuration cache enabled then enable parallel support too +org.gradle.configuration-cache.parallel=true