2024-09-14 13:20:23 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2024 usbharu
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2024-02-18 03:06:44 +00:00
|
|
|
import com.github.jk1.license.filter.DependencyFilter
|
|
|
|
import com.github.jk1.license.filter.LicenseBundleNormalizer
|
|
|
|
import com.github.jk1.license.importer.DependencyDataImporter
|
|
|
|
import com.github.jk1.license.importer.XmlReportImporter
|
|
|
|
import com.github.jk1.license.render.*
|
2024-09-15 14:11:29 +00:00
|
|
|
import kotlinx.kover.gradle.plugin.dsl.CoverageUnit
|
2024-06-14 16:56:06 +00:00
|
|
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
2023-04-30 21:38:30 +00:00
|
|
|
|
2023-03-24 03:58:12 +00:00
|
|
|
plugins {
|
2024-05-04 08:31:48 +00:00
|
|
|
alias(libs.plugins.kotlin.jvm)
|
|
|
|
alias(libs.plugins.detekt)
|
|
|
|
alias(libs.plugins.spring.boot)
|
|
|
|
alias(libs.plugins.kotlin.spring)
|
|
|
|
alias(libs.plugins.kover)
|
|
|
|
alias(libs.plugins.license.report)
|
2023-03-24 03:58:12 +00:00
|
|
|
}
|
|
|
|
|
2023-08-18 03:01:32 +00:00
|
|
|
apply {
|
|
|
|
plugin("io.spring.dependency-management")
|
|
|
|
}
|
|
|
|
|
2023-03-24 03:58:12 +00:00
|
|
|
group = "dev.usbharu"
|
|
|
|
version = "0.0.1"
|
|
|
|
|
2024-06-14 16:56:06 +00:00
|
|
|
kotlin {
|
|
|
|
jvmToolchain(21)
|
|
|
|
compilerOptions {
|
|
|
|
freeCompilerArgs.add("-Xjsr305=strict")
|
|
|
|
jvmTarget = JvmTarget.JVM_21
|
2023-08-18 03:01:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-30 21:38:30 +00:00
|
|
|
|
2023-03-24 03:58:12 +00:00
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
2023-10-19 02:30:07 +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")
|
|
|
|
}
|
|
|
|
}
|
2024-01-07 03:55:52 +00:00
|
|
|
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")
|
|
|
|
}
|
|
|
|
}
|
2023-03-24 03:58:12 +00:00
|
|
|
}
|
|
|
|
|
2023-05-04 02:48:39 +00:00
|
|
|
|
2024-09-15 14:11:29 +00:00
|
|
|
val os = org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.getCurrentOperatingSystem()
|
2024-02-04 06:07:32 +00:00
|
|
|
|
2023-03-24 03:58:12 +00:00
|
|
|
dependencies {
|
2024-05-20 06:53:47 +00:00
|
|
|
developmentOnly(libs.h2db)
|
2024-08-26 06:24:12 +00:00
|
|
|
developmentOnly("org.springframework.boot:spring-boot-devtools")
|
2024-05-04 08:31:48 +00:00
|
|
|
detektPlugins(libs.detekt.formatting)
|
|
|
|
|
|
|
|
implementation(libs.bundles.exposed)
|
|
|
|
implementation(libs.bundles.coroutines)
|
|
|
|
implementation(libs.bundles.ktor.client)
|
|
|
|
implementation(libs.bundles.apache.tika)
|
|
|
|
implementation(libs.bundles.openapi)
|
2024-08-10 10:38:36 +00:00
|
|
|
implementation(libs.bundles.owl.producer)
|
|
|
|
implementation(libs.bundles.owl.broker)
|
2024-05-04 08:31:48 +00:00
|
|
|
implementation(libs.bundles.spring.boot.oauth2)
|
|
|
|
implementation(libs.bundles.spring.boot.data.mongodb)
|
2023-09-22 08:32:47 +00:00
|
|
|
implementation("org.springframework.boot:spring-boot-starter-actuator")
|
2023-08-18 03:01:32 +00:00
|
|
|
implementation("org.springframework.boot:spring-boot-starter-web")
|
2023-08-28 12:05:34 +00:00
|
|
|
implementation("org.springframework.boot:spring-boot-starter-security")
|
2023-09-26 03:36:56 +00:00
|
|
|
implementation("org.springframework.boot:spring-boot-starter-thymeleaf")
|
2024-02-21 02:08:36 +00:00
|
|
|
implementation("org.springframework.boot:spring-boot-starter-validation")
|
2024-07-29 06:13:02 +00:00
|
|
|
annotationProcessor("org.springframework:spring-context-indexer")
|
2024-06-04 14:46:09 +00:00
|
|
|
|
2024-05-20 06:53:47 +00:00
|
|
|
implementation(libs.blurhash)
|
|
|
|
implementation(libs.aws.s3)
|
|
|
|
implementation(libs.jsoup)
|
|
|
|
implementation(libs.owasp.java.html.sanitizer)
|
|
|
|
implementation(libs.postgresql)
|
|
|
|
implementation(libs.imageio.webp)
|
|
|
|
implementation(libs.thumbnailator)
|
|
|
|
implementation(libs.flyway.core)
|
2024-06-04 14:46:09 +00:00
|
|
|
runtimeOnly(libs.flyway.postgresql)
|
2024-05-20 06:53:47 +00:00
|
|
|
|
2024-08-13 12:06:59 +00:00
|
|
|
implementation(libs.owl.common.serialize.jackson)
|
2024-05-04 08:31:48 +00:00
|
|
|
|
|
|
|
implementation(libs.javacv) {
|
2024-02-04 06:07:32 +00:00
|
|
|
exclude(module = "opencv")
|
|
|
|
exclude(module = "flycapture")
|
|
|
|
exclude(module = "artoolkitplus")
|
|
|
|
exclude(module = "libdc1394")
|
|
|
|
exclude(module = "librealsense")
|
|
|
|
exclude(module = "librealsense2")
|
|
|
|
exclude(module = "tesseract")
|
|
|
|
exclude(module = "libfreenect")
|
|
|
|
exclude(module = "libfreenect2")
|
|
|
|
}
|
|
|
|
if (os.isWindows) {
|
2024-05-04 08:31:48 +00:00
|
|
|
implementation(variantOf(libs.javacv.ffmpeg) { classifier("windows-x86_64") })
|
2024-02-16 11:01:37 +00:00
|
|
|
} else {
|
2024-05-04 08:31:48 +00:00
|
|
|
implementation(variantOf(libs.javacv.ffmpeg) { classifier("linux-x86_64") })
|
2024-02-04 06:07:32 +00:00
|
|
|
}
|
2023-11-02 02:56:03 +00:00
|
|
|
|
2024-08-13 12:06:59 +00:00
|
|
|
implementation(libs.http.signature)
|
|
|
|
implementation(libs.emoji.kt)
|
2024-09-07 04:30:46 +00:00
|
|
|
implementation(libs.logback.ecs.encoder)
|
2023-03-24 03:58:12 +00:00
|
|
|
|
2024-05-04 08:31:48 +00:00
|
|
|
testImplementation("org.springframework.boot:spring-boot-starter-test")
|
2024-06-14 16:56:06 +00:00
|
|
|
testImplementation(libs.kotlin.junit)
|
|
|
|
testImplementation(libs.coroutines.test)
|
2024-05-20 06:53:47 +00:00
|
|
|
testImplementation(libs.ktor.client.mock)
|
|
|
|
testImplementation(libs.h2db)
|
2024-08-13 12:06:59 +00:00
|
|
|
testImplementation(libs.mockito.kotlin)
|
2024-09-10 08:45:51 +00:00
|
|
|
testImplementation("org.assertj:assertj-db:2.0.2")
|
2024-09-10 09:55:55 +00:00
|
|
|
testImplementation("com.ninja-squad:DbSetup-kotlin:2.1.0")
|
2023-03-24 03:58:12 +00:00
|
|
|
}
|
2023-03-24 04:09:43 +00:00
|
|
|
|
2023-04-29 14:57:25 +00:00
|
|
|
detekt {
|
|
|
|
parallel = true
|
2024-08-13 12:09:31 +00:00
|
|
|
config.setFrom(files("../detekt.yml"))
|
2023-04-29 14:57:25 +00:00
|
|
|
buildUponDefaultConfig = true
|
2023-10-14 15:11:32 +00:00
|
|
|
basePath = "${rootDir.absolutePath}/src/main/kotlin"
|
2023-04-29 16:25:54 +00:00
|
|
|
autoCorrect = true
|
2023-04-29 14:57:25 +00:00
|
|
|
}
|
2023-05-05 03:41:04 +00:00
|
|
|
|
2024-09-07 04:27:02 +00:00
|
|
|
configurations {
|
|
|
|
matching { it.name == "detekt" }.all {
|
|
|
|
resolutionStrategy.eachDependency {
|
|
|
|
if (requested.group == "org.jetbrains.kotlin") {
|
|
|
|
useVersion(io.gitlab.arturbosch.detekt.getSupportedKotlinVersion())
|
|
|
|
}
|
2024-05-18 05:39:56 +00:00
|
|
|
}
|
|
|
|
}
|
2024-09-07 04:27:02 +00:00
|
|
|
all {
|
|
|
|
exclude("org.apache.logging.log4j", "log4j-slf4j2-impl")
|
|
|
|
}
|
2024-05-18 05:39:56 +00:00
|
|
|
}
|
|
|
|
|
2024-09-15 14:11:29 +00:00
|
|
|
tasks {
|
|
|
|
withType<io.gitlab.arturbosch.detekt.Detekt> {
|
|
|
|
exclude("**/generated/**")
|
|
|
|
setSource("src/main/kotlin")
|
|
|
|
exclude("build/")
|
|
|
|
configureEach {
|
|
|
|
exclude("**/org/koin/ksp/generated/**", "**/generated/**")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
withType<io.gitlab.arturbosch.detekt.DetektCreateBaselineTask>() {
|
|
|
|
configureEach {
|
|
|
|
exclude("**/org/koin/ksp/generated/**", "**/generated/**")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
withType<Test> {
|
|
|
|
useJUnitPlatform()
|
|
|
|
doFirst {
|
|
|
|
jvmArgs = arrayOf(
|
|
|
|
"--add-opens",
|
|
|
|
"java.base/java.lang=ALL-UNNAMED",
|
|
|
|
"--add-opens",
|
|
|
|
"java.base/java.util=ALL-UNNAMED",
|
|
|
|
"--add-opens",
|
|
|
|
"java.naming/javax.naming=ALL-UNNAMED",
|
|
|
|
"--add-opens",
|
|
|
|
"java.base/java.util.concurrent.locks=ALL-UNNAMED"
|
|
|
|
).toMutableList()
|
|
|
|
}
|
2023-10-14 15:11:32 +00:00
|
|
|
}
|
2023-05-05 03:41:04 +00:00
|
|
|
}
|
|
|
|
|
2023-09-19 07:21:35 +00:00
|
|
|
|
2023-11-06 14:59:17 +00:00
|
|
|
project.gradle.taskGraph.whenReady {
|
|
|
|
if (this.hasTask(":koverGenerateArtifact")) {
|
|
|
|
val task = this.allTasks.find { it.name == "test" }
|
|
|
|
val verificationTask = task as VerificationTask
|
|
|
|
verificationTask.ignoreFailures = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-11-06 08:49:34 +00:00
|
|
|
kover {
|
2024-05-18 07:18:54 +00:00
|
|
|
currentProject {
|
|
|
|
sources {
|
2024-09-15 14:01:42 +00:00
|
|
|
|
2024-05-18 07:18:54 +00:00
|
|
|
|
|
|
|
}
|
2023-11-06 08:49:34 +00:00
|
|
|
}
|
|
|
|
|
2024-05-18 07:18:54 +00:00
|
|
|
reports {
|
2024-09-15 14:11:29 +00:00
|
|
|
verify {
|
|
|
|
rule {
|
2024-09-16 13:34:24 +00:00
|
|
|
bound {
|
2024-09-15 14:11:29 +00:00
|
|
|
minValue = 50
|
|
|
|
coverageUnits = CoverageUnit.INSTRUCTION
|
|
|
|
}
|
2024-09-15 14:01:42 +00:00
|
|
|
}
|
|
|
|
}
|
2024-09-16 13:34:24 +00:00
|
|
|
total {
|
|
|
|
xml {
|
|
|
|
xmlFile = file("$buildDir/reports/kover/hideout-core.xml")
|
|
|
|
}
|
|
|
|
}
|
2024-05-18 07:18:54 +00:00
|
|
|
filters {
|
|
|
|
excludes {
|
|
|
|
annotatedBy("org.springframework.context.annotation.Configuration")
|
|
|
|
annotatedBy("org.springframework.boot.context.properties.ConfigurationProperties")
|
|
|
|
packages(
|
|
|
|
"dev.usbharu.hideout.controller.mastodon.generated",
|
|
|
|
"dev.usbharu.hideout.domain.mastodon.model.generated"
|
|
|
|
)
|
|
|
|
packages("org.springframework")
|
|
|
|
packages("org.jetbrains")
|
|
|
|
}
|
2023-11-06 08:49:34 +00:00
|
|
|
}
|
2024-09-16 13:34:24 +00:00
|
|
|
|
2023-11-06 08:49:34 +00:00
|
|
|
}
|
|
|
|
}
|
2024-01-16 05:42:29 +00:00
|
|
|
|
|
|
|
springBoot {
|
2024-06-14 16:56:06 +00:00
|
|
|
buildInfo {
|
|
|
|
|
|
|
|
}
|
2024-01-16 05:42:29 +00:00
|
|
|
}
|
2024-02-18 03:06:44 +00:00
|
|
|
|
|
|
|
licenseReport {
|
|
|
|
excludeOwnGroup = true
|
|
|
|
|
|
|
|
importers = arrayOf<DependencyDataImporter>(XmlReportImporter("hideout", File("$projectDir/license-list.xml")))
|
|
|
|
renderers = arrayOf<ReportRenderer>(
|
2024-09-15 14:11:29 +00:00
|
|
|
InventoryHtmlReportRenderer(), CsvReportRenderer(), JsonReportRenderer(), XmlReportRenderer()
|
2024-02-18 03:06:44 +00:00
|
|
|
)
|
|
|
|
filters = arrayOf<DependencyFilter>(LicenseBundleNormalizer("$projectDir/license-normalizer-bundle.json", true))
|
|
|
|
allowedLicensesFile = File("$projectDir/allowed-licenses.json")
|
|
|
|
configurations = arrayOf("productionRuntimeClasspath")
|
|
|
|
}
|