|
|
|
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
|
|
|
|
|
|
|
|
plugins {
|
|
|
|
|
id("org.springframework.boot") version "3.2.2"
|
|
|
|
|
id("io.spring.dependency-management") version "1.1.4"
|
|
|
|
|
kotlin("jvm") version "1.9.22"
|
|
|
|
|
kotlin("plugin.spring") version "1.9.22"
|
|
|
|
|
kotlin("plugin.jpa") version "1.9.22"
|
|
|
|
|
|
|
|
|
|
id("org.liquibase.gradle") version "2.2.1"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
group = "com.example"
|
|
|
|
|
version = "0.0.1-SNAPSHOT"
|
|
|
|
|
|
|
|
|
|
java {
|
|
|
|
|
sourceCompatibility = JavaVersion.VERSION_21
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
|
mavenCentral()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
|
implementation("org.jetbrains.kotlin:kotlin-reflect")
|
|
|
|
|
|
|
|
|
|
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
|
|
|
|
|
implementation("org.springframework.boot:spring-boot-starter-validation")
|
|
|
|
|
|
|
|
|
|
liquibaseRuntime("org.liquibase:liquibase-core")
|
|
|
|
|
liquibaseRuntime("org.liquibase.ext:liquibase-hibernate6:4.25.1")
|
|
|
|
|
liquibaseRuntime("info.picocli:picocli:4.6.3")
|
|
|
|
|
liquibaseRuntime("com.h2database:h2")
|
|
|
|
|
liquibaseRuntime("org.postgresql:postgresql")
|
|
|
|
|
|
|
|
|
|
testImplementation("org.springframework.boot:spring-boot-starter-test")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tasks.withType<KotlinCompile> {
|
|
|
|
|
kotlinOptions {
|
|
|
|
|
freeCompilerArgs += "-Xjsr305=strict"
|
|
|
|
|
jvmTarget = "21"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tasks.withType<Test> {
|
|
|
|
|
useJUnitPlatform()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
liquibase {
|
|
|
|
|
val profile = System.getProperty("profile") ?: "local"
|
|
|
|
|
|
|
|
|
|
// TODO: db.yaml objectMapper 로 읽어서 세팅?
|
|
|
|
|
activities.register("local") {
|
|
|
|
|
this.arguments = mapOf(
|
|
|
|
|
"url" to "jdbc:postgresql://localhost:15432/localdb",
|
|
|
|
|
"username" to "flower",
|
|
|
|
|
"password" to "flower"
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
activities.register("dev") {
|
|
|
|
|
this.arguments = mapOf(
|
|
|
|
|
"url" to "jdbc:postgresql://flower-fragrance-stage.cluster-cbth1bnhfbdg.ap-northeast-2.rds.amazonaws.com:5432/devdb",
|
|
|
|
|
"username" to "anypoint",
|
|
|
|
|
"password" to "*emflaj*"
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
runList = profile
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun addArguments(name: String, args: Map<String, String>) {
|
|
|
|
|
val activity = liquibase.activities.getByName(name)
|
|
|
|
|
activity.name = name
|
|
|
|
|
val activityArgs = activity.arguments as Map<*, *>
|
|
|
|
|
val newArgs = mutableMapOf<String, String>()
|
|
|
|
|
newArgs.putAll(activityArgs.map { it.key as String to it.value as String })
|
|
|
|
|
newArgs.putAll(args)
|
|
|
|
|
|
|
|
|
|
newArgs.forEach {
|
|
|
|
|
println("arguments[\"${it.key}\"]=\"${it.value}\"")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
activity.arguments = newArgs
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tasks.getByName("generateChangelog").doFirst {
|
|
|
|
|
val changeLogFile = "src/main/resources/liquibase/postgres/changelog/generated.yaml"
|
|
|
|
|
delete(changeLogFile)
|
|
|
|
|
val name = System.getProperty("name") ?: "local"
|
|
|
|
|
addArguments(name, mapOf("changeLogFile" to changeLogFile))
|
|
|
|
|
}
|