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

epugh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr-mcp.git


The following commit(s) were added to refs/heads/main by this push:
     new 1dc533bf build: upgrade Gradle wrapper to 9.8.2 and enable build cache 
(#278)
1dc533bf is described below

commit 1dc533bf744e38aa28a730ee10a1e4e3acdf04c8
Author: Aditya Parikh <[email protected]>
AuthorDate: Mon Oct 26 15:11:52 2026 -0400

    build: upgrade Gradle wrapper to 9.8.2 and enable build cache (#278)
    
    * build: upgrade Gradle wrapper to 9.8.2
    
    Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
    Signed-off-by: adityamparikh <[email protected]>
    
    * build: add gradle.properties with build cache and UTF-8 encoding
    
    Enable org.gradle.caching and set -Dfile.encoding=UTF-8 in
    org.gradle.jvmargs per Gradle best practices.
    
    Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
    Signed-off-by: adityamparikh <[email protected]>
    
    * build: enable configuration cache and apply Gradle best practices
    
    Findings from the gradle-best-practices audit of this build:
    
    - use_configuration_cache: set org.gradle.configuration-cache=true. The
      `docker info` probe now goes through providers.exec instead of
      ProcessBuilder, and the JaCoCo class-directory filter no longer calls
      the eager FileCollection.files.
    - do_not_use_internal_apis: pick the Jib docker executable from the
      os.name system property instead of org.gradle.internal.os.OperatingSystem.
    - set_up_repositories_in_settings: declare repositories in
      dependencyResolutionManagement (root settings, and a new buildSrc
      settings file) rather than in each build script.
    - dont_hardcode_task_names: reference unitTest and bootBuildImage through
      their providers / typed accessors instead of string names.
    
    Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
    Signed-off-by: Aditya Parikh <[email protected]>
    
    ---------
    
    Signed-off-by: adityamparikh <[email protected]>
    Signed-off-by: Aditya Parikh <[email protected]>
    Co-authored-by: Claude Sonnet 5.5 <[email protected]>
---
 build.gradle.kts                                   |  85 ++++++++++-----------
 buildSrc/build.gradle.kts                          |   6 --
 .../settings.gradle.kts                            |   9 ++-
 gradle.properties                                  |  20 +++++
 gradle/wrapper/gradle-wrapper.jar                  | Bin 47623 -> 48749 bytes
 gradle/wrapper/gradle-wrapper.properties           |   3 +-
 settings.gradle.kts                                |   9 +++
 7 files changed, 80 insertions(+), 52 deletions(-)

diff --git a/build.gradle.kts b/build.gradle.kts
index e812e01f..a9ab9a75 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -166,10 +166,6 @@ configurations {
     }
 }
 
-repositories {
-    mavenCentral()
-}
-
 dependencies {
 
     developmentOnly(libs.bundles.spring.boot.dev)
@@ -272,24 +268,25 @@ tasks.withType<Test> {
     }
 }
 
-tasks.register<Test>("unitTest") {
-    description = "Runs unit tests only (no Testcontainers)"
-    group = "verification"
+val unitTest =
+    tasks.register<Test>("unitTest") {
+        description = "Runs unit tests only (no Testcontainers)"
+        group = "verification"
 
-    useJUnitPlatform {
-        excludeTags("integration", "docker-integration")
-    }
+        useJUnitPlatform {
+            excludeTags("integration", "docker-integration")
+        }
 
-    testClassesDirs = sourceSets["test"].output.classesDirs
-    classpath = sourceSets["test"].runtimeClasspath
+        testClassesDirs = sourceSets["test"].output.classesDirs
+        classpath = sourceSets["test"].runtimeClasspath
 
-    finalizedBy(tasks.jacocoTestReport)
+        finalizedBy(tasks.jacocoTestReport)
 
-    reports {
-        html.outputLocation.set(layout.buildDirectory.dir("reports/unitTest"))
-        
junitXml.outputLocation.set(layout.buildDirectory.dir("test-results/unitTest"))
+        reports {
+            
html.outputLocation.set(layout.buildDirectory.dir("reports/unitTest"))
+            
junitXml.outputLocation.set(layout.buildDirectory.dir("test-results/unitTest"))
+        }
     }
-}
 
 tasks.register<Test>("integrationTest") {
     description = "Runs Testcontainers-based integration tests"
@@ -302,7 +299,7 @@ tasks.register<Test>("integrationTest") {
     testClassesDirs = sourceSets["test"].output.classesDirs
     classpath = sourceSets["test"].runtimeClasspath
 
-    mustRunAfter(tasks.named("unitTest"))
+    mustRunAfter(unitTest)
     finalizedBy(tasks.jacocoTestReport)
 
     reports {
@@ -320,16 +317,14 @@ tasks.jacocoTestReport {
     }
     // Exclude docker integration tests from coverage
     classDirectories.setFrom(
-        files(
-            classDirectories.files.map {
-                fileTree(it) {
-                    exclude(
-                        "**/DockerImageStdioIntegrationTest*.class",
-                        "**/DockerImageHttpIntegrationTest*.class",
-                    )
-                }
-            },
-        ),
+        sourceSets.main.map {
+            it.output.classesDirs.asFileTree.matching {
+                exclude(
+                    "**/DockerImageStdioIntegrationTest*.class",
+                    "**/DockerImageHttpIntegrationTest*.class",
+                )
+            }
+        },
     )
 }
 
@@ -441,10 +436,17 @@ tasks.register<Test>("dockerIntegrationTest") {
     // Always run this task, don't use Gradle's up-to-date checking
     outputs.upToDateWhen { false }
 
+    // providers.exec (not ProcessBuilder) so the configuration cache tracks 
the probe
+    // as a build input; a missing docker binary makes it throw, which also 
means "unavailable".
     val dockerAvailable =
         try {
-            val process = ProcessBuilder("docker", "info").start()
-            process.waitFor() == 0
+            providers
+                .exec {
+                    commandLine("docker", "info")
+                    isIgnoreExitValue = true
+                }.result
+                .get()
+                .exitValue == 0
         } catch (e: Exception) {
             false
         }
@@ -459,7 +461,7 @@ tasks.register<Test>("dockerIntegrationTest") {
 
     if (dockerAvailable) {
         if (nativeBuild) {
-            dependsOn(tasks.named("bootBuildImage"))
+            dependsOn(tasks.bootBuildImage)
         } else {
             dependsOn(tasks.jibDockerBuild)
         }
@@ -528,18 +530,13 @@ tasks.register<Test>("dockerIntegrationTest") {
 jib {
     dockerClient {
         executable = System.getenv("DOCKER_EXECUTABLE")
-            ?: when {
-                org.gradle.internal.os.OperatingSystem
-                    .current()
-                    .isMacOsX -> "/usr/local/bin/docker"
-                org.gradle.internal.os.OperatingSystem
-                    .current()
-                    .isLinux -> "/usr/bin/docker"
-                org.gradle.internal.os.OperatingSystem
-                    .current()
-                    .isWindows ->
-                    "C:\\Program 
Files\\Docker\\Docker\\resources\\bin\\docker.exe"
-                else -> "docker"
+            ?: System.getProperty("os.name").lowercase().let { os ->
+                when {
+                    "mac" in os -> "/usr/local/bin/docker"
+                    "linux" in os -> "/usr/bin/docker"
+                    "windows" in os -> "C:\\Program 
Files\\Docker\\Docker\\resources\\bin\\docker.exe"
+                    else -> "docker"
+                }
             }
     }
     from {
@@ -582,7 +579,7 @@ jib {
     }
 }
 
-tasks.named<org.springframework.boot.gradle.tasks.bundling.BootBuildImage>("bootBuildImage")
 {
+tasks.bootBuildImage {
     if (nativeBuild) {
         imageName.set("solr-mcp:$version-native-$nativeProfile")
         tags.set(listOf("solr-mcp:latest-native-$nativeProfile"))
diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts
index db7ed79e..216606f1 100644
--- a/buildSrc/build.gradle.kts
+++ b/buildSrc/build.gradle.kts
@@ -22,12 +22,6 @@ plugins {
     `kotlin-dsl`
 }
 
-repositories {
-    mavenCentral()
-    // Hosts the Apache RAT plugin marker below — it is not published to Maven 
Central.
-    gradlePluginPortal()
-}
-
 dependencies {
     // Makes the Apache RAT plugin (id `org.nosphere.apache.rat`) available to 
the
     // `org.apache.solr.mcp.rat` convention plugin's `plugins {}` block. The 
version lives
diff --git a/settings.gradle.kts b/buildSrc/settings.gradle.kts
similarity index 73%
copy from settings.gradle.kts
copy to buildSrc/settings.gradle.kts
index 8373d947..39f745d3 100644
--- a/settings.gradle.kts
+++ b/buildSrc/settings.gradle.kts
@@ -15,4 +15,11 @@
  * limitations under the License.
  */
 
-rootProject.name = "solr-mcp"
+// buildSrc is a separate build with its own settings, so it declares its own 
repositories.
+// gradlePluginPortal() hosts the Apache RAT plugin marker (not published to 
Maven Central).
+dependencyResolutionManagement {
+    repositories {
+        mavenCentral()
+        gradlePluginPortal()
+    }
+}
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 00000000..d560db76
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+org.gradle.jvmargs=-Xmx2g -Dfile.encoding=UTF-8
+org.gradle.caching=true
+org.gradle.configuration-cache=true
diff --git a/gradle/wrapper/gradle-wrapper.jar 
b/gradle/wrapper/gradle-wrapper.jar
index 5097068a..9fa7f288 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and 
b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties 
b/gradle/wrapper/gradle-wrapper.properties
index ad83d906..a93f60a3 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,7 @@
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-9.8.0-bin.zip
+distributionSha256Sum=21bd5da2de49b642904077f38c0efdc7778e92b3ed0889392dca61b97e389607
+distributionUrl=https\://services.gradle.org/distributions/gradle-9.8.2-bin.zip
 networkTimeout=10000
 retries=3
 retryBackOffMs=500
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 8373d947..2c219b3b 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -16,3 +16,12 @@
  */
 
 rootProject.name = "solr-mcp"
+
+// Repositories are declared once here (not per project) so every project 
resolves
+// dependencies from the same place. See
+// 
https://docs.gradle.org/current/userguide/best_practices_dependencies.html#set_up_repositories_in_settings
+dependencyResolutionManagement {
+    repositories {
+        mavenCentral()
+    }
+}

Reply via email to