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

[Enhance] Add source set & change directory name #10

Merged
merged 7 commits into from
Sep 16, 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
1 change: 1 addition & 0 deletions .github/workflows/test_analyze.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 0
- name: Set up JDK 21
uses: actions/setup-java@v4
Expand Down
33 changes: 24 additions & 9 deletions bootstrap/api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id(libs.plugins.openapi.generator.get().pluginId) version libs.plugins.openapi.generator.get().version.toString()
}
Expand All @@ -7,30 +9,43 @@ dependencies {
apply(plugin = rootProject.libs.plugins.openapi.generator.get().pluginId)

implementation(project(":support:common"))

implementation(project(":domain"))
implementation(project(":application"))
implementation(project(":infrastructure:persistence"))
implementation(project(":infrastructure:sms"))

implementation(libs.spring.boot.starter.web)
implementation(libs.springdoc.openapi.webmvc.ui)
implementation(libs.swagger.annotations)
implementation(libs.spring.boot.starter.validation)

developmentOnly(libs.spring.boot.devtools)
developmentOnly(libs.spring.boot.docker.compose)
}

val openApiGeneratePath = "${layout.buildDirectory.get()}/generated"

openApiGenerate {
generatorName.set("kotlin-spring")
inputSpec.set("$rootDir/openapi/openapi.yaml")
outputDir.set("${layout.buildDirectory.get()}/generated")
apiPackage.set("com.sc.weave2.oas.api")
modelPackage.set("com.sc.weave2.oas.model")
configOptions.set(mapOf(
"interfaceOnly" to "true",
"useTags" to "true"
))
outputDir.set(openApiGeneratePath)
apiPackage.set("com.threedays.oas.api")
modelPackage.set("com.threedays.oas.model")
configOptions.set(
mapOf(
"interfaceOnly" to "true",
"useTags" to "true",
"useSpringBoot3" to "true",
)
)
}

tasks.named("compileKotlin") {
tasks.withType<KotlinCompile> {
dependsOn("openApiGenerate")
}

sourceSets {
main {
kotlin.srcDir("$openApiGeneratePath/src/main/kotlin")
}
}
6 changes: 6 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ springdoc-openapi = "2.6.0"
# sms-client module library versions
cool-sms = "4.3.0"

# swagger core libraray version
swagger-annotations = "2.2.8"

[libraries]
# subprojects libraries
kotlin-logging = { group = "io.github.oshai", name = "kotlin-logging-jvm", version.ref = "kotlin-logging" }
Expand Down Expand Up @@ -75,6 +78,9 @@ cool-sms = { group = "net.nurigo", name = "sdk", version.ref = "cool-sms" }
spring-boot-starter-web = { group = "org.springframework.boot", name = "spring-boot-starter-web", version.ref = "spring-boot" }
spring-boot-devtools = { group = "org.springframework.boot", name = "spring-boot-devtools", version.ref = "spring-boot" }
spring-boot-docker-compose = { group = "org.springframework.boot", name = "spring-boot-docker-compose", version.ref = "spring-boot" }
springdoc-openapi-webmvc-ui = { group = "org.springdoc", name = "springdoc-openapi-starter-webmvc-ui", version.ref = "springdoc-openapi" }
swagger-annotations = { group = "io.swagger.core.v3", name = "swagger-annotations", version.ref = "swagger-annotations" }
spring-boot-starter-validation = { group = "org.springframework.boot", name = "spring-boot-starter-validation", version.ref = "spring-boot" }

[plugins]

Expand Down