Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Apply version catalog #198

Merged
merged 5 commits into from
Sep 19, 2024
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
112 changes: 0 additions & 112 deletions build.gradle.kts

This file was deleted.

23 changes: 23 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
plugins {
`kotlin-dsl`
}

repositories {
mavenCentral()
gradlePluginPortal()
}

fun plugin(provider: Provider<PluginDependency>) = with(provider.get()) {
"$pluginId:$pluginId.gradle.plugin:$version"
}

dependencies {
implementation(plugin(libs.plugins.spring.boot))
implementation(plugin(libs.plugins.spring.dependency.management))
implementation(plugin(libs.plugins.kotlin.jvm))
implementation(plugin(libs.plugins.kotlin.kapt))
implementation(plugin(libs.plugins.kotlin.spring))
implementation(plugin(libs.plugins.kotlin.jpa))
implementation(plugin(libs.plugins.kotlin.lint))
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
}
37 changes: 37 additions & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
rootProject.name = "piikii-convention"

plugins {
id("com.gradle.develocity") version ("3.17.6")
}

develocity {
buildScan {
projectId.set("piikii-application")

termsOfUseUrl.set("https://gradle.com/help/legal-terms-of-use")
termsOfUseAgree.set("yes")

link("VCS", "https://github.com/mash-up-kr/piikii_Spring/tree/develop")
value("hash", System.getenv("CURRENT_GIT_SHA"))
value("status", System.getenv("STATUS"))

buildFinished {
if (this.failures.isNotEmpty()) {
val failureMessages = this.failures.mapNotNull { it.message }.joinToString(",") { it }
value("Failed with", failureMessages)
}
}
// default false option: 추후 많은 빌드로 인해 이슈가 생길 때를 대비
// publishing.onlyIf { false }
}
}

dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}


67 changes: 67 additions & 0 deletions buildSrc/src/main/kotlin/piikii-convention.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import org.gradle.accessors.dm.LibrariesForLibs
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

val libs = the<LibrariesForLibs>()

plugins {
`java-library`
id("org.springframework.boot")
id("io.spring.dependency-management")
id("org.jetbrains.kotlin.jvm")
id("org.jetbrains.kotlin.kapt")
id("org.jetbrains.kotlin.plugin.spring")
id("org.jetbrains.kotlin.plugin.jpa")
id("org.jlleitschuh.gradle.ktlint")
}

repositories {
mavenCentral()
}

group = "com.piikii"
version = "0.0.1-SNAPSHOT"

dependencies {
implementation(libs.bundles.spring.common)
implementation(libs.bundles.kotlin.spring)
annotationProcessor(libs.spring.boot.annotation.processor)
testImplementation(libs.bundles.test.implementation)
testRuntimeOnly(libs.bundles.test.runtime)
}

// piikii common 의존성 전체 추가
configure(allprojects.filter { it.name != "piikii-common" }) {
dependencies {
implementation(project(":piikii-common"))
}
}

java.toolchain.languageVersion = JavaLanguageVersion.of(libs.versions.javaVersion.get())

tasks {
bootJar {
enabled = false
}
jar {
enabled = true
}

withType<KotlinCompile> {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_21)
freeCompilerArgs.addAll("-Xjsr305=strict")
}
}

withType<Test> {
useJUnitPlatform()
}
}

configurations.all {
resolutionStrategy {
cacheDynamicVersionsFor(10 * 60, TimeUnit.SECONDS)
cacheChangingModulesFor(4, TimeUnit.HOURS)
}
}
75 changes: 59 additions & 16 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,66 @@
[versions]
springBoot = "3.3.0"
springDependencyManagement = "1.1.5"
kotlin = "2.0.0"
jpaPlugin = "2.0.0"
kaptPlugin = "2.0.0"
ktLint = "12.1.1"
kotlinPlugin = "2.0.0"
ktLintPlugin = "12.1.1"
gradleBuildScanPlugin = "3.18.1"
jaxb = "2.3.1"
javaVersion = "21"

[plugins]
spring-boot = { id = "org.springframework.boot", version.ref = "springBoot" }
spring-dependency-management = { id = "io.spring.dependency-management", version.ref = "springDependencyManagement" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlinPlugin" }
kotlin-spring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlinPlugin" }
kotlin-jpa = { id = "org.jetbrains.kotlin.plugin.jpa", version.ref = "kotlinPlugin" }
kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlinPlugin" }
kotlin-lint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktLintPlugin" }
gradle-develocity = { id = "com.gradle.develocity", version.ref = "gradleBuildScanPlugin" }

[libraries]
springBoot = { module = "org.springframework.boot:spring-boot-gradle-plugin", version.ref = "springBoot" }
springDependencyManagement = { module = "io.spring.gradle:dependency-management-plugin", version.ref = "springDependencyManagement" }
kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
ktLint = { module = "org.jlleitschuh.gradle:ktlint-gradle", version.ref = "ktLint" }
kotlin-jackson = { group = "com.fasterxml.jackson.module", name = "jackson-module-kotlin" }
kotlin-refelct = { group = "org.jetbrains.kotlin", name = "kotlin-reflect" }
kotlin-logging = { group = "io.github.microutils", name = "kotlin-logging-jvm", version = "3.0.5" }

[plugins]
springBoot = { id = "org.springframework.boot", version.ref = "springBoot" }
springDependencyManagement = { id = "io.spring.dependency-management", version.ref = "springDependencyManagement" }
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlinSpring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlin" }
kotlinJpa = { id = "org.jetbrains.kotlin.plugin.jpa", version.ref = "jpaPlugin" }
kotlinKapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kaptPlugin" }
ktLint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktLint" }
spring-web = { group = "org.springframework", name = "spring-web" }
spring-transaction = { group = "org.springframework", name = "spring-tx" }
spring-kafka = { group = "org.springframework.kafka", name = "spring-kafka" }

spring-boot-starter-autoconfigure = { group = "org.springframework.boot", name = "spring-boot-autoconfigure" }
spring-boot-starter-web = { group = "org.springframework.boot", name = "spring-boot-starter-web" }
spring-boot-starter-aop = { group = "org.springframework.boot", name = "spring-boot-starter-aop" }
spring-boot-starter-actuator = { group = "org.springframework.boot", name = "spring-boot-starter-actuator" }
spring-boot-starter-validation = { group = "org.springframework.boot", name = "spring-boot-starter-validation" }
spring-boot-starter-cache = { group = "org.springframework.boot", name = "spring-boot-starter-cache" }
spring-boot-starter-jpa = { group = "org.springframework.boot", name = "spring-boot-starter-data-jpa" }
spring-boot-starter-redis = { group = "org.springframework.boot", name = "spring-boot-starter-data-redis" }
spring-boot-docs = { group = "org.springdoc", name = "springdoc-openapi-starter-webmvc-ui", version = "2.5.0" }

postgresql = { group = "org.postgresql", name = "postgresql" }
caffeine = { group = "com.github.ben-manes.caffeine", name = "caffeine" }
opentelemetry-starter = { group = "io.opentelemetry.instrumentation", name = "opentelemetry-spring-boot-starter" }
micrometer-prometheus = { group = "io.micrometer", name = "micrometer-registry-prometheus" }

aws-sdk-s3 = { group = "com.amazonaws", name = "aws-java-sdk-s3", version = "1.11.238" }
jaxb-api = { group = "javax.xml.bind", name = "jaxb-api", version.ref = "jaxb" }
jaxb-runtime = { group = "org.glassfish.jaxb", name = "jaxb-runtime", version.ref = "jaxb" }

spring-boot-annotation-processor = { group = "org.springframework.boot", name = "spring-boot-configuration-processor" }
spring-boot-starter-test = { group = "org.springframework.boot", name = "spring-boot-starter-test" }
kotlin-junit5 = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit5" }
junit = { group = "org.junit.platform", name = "junit-platform-launcher" }

[bundles]
spring-common = ["spring-boot-starter-autoconfigure"]
kotlin-spring = ["kotlin-refelct", "kotlin-jackson", "kotlin-logging"]
test-implementation = ["spring-boot-starter-test", "kotlin-junit5"]
test-runtime = ["junit"]

bootstarp = ["spring-boot-starter-web", "spring-boot-starter-actuator", "opentelemetry-starter"]
bootstarp-runtime = ["micrometer-prometheus"]
domain-application = ["spring-boot-docs", "spring-transaction"]
adaptor-input-http = ["spring-boot-starter-web", "spring-boot-starter-aop", "spring-boot-docs", "spring-boot-starter-validation"]
adaptor-persistence-postgresql = ["spring-boot-starter-jpa", "postgresql"]
adaptor-storage = ["spring-web", "aws-sdk-s3", "jaxb-api", "jaxb-runtime"]
adaptor-cache-redis = ["spring-boot-starter-cache", "spring-boot-starter-redis"]
adaptor-cache-caffeine = ["spring-boot-starter-cache", "caffeine"]
16 changes: 4 additions & 12 deletions piikii-application/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
dependencies {
// for docs
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.5.0")

// for transaction
implementation("org.springframework:spring-tx:6.1.10")
plugins {
id("piikii-convention")
}

tasks.bootJar {
enabled = false
}

tasks.jar {
enabled = true
dependencies {
implementation(libs.bundles.domain.application)
}
Loading