Skip to content

Commit

Permalink
build/#131: 최상위 build.gradle 을 kts로 변경, 사용하지 않는 purchase 모듈 제거,
Browse files Browse the repository at this point in the history
  • Loading branch information
JiwonDev committed Jan 5, 2024
1 parent fa07806 commit deb5b7b
Show file tree
Hide file tree
Showing 34 changed files with 248 additions and 158 deletions.
1 change: 0 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ Modular Monolithic 아키텍처이므로, 다음과 같은 모듈들로 구성
| Payment-Api | 주문한 상품에 대한 결제 처리 및 취소를 담당하는 모듈입니다. |
| Product-Api | 상품을 관리하고 사용자에게 노출하는 기능을 담당하는 모듈입니다. |
| Point-Api | (추가예정) |
| Purchase-Api | (대체예정) |

각 도메인 모듈은 하위에 아래와 같이 Layered Architecture 형식의 Build Artifacts로 분리되어 구성됩니다.

Expand Down
3 changes: 0 additions & 3 deletions account-api/account-application/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,3 @@ dependencies {
implementation "org.springframework.boot:spring-boot-starter-data-jpa"
}

tasks.getByName('bootJar') {
enabled = false
}
10 changes: 5 additions & 5 deletions account-api/account-domain/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
dependencies {
implementation project(":common")
implementation "jakarta.persistence:jakarta.persistence-api:2.2.3"
implementation "org.hibernate:hibernate-core:6.2.6.Final"
testImplementation "org.assertj:assertj-core:${ASSERTJ_VERSION}"
testImplementation "org.junit.jupiter:junit-jupiter-api:${JUNIT_JUPITER_VERSION}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${JUNIT_JUPITER_VERSION}"
implementation "jakarta.persistence:jakarta.persistence-api:3.1.0"
implementation "org.hibernate:hibernate-core:6.3.2.Final"
testImplementation "org.assertj:assertj-core"
testImplementation "org.junit.jupiter:junit-jupiter-api"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
}
10 changes: 3 additions & 7 deletions account-api/account-infrastructure/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,12 @@ plugins {
dependencies {
implementation project(":account-api:account-domain")
implementation project(":common")
implementation "io.jsonwebtoken:jjwt-api:${JJWT_VERSION}"
implementation "io.jsonwebtoken:jjwt-impl:${JJWT_VERSION}"
implementation "io.jsonwebtoken:jjwt-jackson:${JJWT_VERSION}"
implementation "io.jsonwebtoken:jjwt-api:0.12.3"
implementation "io.jsonwebtoken:jjwt-impl:0.12.3"
implementation "io.jsonwebtoken:jjwt-jackson:0.12.3"
implementation "org.springframework.boot:spring-boot-starter-web"
implementation "org.springframework.boot:spring-boot-starter-data-jpa"
implementation "org.springframework.boot:spring-boot-starter-security"
testImplementation "org.springframework.boot:spring-boot-starter-test"
annotationProcessor "org.springframework.boot:spring-boot-configuration-processor"
}

tasks.getByName('bootJar') {
enabled = false
}
3 changes: 0 additions & 3 deletions account-api/account-presentation/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,3 @@ dependencies {
testImplementation "org.springframework.boot:spring-boot-starter-test"
}

tasks.getByName('bootJar') {
enabled = false
}
14 changes: 0 additions & 14 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,3 @@ dependencies {
testImplementation "org.springframework.boot:spring-boot-starter-test"
}

tasks.getByName('bootJar') {
enabled = true
}

tasks.getByName('jar') {
enabled = false
}

tasks.register('integrationTest', Test) {
group = 'verification'
useJUnitPlatform {
includeTags('integration')
}
}
49 changes: 0 additions & 49 deletions build.gradle

This file was deleted.

216 changes: 216 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.springframework.boot.gradle.dsl.SpringBootExtension

buildscript {
repositories {
maven("https://plugins.gradle.org/m2/")
mavenCentral()
}

dependencies {
classpath("org.yaml:snakeyaml:1.28")
classpath("org.jetbrains.kotlin:kotlin-allopen:1.8.20")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0-RC2")
}
}

plugins {
id("org.springframework.boot") version "3.1.2"
id("io.spring.dependency-management") version "1.1.2"
id("org.jetbrains.kotlin.plugin.allopen") version "1.8.20"
id("org.jetbrains.kotlin.plugin.noarg") version "1.8.20"
jacoco
idea

kotlin("jvm") version "1.8.20"
kotlin("plugin.spring") version "1.8.20"
kotlin("plugin.jpa") version "1.8.20"
kotlin("kapt") version "1.8.20"
}

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

configurations {
compileOnly {
extendsFrom(configurations.annotationProcessor.get())
}
}

tasks.jar {
enabled = true
}

tasks.bootJar {
enabled = false
}

allprojects {
repositories {
maven("https://plugins.gradle.org/m2/")
mavenCentral()
}
}

subprojects {
pluginManager.withPlugin("org.springframework.boot") {
configure<SpringBootExtension> {
mainClass.set("kr.flab.movieon.MovieOnApplication")
}
}

apply {
plugin("kotlin")
plugin("io.spring.dependency-management")
plugin("org.springframework.boot")
plugin("kotlin-spring") // instead of "kotlin-allopen"
plugin("kotlin-jpa")
plugin("kotlin-kapt")
plugin("kotlin-noarg")
plugin("jacoco")
plugin("idea")
}

noArg {
annotation("com.kidsworld.core.annotation.NoArgsConstructor")
}

dependencies {
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-actuator")

implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("au.com.console:kassava:2.0.0")
implementation("net.logstash.logback:logstash-logback-encoder:7.2")

testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("io.kotest:kotest-runner-junit5:5.5.4")
testImplementation("io.kotest:kotest-assertions-core:5.5.4")
testImplementation("io.kotest.extensions:kotest-extensions-spring:1.1.2")
testImplementation("io.mockk:mockk:1.12.0")
}

tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "17"
}
}

sourceSets {
create("intTest") {
compileClasspath += sourceSets.main.get().output + sourceSets.test.get().output
runtimeClasspath += sourceSets.main.get().output + sourceSets.test.get().output

resources.srcDir(file("src/intTest/resources"))
}
}

tasks.withType<ProcessResources> {
// 동일한 파일(main/resources/application.yaml, intTest/resources/application.yaml)이 있어서, 리소스 복사할 때 충돌 회피
duplicatesStrategy = org.gradle.api.file.DuplicatesStrategy.INCLUDE
}

val intTestImplementation: Configuration by configurations.getting {
extendsFrom(configurations.implementation.get(), configurations.testImplementation.get())
}

configurations["intTestImplementation"].extendsFrom(configurations.testImplementation.get())

tasks.withType<Test> {
useJUnitPlatform()
}

tasks.test {
extensions.configure(JacocoTaskExtension::class) {
setDestinationFile(file("$buildDir/jacoco/jacoco.exec"))
}

reports {
html.required.set(true)
junitXml.required.set(true)
}

finalizedBy("integrationTest")
}

val integrationTest = task<Test>("integrationTest") {
description = "Runs integration tests."
group = "verification"

testClassesDirs = sourceSets["intTest"].output.classesDirs
classpath = sourceSets["intTest"].runtimeClasspath

maxParallelForks = 1

reports {
html.required.set(true)
junitXml.required.set(true)
}

extensions.configure(JacocoTaskExtension::class) {
setDestinationFile(file("$buildDir/jacoco/jacoco-integration.exec"))
}

shouldRunAfter("test")
finalizedBy("jacocoTestReport")
}

tasks.jacocoTestReport {
reports {
xml.required.set(true)
xml.outputLocation.set(file("$buildDir/reports/tests/jacoco.xml"))
}

shouldRunAfter("integrationTest")
}

configure<JacocoPluginExtension> {
toolVersion = "0.8.7"
}

tasks.withType<JacocoCoverageVerification> {
violationRules {
rule {
element = "BUNDLE"

limit {
counter = "BRANCH"
value = "COVEREDRATIO"
minimum = "0.0".toBigDecimal()
}
}
}
}
}

jacoco {
toolVersion = "0.8.7"
}

task<JacocoReport>("jacocoRootReport") {
dependsOn(subprojects.map { it.tasks.withType<JacocoReport>() })
sourceDirectories.setFrom(
subprojects.map {
it.tasks.findByName("jacocoTestReport")!!.property("sourceDirectories")
},
)
classDirectories.setFrom(subprojects.map { it.tasks.findByName("jacocoTestReport")!!.property("classDirectories") })
executionData.setFrom(
project.fileTree(".") {
include("**/build/jacoco/**.exec")
},
)
onlyIf {
true
}
reports {
xml.required.set(true)
html.required.set(true)
}
}
1 change: 1 addition & 0 deletions buildSrc/main/kotlin/Version.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
object Version
6 changes: 3 additions & 3 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dependencies {
testImplementation "org.junit.jupiter:junit-jupiter-api:${JUNIT_JUPITER_VERSION}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${JUNIT_JUPITER_VERSION}"
}
testImplementation "org.junit.jupiter:junit-jupiter-api"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
}
3 changes: 0 additions & 3 deletions notification-api/notification-application/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,3 @@ dependencies {
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

tasks.getByName('bootJar') {
enabled = false
}
10 changes: 5 additions & 5 deletions notification-api/notification-domain/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
dependencies {
implementation project(":common")
implementation "jakarta.persistence:jakarta.persistence-api:2.2.3"
implementation "org.hibernate:hibernate-core:6.2.6.Final"
testImplementation "org.assertj:assertj-core:${ASSERTJ_VERSION}"
testImplementation "org.junit.jupiter:junit-jupiter-api:${JUNIT_JUPITER_VERSION}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${JUNIT_JUPITER_VERSION}"
implementation "jakarta.persistence:jakarta.persistence-api:3.1.0"
implementation "org.hibernate:hibernate-core:6.3.2.Final"
testImplementation "org.assertj:assertj-core"
testImplementation "org.junit.jupiter:junit-jupiter-api"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
}
4 changes: 0 additions & 4 deletions notification-api/notification-infrastructure/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,3 @@ dependencies {
implementation "org.springframework.boot:spring-boot-starter-thymeleaf"
testImplementation "org.springframework.boot:spring-boot-starter-test"
}

tasks.getByName('bootJar') {
enabled = false
}
4 changes: 0 additions & 4 deletions notification-api/notification-presentation/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,3 @@ dependencies {
testImplementation "org.springframework.security:spring-security-test"
testImplementation "org.springframework.boot:spring-boot-starter-test"
}

tasks.getByName('bootJar') {
enabled = false
}
4 changes: 0 additions & 4 deletions order-api/order-application/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,3 @@ dependencies {
implementation "org.springframework.boot:spring-boot-starter-data-jpa"
testImplementation "org.springframework.boot:spring-boot-starter-test"
}

tasks.getByName('bootJar') {
enabled = false
}
Loading

0 comments on commit deb5b7b

Please sign in to comment.