Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 41 additions & 44 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,6 @@ configurations {
}
}

repositories {
mavenCentral()
}

dependencies {

developmentOnly(libs.bundles.spring.boot.dev)
Expand Down Expand Up @@ -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"
Expand All @@ -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 {
Expand All @@ -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",
)
}
},
)
}

Expand Down Expand Up @@ -448,10 +443,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
}
Expand All @@ -466,7 +468,7 @@ tasks.register<Test>("dockerIntegrationTest") {

if (dockerAvailable) {
if (nativeBuild) {
dependsOn(tasks.named("bootBuildImage"))
dependsOn(tasks.bootBuildImage)
} else {
dependsOn(tasks.jibDockerBuild)
}
Expand Down Expand Up @@ -535,18 +537,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 {
Expand Down Expand Up @@ -589,7 +586,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"))
Expand Down
6 changes: 0 additions & 6 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 25 additions & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* 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.
*/

// 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()
}
}
20 changes: 20 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 9 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
Loading