Skip to content
Draft
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
6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ subprojects {
}


task delombok(type: io.franzbecker.gradle.lombok.task.DelombokTask) {
// gradle-lombok's DelombokTask relies on JavaExec.main, which was removed in Gradle 9
task delombok(type: JavaExec) {
mainClass = 'lombok.launch.Main'
classpath = configurations.compileClasspath
args 'delombok'
outputs.cacheIf {
true
}
Expand Down
2 changes: 1 addition & 1 deletion core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sourceSets {

test.maxParallelForks = 4

idea.module.testSourceDirs += sourceSets.jarFileTest.allSource.srcDirs
idea.module.testSources.from(sourceSets.jarFileTest.allSource.srcDirs)

jar {
manifest {
Expand Down
20 changes: 10 additions & 10 deletions examples/spring-boot-kotlin-redis/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
id("org.springframework.boot") version "2.7.18"
kotlin("jvm") version "1.8.22"
kotlin("plugin.spring") version "1.8.22"
id("org.springframework.boot") version "3.5.16"
kotlin("jvm") version "2.4.21"
kotlin("plugin.spring") version "2.4.21"
}

java.sourceCompatibility = JavaVersion.VERSION_1_8
java.sourceCompatibility = JavaVersion.VERSION_17

repositories {
mavenCentral()
Expand All @@ -21,13 +21,13 @@ dependencies {

testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.testcontainers:testcontainers")
testRuntimeOnly("org.junit.platform:junit-platform-launcher:1.8.2")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}

tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "1.8"
kotlin {
compilerOptions {
freeCompilerArgs.add("-Xjsr305=strict")
jvmTarget = JvmTarget.JVM_17
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ abstract class AbstractIntegrationTest {
redisContainer.start()

TestPropertyValues.of(
"spring.redis.host=${redisContainer.host}",
"spring.redis.port=${redisContainer.firstMappedPort}"
"spring.data.redis.host=${redisContainer.host}",
"spring.data.redis.port=${redisContainer.firstMappedPort}"
).applyTo(configurableApplicationContext.environment)
}
}
Expand Down
4 changes: 2 additions & 2 deletions examples/spring-boot/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'java'
id 'org.springframework.boot' version '2.7.18'
id 'org.springframework.boot' version '3.5.16'
}
apply plugin: 'io.spring.dependency-management'

Expand All @@ -17,7 +17,7 @@ dependencies {
runtimeOnly 'org.postgresql:postgresql'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.testcontainers:testcontainers-postgresql'
testRuntimeOnly "org.junit.platform:junit-platform-launcher:1.8.2"
testRuntimeOnly "org.junit.platform:junit-platform-launcher"
}

test {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package com.example;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import lombok.Data;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

@Data
@Entity
public class DemoEntity {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ abstract class AbstractIntegrationTest {
@DynamicPropertySource
static void redisProperties(DynamicPropertyRegistry registry) {
redis.start();
registry.add("spring.redis.host", redis::getHost);
registry.add("spring.redis.port", redis::getFirstMappedPort);
registry.add("spring.data.redis.host", redis::getHost);
registry.add("spring.data.redis.port", redis::getFirstMappedPort);
}
}
4 changes: 4 additions & 0 deletions gradle/ci-support.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ gradle.taskGraph.whenReady {
for (subproject in subprojects) {
subproject.tasks.withType(Test).all {
testExecuter([execute: { spec, processor -> }, stopNow:{}] as org.gradle.api.internal.tasks.testing.TestExecuter)
// Gradle 9+ fails test tasks that discover no tests, which is always the case with the no-op executer above
if (GradleVersion.current() >= GradleVersion.version("9.0")) {
failOnNoDiscoveredTests = false
}
}
subproject.tasks.findByName("shadowJar")?.enabled = false
subproject.tasks.findByName("javadoc")?.enabled = false
Expand Down
2 changes: 1 addition & 1 deletion gradle/japicmp.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ tasks.japicmp {

// Disable if baseline dependencies cannot be resolved - such as when developing a new module that doesn't
// have an existing published version.
enabled = ! configurations.baseline.copy().resolvedConfiguration.lenientConfiguration.getFiles().empty
enabled = ! configurations.baseline.copy().incoming.artifactView { lenient = true }.files.empty

oldClasspath.from(configurations.baseline)
newClasspath.from(shadowJar.outputs.files)
Expand Down
2 changes: 1 addition & 1 deletion gradle/publishing.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ publishing {

def dependenciesNode = rootNode.appendNode('dependencies')

def apiDeps= project.configurations.api.resolvedConfiguration.firstLevelModuleDependencies
def apiDeps= project.configurations.resolvableApi.resolvedConfiguration.firstLevelModuleDependencies
def providedDeps = project.configurations.provided.resolvedConfiguration.firstLevelModuleDependencies
def newApiDeps = apiDeps - providedDeps

Expand Down
11 changes: 7 additions & 4 deletions gradle/shading.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ configurations {
shaded
[apiElements, implementation]*.extendsFrom shaded
}
configurations.api.canBeResolved = true
// `api` is a dependency scope and cannot be resolved directly
configurations.resolvable('resolvableApi') {
extendsFrom(configurations.api)
}

shadowJar {
configurations = [project.configurations.shaded]
Expand All @@ -16,7 +19,7 @@ shadowJar {
}

project.afterEvaluate {
Set<ModuleIdentifier> apiDependencies = project.configurations.api.resolvedConfiguration.resolvedArtifacts*.moduleVersion*.id*.module
Set<ModuleIdentifier> apiDependencies = project.configurations.resolvableApi.resolvedConfiguration.resolvedArtifacts*.moduleVersion*.id*.module

// Exclude `api` dependencies, to prevent them being included into the final JAR
shadowJar.dependencies {
Expand All @@ -27,7 +30,7 @@ project.afterEvaluate {

// Inherit dependencies' relocators
shadowJar.relocators = configurations.api.dependencies.withType(ProjectDependency).collectMany {
return it.dependencyProject.tasks.findByName("shadowJar")?.relocators ?: []
return project.project(it.path).tasks.findByName("shadowJar")?.relocators ?: []
}

// See https://github.com/GradleUp/shadow/blob/5.0.0/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/tasks/ConfigureShadowRelocation.groovy
Expand Down Expand Up @@ -64,7 +67,7 @@ project.afterEvaluate {
}

static Set<Project> findShadedProjects(Project project) {
Set<Project> dependencies = project.configurations.api.dependencies.withType(ProjectDependency)*.dependencyProject
Set<Project> dependencies = project.configurations.api.dependencies.withType(ProjectDependency).collect { project.project(it.path) }

return dependencies + dependencies.collectMany { it -> findShadedProjects(it) }
}
Loading