From 792788e46f9ae874b7859856a832119ce98f5ccd Mon Sep 17 00:00:00 2001 From: Ahoo Wang Date: Fri, 10 Jan 2025 10:04:09 +0800 Subject: [PATCH] build: update Gradle configurations and dependencies (#546) - Update Gradle plugins and dependencies to use consistent naming conventions - Add LinYiPackages Maven repository for publishing - Update environment variable names for GitHub token and LinYiPackages credentials - Refactor build.gradle.kts files across multiple modules to use new dependency references --- build.gradle.kts | 12 +++++- cosky-dependencies/build.gradle.kts | 20 +++++----- cosky-rest-api/build.gradle.kts | 2 +- cosky-spring-cloud-core/build.gradle.kts | 2 +- .../build.gradle.kts | 2 +- .../build.gradle.kts | 2 +- .../cosky-service-consumer/build.gradle.kts | 2 +- .../build.gradle.kts | 2 +- .../cosky-service-provider/build.gradle.kts | 2 +- gradle/libs.versions.toml | 40 +++++++++---------- 10 files changed, 47 insertions(+), 39 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 7780a613..0473fce8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -17,11 +17,11 @@ import org.jetbrains.dokka.gradle.DokkaPlugin import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension plugins { - alias(libs.plugins.publishPlugin) + alias(libs.plugins.publish) alias(libs.plugins.detekt) alias(libs.plugins.kotlin) alias(libs.plugins.dokka) - alias(libs.plugins.jmhPlugin) + alias(libs.plugins.jmh) jacoco } val dependenciesProject = project(":cosky-dependencies") @@ -167,6 +167,14 @@ configure(publishProjects) { password = System.getenv("GITHUB_TOKEN") } } + maven { + name = "LinYiPackages" + url = uri(project.properties["linyiPackageReleaseUrl"].toString()) + credentials { + username = project.properties["linyiPackageUsername"]?.toString() + password = project.properties["linyiPackagePwd"]?.toString() + } + } } publications { val publishName = if (isBom) "mavenBom" else "mavenLibrary" diff --git a/cosky-dependencies/build.gradle.kts b/cosky-dependencies/build.gradle.kts index 4b1ab7e2..175824b6 100644 --- a/cosky-dependencies/build.gradle.kts +++ b/cosky-dependencies/build.gradle.kts @@ -12,19 +12,19 @@ */ dependencies { - api(platform(libs.springBootDependencies)) - api(platform(libs.springCloudDependencies)) - api(platform(libs.cosidBom)) - api(platform(libs.simbaBom)) - api(platform(libs.cosecBom)) + api(platform(libs.spring.boot.dependencies)) + api(platform(libs.spring.cloud.dependencies)) + api(platform(libs.cosid.bom)) + api(platform(libs.simba.bom)) + api(platform(libs.cosec.bom)) constraints { api(libs.guava) - api(libs.commonsIo) - api(libs.springDocStarterWebfluxUi) + api(libs.commons.io) + api(libs.springdoc.openapi.starter.webflux.ui) api(libs.hamcrest) api(libs.mockk) - api(libs.jmhCore) - api(libs.jmhGeneratorAnnprocess) - api(libs.detektFormatting) + api(libs.jmh.core) + api(libs.jmh.generator.annprocess) + api(libs.detekt.formatting) } } diff --git a/cosky-rest-api/build.gradle.kts b/cosky-rest-api/build.gradle.kts index 6e270f49..dd2c07bb 100644 --- a/cosky-rest-api/build.gradle.kts +++ b/cosky-rest-api/build.gradle.kts @@ -14,7 +14,7 @@ plugins { application alias(libs.plugins.kotlin) - alias(libs.plugins.kotlinSpring) + alias(libs.plugins.kotlin.spring) kotlin("kapt") } diff --git a/cosky-spring-cloud-core/build.gradle.kts b/cosky-spring-cloud-core/build.gradle.kts index 501d192d..be3cfea5 100644 --- a/cosky-spring-cloud-core/build.gradle.kts +++ b/cosky-spring-cloud-core/build.gradle.kts @@ -11,7 +11,7 @@ * limitations under the License. */ plugins { - alias(libs.plugins.kotlinSpring) + alias(libs.plugins.kotlin.spring) kotlin("kapt") } dependencies { diff --git a/cosky-spring-cloud-starter-config/build.gradle.kts b/cosky-spring-cloud-starter-config/build.gradle.kts index 2ea9ddfa..1296f877 100644 --- a/cosky-spring-cloud-starter-config/build.gradle.kts +++ b/cosky-spring-cloud-starter-config/build.gradle.kts @@ -11,7 +11,7 @@ * limitations under the License. */ plugins { - alias(libs.plugins.kotlinSpring) + alias(libs.plugins.kotlin.spring) kotlin("kapt") } dependencies { diff --git a/cosky-spring-cloud-starter-discovery/build.gradle.kts b/cosky-spring-cloud-starter-discovery/build.gradle.kts index 7e3ca87a..35760646 100644 --- a/cosky-spring-cloud-starter-discovery/build.gradle.kts +++ b/cosky-spring-cloud-starter-discovery/build.gradle.kts @@ -11,7 +11,7 @@ * limitations under the License. */ plugins { - alias(libs.plugins.kotlinSpring) + alias(libs.plugins.kotlin.spring) kotlin("kapt") } dependencies { diff --git a/examples/cosky-service-consumer/build.gradle.kts b/examples/cosky-service-consumer/build.gradle.kts index 52a7c50a..a0207a8a 100644 --- a/examples/cosky-service-consumer/build.gradle.kts +++ b/examples/cosky-service-consumer/build.gradle.kts @@ -14,7 +14,7 @@ plugins { application alias(libs.plugins.kotlin) - alias(libs.plugins.kotlinSpring) + alias(libs.plugins.kotlin.spring) kotlin("kapt") } diff --git a/examples/cosky-service-provider-api/build.gradle.kts b/examples/cosky-service-provider-api/build.gradle.kts index ff3b16a8..bc0b4754 100644 --- a/examples/cosky-service-provider-api/build.gradle.kts +++ b/examples/cosky-service-provider-api/build.gradle.kts @@ -14,7 +14,7 @@ plugins { `java-library` alias(libs.plugins.kotlin) - alias(libs.plugins.kotlinSpring) + alias(libs.plugins.kotlin.spring) } java { diff --git a/examples/cosky-service-provider/build.gradle.kts b/examples/cosky-service-provider/build.gradle.kts index df4a4147..2b9cca83 100644 --- a/examples/cosky-service-provider/build.gradle.kts +++ b/examples/cosky-service-provider/build.gradle.kts @@ -14,7 +14,7 @@ plugins { application alias(libs.plugins.kotlin) - alias(libs.plugins.kotlinSpring) + alias(libs.plugins.kotlin.spring) kotlin("kapt") } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 74e28112..fcec57a0 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,13 +1,13 @@ [versions] # libraries -springBoot = "3.4.1" -springCloud = "2024.0.0" +spring-boot = "3.4.1" +spring-cloud = "2024.0.0" cosid = "2.10.2" simba = "2.6.2" cosec = "2.9.9" guava = "33.4.0-jre" -commonsIo = "2.18.0" -springDoc = "2.8.1" +commons-io = "2.18.0" +springdoc = "2.8.1" hamcrest = "3.0" mockk = "1.13.14" jmh = "1.37" @@ -15,28 +15,28 @@ jmh = "1.37" detekt = "1.23.7" dokka = "2.0.0" kotlin = "2.0.21" -publishPlugin = "2.0.0" -jmhPlugin = "0.7.2" +publish-Plugin = "2.0.0" +jmh-plugin = "0.7.2" [libraries] -springBootDependencies = { module = "org.springframework.boot:spring-boot-dependencies", version.ref = "springBoot" } -springCloudDependencies = { module = "org.springframework.cloud:spring-cloud-dependencies", version.ref = "springCloud" } -cosidBom = { module = "me.ahoo.cosid:cosid-bom", version.ref = "cosid" } -simbaBom = { module = "me.ahoo.simba:simba-bom", version.ref = "simba" } -cosecBom = { module = "me.ahoo.cosec:cosec-bom", version.ref = "cosec" } +spring-boot-dependencies = { module = "org.springframework.boot:spring-boot-dependencies", version.ref = "spring-boot" } +spring-cloud-dependencies = { module = "org.springframework.cloud:spring-cloud-dependencies", version.ref = "spring-cloud" } +cosid-bom = { module = "me.ahoo.cosid:cosid-bom", version.ref = "cosid" } +simba-bom = { module = "me.ahoo.simba:simba-bom", version.ref = "simba" } +cosec-bom = { module = "me.ahoo.cosec:cosec-bom", version.ref = "cosec" } guava = { module = "com.google.guava:guava", version.ref = "guava" } -commonsIo = { module = "commons-io:commons-io", version.ref = "commonsIo" } -springDocStarterWebfluxUi = { module = "org.springdoc:springdoc-openapi-starter-webflux-ui", version.ref = "springDoc" } +commons-io = { module = "commons-io:commons-io", version.ref = "commons-io" } +springdoc-openapi-starter-webflux-ui = { module = "org.springdoc:springdoc-openapi-starter-webflux-ui", version.ref = "springdoc" } hamcrest = { module = "org.hamcrest:hamcrest", version.ref = "hamcrest" } mockk = { module = "io.mockk:mockk", version.ref = "mockk" } -detektFormatting = { module = "io.gitlab.arturbosch.detekt:detekt-formatting", version.ref = "detekt" } -jmhCore = { module = "org.openjdk.jmh:jmh-core", version.ref = "jmh" } -jmhGeneratorAnnprocess = { module = "org.openjdk.jmh:jmh-generator-annprocess", version.ref = "jmh" } +detekt-formatting = { module = "io.gitlab.arturbosch.detekt:detekt-formatting", version.ref = "detekt" } +jmh-core = { module = "org.openjdk.jmh:jmh-core", version.ref = "jmh" } +jmh-generator-annprocess = { module = "org.openjdk.jmh:jmh-generator-annprocess", version.ref = "jmh" } [plugins] detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" } dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } -kotlinSpring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlin" } -kotlinkapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" } -publishPlugin = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "publishPlugin" } -jmhPlugin = { id = "me.champeau.jmh", version.ref = "jmhPlugin" } +kotlin-spring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlin" } +kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" } +publish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "publish-Plugin" } +jmh = { id = "me.champeau.jmh", version.ref = "jmh-plugin" }