2024-06-02 15:44:43 +00:00
|
|
|
import org.openapitools.generator.gradle.plugin.tasks.GenerateTask
|
|
|
|
|
2024-06-01 09:23:44 +00:00
|
|
|
plugins {
|
2024-06-02 15:44:43 +00:00
|
|
|
alias(libs.plugins.kotlin.jvm)
|
|
|
|
alias(libs.plugins.openapi.generator)
|
|
|
|
alias(libs.plugins.spring.boot)
|
|
|
|
alias(libs.plugins.kotlin.spring)
|
2024-08-23 14:51:25 +00:00
|
|
|
alias(libs.plugins.detekt)
|
2024-06-02 15:44:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
apply {
|
|
|
|
plugin("io.spring.dependency-management")
|
2024-06-01 09:23:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
group = "dev.usbharu"
|
|
|
|
version = "1.0-SNAPSHOT"
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
2024-08-11 07:07:10 +00:00
|
|
|
maven {
|
|
|
|
url = uri("https://git.usbharu.dev/api/packages/usbharu/maven")
|
|
|
|
}
|
|
|
|
maven {
|
|
|
|
name = "GitHubPackages"
|
|
|
|
url = uri("https://maven.pkg.github.com/usbharu/http-signature")
|
|
|
|
credentials {
|
|
|
|
|
|
|
|
username = project.findProperty("gpr.user") as String? ?: System.getenv("USERNAME")
|
|
|
|
password = project.findProperty("gpr.key") as String? ?: System.getenv("TOKEN")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
maven {
|
|
|
|
name = "GitHubPackages2"
|
|
|
|
url = uri("https://maven.pkg.github.com/multim-dev/emoji-kt")
|
|
|
|
credentials {
|
|
|
|
|
|
|
|
username = project.findProperty("gpr.user") as String? ?: System.getenv("USERNAME")
|
|
|
|
password = project.findProperty("gpr.key") as String? ?: System.getenv("TOKEN")
|
|
|
|
}
|
|
|
|
}
|
2024-06-01 09:23:44 +00:00
|
|
|
}
|
|
|
|
|
2024-06-28 15:02:50 +00:00
|
|
|
configurations {
|
|
|
|
all {
|
|
|
|
exclude("org.springframework.boot", "spring-boot-starter-logging")
|
|
|
|
exclude("ch.qos.logback", "logback-classic")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-06-01 09:23:44 +00:00
|
|
|
dependencies {
|
2024-08-23 14:51:25 +00:00
|
|
|
detektPlugins(libs.detekt.formatting)
|
2024-06-02 15:44:43 +00:00
|
|
|
implementation("org.springframework.boot:spring-boot-starter-web")
|
|
|
|
implementation("org.springframework.boot:spring-boot-starter-security")
|
|
|
|
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
|
2024-06-28 15:02:50 +00:00
|
|
|
implementation("org.springframework.boot:spring-boot-starter-log4j2")
|
2024-06-02 15:44:43 +00:00
|
|
|
|
|
|
|
implementation("dev.usbharu:hideout-core:0.0.1")
|
|
|
|
|
|
|
|
implementation(libs.jackson.databind)
|
|
|
|
implementation(libs.jackson.module.kotlin)
|
|
|
|
implementation(libs.jakarta.annotation)
|
|
|
|
implementation(libs.jakarta.validation)
|
|
|
|
|
2024-06-07 11:44:12 +00:00
|
|
|
implementation(libs.bundles.exposed)
|
2024-06-02 15:44:43 +00:00
|
|
|
implementation(libs.bundles.openapi)
|
|
|
|
implementation(libs.bundles.coroutines)
|
2024-08-11 07:07:10 +00:00
|
|
|
|
|
|
|
testImplementation("org.springframework.boot:spring-boot-starter-test")
|
|
|
|
testImplementation(libs.kotlin.junit)
|
|
|
|
testImplementation(libs.coroutines.test)
|
|
|
|
testImplementation(libs.h2db)
|
2024-06-01 09:23:44 +00:00
|
|
|
}
|
|
|
|
|
2024-08-11 07:07:10 +00:00
|
|
|
|
2024-07-29 15:06:09 +00:00
|
|
|
tasks {
|
|
|
|
test {
|
|
|
|
useJUnitPlatform()
|
|
|
|
}
|
|
|
|
|
|
|
|
compileKotlin {
|
|
|
|
dependsOn("openApiGenerateMastodonCompatibleApi")
|
|
|
|
mustRunAfter("openApiGenerateMastodonCompatibleApi")
|
|
|
|
}
|
|
|
|
|
|
|
|
create<GenerateTask>("openApiGenerateMastodonCompatibleApi") {
|
|
|
|
generatorName.set("kotlin-spring")
|
|
|
|
inputSpec.set("$rootDir/src/main/resources/openapi/mastodon.yaml")
|
|
|
|
outputDir.set("$buildDir/generated/sources/mastodon")
|
|
|
|
apiPackage.set("dev.usbharu.hideout.mastodon.interfaces.api.generated")
|
|
|
|
modelPackage.set("dev.usbharu.hideout.mastodon.interfaces.api.generated.model")
|
|
|
|
configOptions.put("interfaceOnly", "true")
|
|
|
|
configOptions.put("useSpringBoot3", "true")
|
|
|
|
configOptions.put("reactive", "true")
|
|
|
|
configOptions.put("gradleBuildFile", "false")
|
|
|
|
configOptions.put("useSwaggerUI", "false")
|
|
|
|
configOptions.put("enumPropertyNaming", "UPPERCASE")
|
|
|
|
additionalProperties.put("useTags", "true")
|
|
|
|
|
|
|
|
importMappings.put("org.springframework.core.io.Resource", "org.springframework.web.multipart.MultipartFile")
|
|
|
|
typeMappings.put("org.springframework.core.io.Resource", "org.springframework.web.multipart.MultipartFile")
|
2024-08-12 04:28:03 +00:00
|
|
|
schemaMappings.put(
|
|
|
|
"StatusesRequest",
|
|
|
|
"dev.usbharu.hideout.mastodon.interfaces.api.StatusesRequest"
|
|
|
|
)
|
2024-07-29 15:06:09 +00:00
|
|
|
templateDir.set("$rootDir/templates")
|
|
|
|
}
|
2024-06-01 09:23:44 +00:00
|
|
|
}
|
2024-07-29 15:06:09 +00:00
|
|
|
|
2024-06-01 09:23:44 +00:00
|
|
|
kotlin {
|
|
|
|
jvmToolchain(21)
|
2024-06-02 15:44:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sourceSets.main {
|
|
|
|
kotlin.srcDirs(
|
|
|
|
"$buildDir/generated/sources/mastodon/src/main/kotlin"
|
|
|
|
)
|
|
|
|
}
|
2024-06-28 15:02:50 +00:00
|
|
|
|
2024-08-23 14:51:25 +00:00
|
|
|
detekt {
|
|
|
|
parallel = true
|
|
|
|
config.setFrom(files("../detekt.yml"))
|
|
|
|
buildUponDefaultConfig = true
|
|
|
|
basePath = "${rootDir.absolutePath}/src/main/kotlin"
|
|
|
|
autoCorrect = true
|
|
|
|
}
|
|
|
|
|
|
|
|
configurations.matching { it.name == "detekt" }.all {
|
|
|
|
resolutionStrategy.eachDependency {
|
|
|
|
if (requested.group == "org.jetbrains.kotlin") {
|
|
|
|
useVersion(io.gitlab.arturbosch.detekt.getSupportedKotlinVersion())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.withType<io.gitlab.arturbosch.detekt.Detekt> {
|
|
|
|
exclude("**/generated/**")
|
|
|
|
doFirst {
|
|
|
|
|
|
|
|
}
|
|
|
|
setSource("src/main/kotlin")
|
|
|
|
exclude("build/")
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.withType<io.gitlab.arturbosch.detekt.Detekt>().configureEach {
|
|
|
|
exclude("**/org/koin/ksp/generated/**", "**/generated/**")
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.withType<io.gitlab.arturbosch.detekt.DetektCreateBaselineTask>().configureEach {
|
|
|
|
exclude("**/org/koin/ksp/generated/**", "**/generated/**")
|
|
|
|
}
|