[*] Configure delombokked sources jars

This commit is contained in:
2025-04-23 19:02:30 +02:00
parent 6e79957207
commit cef5227bf1
4 changed files with 40 additions and 8 deletions

View File

@@ -1,5 +1,5 @@
plugins { plugins {
id("dev.panuszewski.typesafe-conventions") version "0.4.1" id("dev.panuszewski.typesafe-conventions") version "0.6.0"
} }
rootProject.name = "tweed5-conventions" rootProject.name = "tweed5-conventions"

View File

@@ -2,7 +2,9 @@ plugins {
java java
`java-library` `java-library`
`maven-publish` `maven-publish`
alias(libs.plugins.lombok)
id("de.siphalor.tweed5.local-runtime-only") id("de.siphalor.tweed5.local-runtime-only")
id("de.siphalor.tweed5.expanded-sources-jar")
} }
group = rootProject.group group = rootProject.group
@@ -23,12 +25,11 @@ val testAgentClasspath = configurations.resolvable("testAgentClasspath") {
extendsFrom(testAgent.get()) extendsFrom(testAgent.get())
} }
dependencies { lombok {
compileOnly(libs.lombok) version = libs.versions.lombok.get()
annotationProcessor(libs.lombok) }
testCompileOnly(libs.lombok)
testAnnotationProcessor(libs.lombok)
dependencies {
compileOnly(libs.autoservice.annotations) compileOnly(libs.autoservice.annotations)
annotationProcessor(libs.autoservice.processor) annotationProcessor(libs.autoservice.processor)
testCompileOnly(libs.autoservice.annotations) testCompileOnly(libs.autoservice.annotations)

View File

@@ -0,0 +1,29 @@
import io.freefair.gradle.plugins.lombok.tasks.Delombok
plugins {
java
`java-library`
alias(libs.plugins.lombok)
}
val expandedSourcesElements = configurations.consumable("expandedSourcesElements") {
attributes {
attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling.EXTERNAL))
}
}
val delombok = tasks.getByName<Delombok>("delombok")
val sourcesJarTask by tasks.registering(Jar::class) {
dependsOn(delombok)
from(delombok.target)
archiveClassifier.set("sources")
}
artifacts.add(expandedSourcesElements.name, sourcesJarTask)
tasks.named("build") { dependsOn(sourcesJarTask) }
components.named<AdhocComponentWithVariants>("java") {
addVariantsFromConfiguration(expandedSourcesElements.get()) {}
}

View File

@@ -9,6 +9,9 @@ lombok = "1.18.34"
mockito = "5.14.2" mockito = "5.14.2"
slf4j = "2.0.16" slf4j = "2.0.16"
[plugins]
lombok = { id = "io.freefair.lombok", version = "8.13.1" }
[libraries] [libraries]
assertj = { group = "org.assertj", name = "assertj-core", version.ref = "assertj" } assertj = { group = "org.assertj", name = "assertj-core", version.ref = "assertj" }
asm-commons = { group = "org.ow2.asm", name = "asm-commons", version.ref = "asm" } asm-commons = { group = "org.ow2.asm", name = "asm-commons", version.ref = "asm" }
@@ -19,7 +22,6 @@ jetbrains-annotations = { group = "org.jetbrains", name = "annotations", version
junit-platform = { group = "org.junit", name = "junit-bom", version.ref = "junit" } junit-platform = { group = "org.junit", name = "junit-bom", version.ref = "junit" }
junit-core = { group = "org.junit.jupiter", name = "junit-jupiter" } junit-core = { group = "org.junit.jupiter", name = "junit-jupiter" }
junit-launcher = { group = "org.junit.platform", name = "junit-platform-launcher" } junit-launcher = { group = "org.junit.platform", name = "junit-platform-launcher" }
lombok = { group = "org.projectlombok", name = "lombok", version.ref = "lombok" }
mockito = { group = "org.mockito", name = "mockito-core", version.ref = "mockito" } mockito = { group = "org.mockito", name = "mockito-core", version.ref = "mockito" }
slf4j-api = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j" } slf4j-api = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j" }
slf4j-rt = { group = "org.slf4j", name = "slf4j-simple", version.ref = "slf4j" } slf4j-rt = { group = "org.slf4j", name = "slf4j-simple", version.ref = "slf4j" }