Skip to content

Commit

Permalink
⬆️ Upgrade to Spring Boot 3, Kotlin 1.9, Gradle 8.2.1 (#519)
Browse files Browse the repository at this point in the history
* ⬆️ Upgrade to Spring Boot 3, Kotlin 1.9, Gradle 8.2.1

* ⬆️ Upgrade to Spring Boot 3, Kotlin 1.9, Gradle 8.2.1
  • Loading branch information
devkanro authored Aug 4, 2023
1 parent 250c06b commit f8fe4db
Show file tree
Hide file tree
Showing 79 changed files with 660 additions and 245 deletions.
6 changes: 4 additions & 2 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
</p>
<p>
<a href="https://github.com/grpc-ecosystem/awesome-grpc"><img alt="Awesome gRPC" src="https://raw.githubusercontent.com/sindresorhus/awesome/main/media/badge.svg" /></a>
<img src="https://img.shields.io/badge/jdk-17-green?logo=java" alt="JDK version"/>
<img src="https://img.shields.io/badge/gradle-%5E7.5-green?logo=gradle" alt="Gradle version"/>
<img src="https://img.shields.io/badge/jdk-17-green?logo=openjdk" alt="JDK version"/>
<img src="https://img.shields.io/badge/SpringBoot-3-green?logo=springboot" alt="SpringBoot version"/>
<img src="https://img.shields.io/badge/Kotlin-1.9-green?logo=kotlin" alt="Kotlin version">
<img src="https://img.shields.io/badge/gradle-%5E8-green?logo=gradle" alt="Gradle version"/>
<a href="https://mvnrepository.com/artifact/com.bybutter.sisyphus/sisyphus-bom"><img src="https://img.shields.io/maven-central/v/com.bybutter.sisyphus/sisyphus-bom" alt="Maven Central"/></a>
</p>
</h1>
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/JavaProjectPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class JavaProjectPlugin : Plugin<Project> {
target.plugins.apply(SisyphusProjectPlugin::class.java)

target.tasks.withType<JavaCompile> {
sourceCompatibility = JavaVersion.VERSION_1_8.majorVersion
targetCompatibility = JavaVersion.VERSION_1_8.majorVersion
sourceCompatibility = JavaVersion.VERSION_17.majorVersion
targetCompatibility = JavaVersion.VERSION_17.majorVersion
}

target.dependencies {
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/KotlinProjectPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class KotlinProjectPlugin : Plugin<Project> {
}

target.tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.jvmTarget = "17"
kotlinOptions.freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
}
}
Expand Down
13 changes: 13 additions & 0 deletions buildSrc/src/main/kotlin/LibraryProjectPlugin.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
import org.gradle.api.JavaVersion
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

class LibraryProjectPlugin : Plugin<Project> {
override fun apply(target: Project) {
target.plugins.apply(KotlinProjectPlugin::class.java)

target.group = "com.bybutter.sisyphus"

target.tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}

target.tasks.withType<JavaCompile> {
sourceCompatibility = JavaVersion.VERSION_1_8.majorVersion
targetCompatibility = JavaVersion.VERSION_1_8.majorVersion
}
}
}
34 changes: 17 additions & 17 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,45 @@ elastic = "7.15.2"
google-apiCommon = "2.6.2"
google-commonProtos = "2.14.2"
gradle-docker = "8.1.0"
grpc = "1.53.0"
grpc = "1.57.1"
grpc-kotlin = "1.3.0"
grpc-rxjava = "1.2.3"
grpc-rxjava = "1.2.4"
gson = "2.9.1"
h2 = "2.1.214"
hbase = "2.8.7"
hikari = "5.0.1"
jackson = "2.14.2"
jgit = "6.4.0.202211300538-r"
jooq = "3.17.8"
junit-jupiter = "5.9.2"
junit-platform = "1.9.2"
kotlin = "1.8.10"
jooq = "3.18.5"
junit-jupiter = "5.10.0"
junit-platform = "1.10.0"
kotlin = "1.9.0"
kotlinpoet = "1.12.0"
kotlinx-coroutines = "1.6.4"
kotlinx-coroutines = "1.7.3"
ktlint = "11.3.1"
kubernetes = "16.0.3"
maven = "3.9.0"
maven-resolver = "1.9.4"
maven-wagon = "3.5.3"
mongodb = "4.6.1"
mysql = "8.0.32"
nebula-contacts = "7.0.0"
nebula-info = "12.0.1"
nebula-publishing = "20.1.0"
nebula-contacts = "7.0.1"
nebula-info = "12.1.6"
nebula-publishing = "20.3.0"
okhttp = "4.10.0"
plugin-publishing = "1.1.0"
postgresql = "42.5.4"
protobuf = "3.22.2"
protobuf = "3.23.0"
protobuf-legacy = "3.22.2"
reflections = "0.10.2"
resilience4j = "1.7.1"
retrofit = "2.9.0"
rocketmq = "4.7.1"
kafka = "2.7.2"
rxjava = "2.2.21"
sisyphus-project-plugin = "1.7.1"
sisyphus-protobuf-plugin = "1.7.0"
spring-boot = "2.7.9"
spring-framework = "5.3.13"
spring-rabbit = "2.4.10"
sisyphus-project-plugin = "2.0.0"
sisyphus-protobuf-plugin = "2.0.0"
spring-boot = "3.1.2"
spring-rabbit = "3.0.7"
swagger = "2.2.8"

[libraries]
Expand Down Expand Up @@ -102,6 +101,7 @@ okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
postgresql-connector = { module = "org.postgresql:postgresql", version.ref = "postgresql" }
protobuf-bom = { module = "com.google.protobuf:protobuf-bom", version.ref = "protobuf" }
protobuf-java = { module = "com.google.protobuf:protobuf-java", version.ref = "protobuf" }
protobuf-javaLegacy = { module = "com.google.protobuf:protobuf-java", version.ref = "protobuf-legacy" }
reflections = { module = "org.reflections:reflections", version.ref = "reflections" }
resilience4j-circuitbreaker = { module = "io.github.resilience4j:resilience4j-circuitbreaker", version.ref = "resilience4j" }
resilience4j-retrofit = { module = "io.github.resilience4j:resilience4j-retrofit", version.ref = "resilience4j" }
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
1 change: 0 additions & 1 deletion lib/sisyphus-common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ description = "Common lib of Sisyphus Project"

dependencies {
implementation(libs.kotlin.reflect)
compileOnly(libs.spring.boot)
compileOnly(libs.kotlin.coroutines)
}
16 changes: 16 additions & 0 deletions lib/sisyphus-dsl/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,19 @@ dependencies {
configurations {
api.get().setExtendsFrom(api.get().extendsFrom.filter { it.name != "antlr" })
}

tasks.runKtlintCheckOverMainSourceSet.configure {
dependsOn(tasks.generateGrammarSource)
}

tasks.runKtlintCheckOverTestSourceSet.configure {
dependsOn(tasks.generateTestGrammarSource)
}

tasks.runKtlintFormatOverMainSourceSet.configure {
dependsOn(tasks.generateGrammarSource)
}

tasks.runKtlintFormatOverTestSourceSet.configure {
dependsOn(tasks.generateTestGrammarSource)
}
2 changes: 1 addition & 1 deletion lib/sisyphus-protobuf/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description = "Sisyphus customized Protobuf runtime for Kotlin"
dependencies {
api(projects.lib.sisyphusCommon)

proto(libs.protobuf.java)
proto(libs.protobuf.javaLegacy)

testImplementation(libs.junit.jupiter)
testImplementation(projects.lib.sisyphusGrpc)
Expand Down
11 changes: 11 additions & 0 deletions lib/sisyphus-test/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
`sisyphus-library`
`sisyphus-protobuf`
}

description = " Test framework for testing gRPC apis in Sisyphus Framework"

tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "17"
}

tasks.withType<JavaCompile> {
sourceCompatibility = JavaVersion.VERSION_17.majorVersion
targetCompatibility = JavaVersion.VERSION_17.majorVersion
}

dependencies {
api(libs.junit.jupiter.engine)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ import com.bybutter.sisyphus.test.extension.AfterTestCase
import com.bybutter.sisyphus.test.extension.BeforeTestCase
import com.bybutter.sisyphus.test.extensions
import org.junit.platform.engine.TestDescriptor
import org.junit.platform.engine.TestSource
import org.junit.platform.engine.UniqueId
import org.junit.platform.engine.support.descriptor.EngineDescriptor
import org.junit.platform.engine.support.descriptor.FileSource
import org.junit.platform.engine.support.hierarchical.Node
import org.opentest4j.AssertionFailedError
import java.io.File
import java.util.Optional

class SisyphusTestCaseDescriptor(id: UniqueId, val case: TestCase) :
class SisyphusTestCaseDescriptor(id: UniqueId, val case: TestCase, val file: File) :
EngineDescriptor(id, case.name),
Node<SisyphusTestEngineContext> {

Expand Down Expand Up @@ -52,6 +56,10 @@ class SisyphusTestCaseDescriptor(id: UniqueId, val case: TestCase) :
return TestDescriptor.Type.CONTAINER_AND_TEST
}

override fun getSource(): Optional<TestSource> {
return Optional.of(FileSource.from(file))
}

companion object {
const val SEGMENT_TYPE = "cases"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import org.opentest4j.AssertionFailedError
import java.util.concurrent.TimeUnit
import kotlin.reflect.full.memberProperties

class SisyphusTestStepDescriptor(id: UniqueId, val step: TestStep) :
class SisyphusTestStepDescriptor(id: UniqueId, private val step: TestStep) :
EngineDescriptor(id, step.name), Node<SisyphusTestEngineContext> {

override fun shouldBeSkipped(context: SisyphusTestEngineContext): Node.SkipResult {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,15 @@ class SisyphusTestSelectorResolver : SelectorResolver {
}

private fun createTestCaseDescriptor(parent: TestDescriptor, case: TestCase, name: String): TestDescriptor {
val id = File(name).nameWithoutExtension
val file = File(name)
val id = file.nameWithoutExtension
val case = case {
this.name = this.name.takeIf { it.isNotBlank() } ?: File(name).nameWithoutExtension
this.name = this.name.takeIf { it.isNotBlank() } ?: id
}
return SisyphusTestCaseDescriptor(
parent.uniqueId.append(SisyphusTestCaseDescriptor.SEGMENT_TYPE, id),
case
case,
file
)
}

Expand Down
1 change: 1 addition & 0 deletions middleware/sisyphus-amqp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ description = "Middleware for using AMQP in Sisyphus Project"
dependencies {
implementation(projects.lib.sisyphusDto)
implementation(projects.lib.sisyphusJackson)
implementation(projects.middleware.sisyphusSpring)

api(libs.spring.boot)
api(libs.spring.framework.amqp)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.bybutter.sisyphus.middleware.amqp

import org.springframework.boot.autoconfigure.AutoConfiguration
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.ComponentScan
import org.springframework.context.annotation.Configuration

@Configuration
@AutoConfiguration
@ComponentScan(basePackageClasses = [SisyphusAmqpAutoConfiguration::class])
class SisyphusAmqpAutoConfiguration {
@Bean
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.bybutter.sisyphus.middleware.amqp.SisyphusAmqpAutoConfiguration
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.bybutter.sisyphus.middleware.elastic

import org.springframework.boot.autoconfigure.AutoConfiguration
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.ComponentScan
import org.springframework.context.annotation.Configuration

@Configuration
@AutoConfiguration
@ComponentScan(basePackageClasses = [SisyphusElasticAutoConfiguration::class])
class SisyphusElasticAutoConfiguration {
@Bean
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.bybutter.sisyphus.middleware.elastic.SisyphusElasticAutoConfiguration
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ dependencies {
api(projects.lib.sisyphusJackson)
api(libs.spring.boot)
implementation(libs.kubernetes)
implementation(projects.middleware.sisyphusSpring)
}
1 change: 1 addition & 0 deletions middleware/sisyphus-grpc-client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ description = "Middleware for using gRPC client in Sisyphus Project"
dependencies {
api(projects.lib.sisyphusGrpcCoroutine)
api(libs.spring.boot)
implementation(projects.middleware.sisyphusSpring)
runtimeOnly(libs.grpc.netty)
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.bybutter.sisyphus.middleware.grpc

import org.springframework.boot.autoconfigure.AutoConfiguration
import org.springframework.context.annotation.ComponentScan
import org.springframework.context.annotation.Configuration

@Configuration
@AutoConfiguration
@ComponentScan(basePackageClasses = [SisyphusGrpcClientAutoConfiguration::class])
class SisyphusGrpcClientAutoConfiguration
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.bybutter.sisyphus.middleware.grpc.SisyphusGrpcClientAutoConfiguration
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.bybutter.sisyphus.middleware.hbase

import org.springframework.boot.autoconfigure.AutoConfiguration
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.ComponentScan
import org.springframework.context.annotation.Configuration

@Configuration
@AutoConfiguration
@ComponentScan(basePackageClasses = [SisyphusHBaseAutoConfiguration::class])
class SisyphusHBaseAutoConfiguration {
@Bean
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.bybutter.sisyphus.middleware.hbase.SisyphusHBaseAutoConfiguration
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import com.bybutter.sisyphus.middleware.jdbc.hint.HintExecuteListener
import com.bybutter.sisyphus.middleware.jdbc.transaction.SisyphusTransactionProvider
import org.jooq.ExecuteListenerProvider
import org.jooq.TransactionProvider
import org.springframework.boot.autoconfigure.AutoConfiguration
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.ComponentScan
import org.springframework.context.annotation.Configuration

@Configuration
@AutoConfiguration
@ComponentScan(basePackageClasses = [SisyphusJdbcAutoConfiguration::class])
class SisyphusJdbcAutoConfiguration {
@Bean
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.bybutter.sisyphus.middleware.jdbc.SisyphusJdbcAutoConfiguration
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,7 @@ class TransactionTest {
}

private fun createUser(dsl: DSLContext, name: String) {
dsl.insertInto(userTable)
.set(nameField, name)
.execute()
dsl.insertInto(userTable).set(nameField, name).execute()
}

private fun assertUserExist(dsl: DSLContext, name: String) {
Expand All @@ -119,9 +117,7 @@ class TransactionTest {
}

private fun getUser(dsl: DSLContext, name: String): Record? {
return dsl.selectFrom(userTable)
.where(nameField.eq(name))
.fetchOne()
return dsl.selectFrom(userTable).where(nameField.eq(name)).fetchOne()
}

private fun rollbackException() {
Expand All @@ -138,10 +134,7 @@ class TransactionTest {

private fun initializeTable(dsl: DSLContext) {
dsl.dropTableIfExists(userTable).execute()
dsl.createTable(userTable)
.column(idField)
.column(nameField)
.execute()
dsl.createTable(userTable).column(idField).column(nameField).execute()
}

private val userTable = table(name("user"))
Expand Down
Loading

0 comments on commit f8fe4db

Please sign in to comment.