From 73451a19180337fbd5579987bf30dfcef4645c1f Mon Sep 17 00:00:00 2001 From: usbharu Date: Thu, 19 Dec 2024 18:19:35 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=9E=E3=83=AB=E3=83=81=E3=83=97=E3=83=AD?= =?UTF-8?q?=E3=82=B8=E3=82=A7=E3=82=AF=E3=83=88=E6=A7=8B=E6=88=90=E3=81=AB?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- build.gradle.kts | 48 ---------------- hideout/build.gradle.kts | 55 +++++++++++++++++- hideout/hideout-activitypub/build.gradle.kts | 60 +------------------- hideout/hideout-core/build.gradle.kts | 44 -------------- hideout/hideout-mastodon/build.gradle.kts | 48 +--------------- 6 files changed, 57 insertions(+), 200 deletions(-) diff --git a/.gitignore b/.gitignore index 99c1c155..2c27afd4 100644 --- a/.gitignore +++ b/.gitignore @@ -49,6 +49,6 @@ out/ /hideout-core/.kotlin/sessions/ /hideout-mastodon/.kotlin/sessions/ /http-client.private.env.json -/logs/ +**/logs/ /hideout-mastodon/logs/ /hideout-mastodon/files/ diff --git a/build.gradle.kts b/build.gradle.kts index ee19d44a..150eda75 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -14,52 +14,4 @@ * limitations under the License. */ -plugins { - alias(libs.plugins.kotlin.jvm) - alias(libs.plugins.spring.boot) - alias(libs.plugins.kotlin.spring) -} - -apply { - plugin("io.spring.dependency-management") -} - -repositories { - mavenCentral() - 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") - } - } -} - -dependencies { - implementation("dev.usbharu:hideout-core:0.0.1") - implementation("dev.usbharu:hideout-mastodon:1.0-SNAPSHOT") - implementation("dev.usbharu:hideout-activitypub:1.0-SNAPSHOT") -} - -tasks.register("run") { - dependsOn(gradle.includedBuild("hideout-core").task(":run")) -} - -springBoot { - mainClass = "dev.usbharu.hideout.SpringApplicationKt" -} diff --git a/hideout/build.gradle.kts b/hideout/build.gradle.kts index 237ba8be..6b2fb989 100644 --- a/hideout/build.gradle.kts +++ b/hideout/build.gradle.kts @@ -2,6 +2,7 @@ plugins { alias(libs.plugins.kotlin.jvm) alias(libs.plugins.spring.boot) alias(libs.plugins.kotlin.spring) + alias(libs.plugins.detekt) } apply { @@ -9,10 +10,13 @@ apply { } -group = "dev.usbharu.hideout" -version = "unspecified" + allprojects { + + group = "dev.usbharu.hideout" + version = "1.0.0-SNAPSHOT" + repositories { mavenCentral() maven { @@ -39,10 +43,39 @@ allprojects { } } +subprojects { + apply { + plugin(rootProject.libs.plugins.kotlin.jvm.get().pluginId) + plugin(rootProject.libs.plugins.detekt.get().pluginId) + } + + dependencies { + testImplementation(kotlin("test")) + detektPlugins(rootProject.libs.detekt.formatting) + } +} + tasks { register("run") { dependsOn(gradle.includedBuild("hideout-core").task(":run")) } + withType { + exclude("**/generated/**") + setSource("src/main/kotlin") + exclude("build/") + configureEach { + exclude("**/org/koin/ksp/generated/**", "**/generated/**") + } + } + withType() { + configureEach { + exclude("**/org/koin/ksp/generated/**", "**/generated/**") + } + } + + kotlin { + jvmToolchain(21) + } } dependencies { @@ -55,4 +88,22 @@ springBoot { buildInfo { } mainClass = "dev.usbharu.hideout.SpringApplicationKt" +} + +configurations { + matching { it.name == "detekt" }.all { + resolutionStrategy.eachDependency { + if (requested.group == "org.jetbrains.kotlin") { + useVersion(io.gitlab.arturbosch.detekt.getSupportedKotlinVersion()) + } + } + } +} + +detekt { + parallel = true + config.setFrom(files("../detekt.yml")) + buildUponDefaultConfig = true + basePath = "${rootDir.absolutePath}/src/main/kotlin" + autoCorrect = true } \ No newline at end of file diff --git a/hideout/hideout-activitypub/build.gradle.kts b/hideout/hideout-activitypub/build.gradle.kts index 219cda28..4cd3df85 100644 --- a/hideout/hideout-activitypub/build.gradle.kts +++ b/hideout/hideout-activitypub/build.gradle.kts @@ -2,79 +2,23 @@ import kotlinx.kover.gradle.plugin.dsl.CoverageUnit plugins { alias(libs.plugins.kotlin.jvm) - alias(libs.plugins.detekt) alias(libs.plugins.kover) } -group = "dev.usbharu" -version = "1.0-SNAPSHOT" -repositories { - mavenCentral() -} - -dependencies { - testImplementation(kotlin("test")) - detektPlugins(libs.detekt.formatting) -} tasks.test { useJUnitPlatform() } -kotlin { - jvmToolchain(21) -} -configurations { - matching { it.name == "detekt" }.all { - resolutionStrategy.eachDependency { - if (requested.group == "org.jetbrains.kotlin") { - useVersion(io.gitlab.arturbosch.detekt.getSupportedKotlinVersion()) - } - } - } - all { - exclude("org.apache.logging.log4j", "log4j-slf4j2-impl") - } -} - tasks { - withType { - exclude("**/generated/**") - setSource("src/main/kotlin") - exclude("build/") - configureEach { - exclude("**/org/koin/ksp/generated/**", "**/generated/**") - } - } - withType() { - configureEach { - exclude("**/org/koin/ksp/generated/**", "**/generated/**") - } - } - withType { + +withType { useJUnitPlatform() } } - -project.gradle.taskGraph.whenReady { - if (this.hasTask(":koverGenerateArtifact")) { - val task = this.allTasks.find { it.name == "test" } - val verificationTask = task as VerificationTask - verificationTask.ignoreFailures = true - } -} - -detekt { - parallel = true - config.setFrom(files("../detekt.yml")) - buildUponDefaultConfig = true - basePath = "${rootDir.absolutePath}/src/main/kotlin" - autoCorrect = true -} - kover { currentProject { sources { diff --git a/hideout/hideout-core/build.gradle.kts b/hideout/hideout-core/build.gradle.kts index de74dd36..61438864 100644 --- a/hideout/hideout-core/build.gradle.kts +++ b/hideout/hideout-core/build.gradle.kts @@ -35,11 +35,8 @@ apply { plugin("io.spring.dependency-management") } -group = "dev.usbharu" -version = "0.0.1" kotlin { - jvmToolchain(21) compilerOptions { freeCompilerArgs.add("-Xjsr305=strict") jvmTarget = JvmTarget.JVM_21 @@ -119,41 +116,13 @@ dependencies { testImplementation("com.ninja-squad:DbSetup-kotlin:2.1.0") } -detekt { - parallel = true - config.setFrom(files("$rootDir/../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()) - } - } - } all { exclude("org.apache.logging.log4j", "log4j-slf4j2-impl") } } tasks { - withType { - exclude("**/generated/**") - setSource("src/main/kotlin") - exclude("build/") - configureEach { - exclude("**/org/koin/ksp/generated/**", "**/generated/**") - } - } - withType() { - configureEach { - exclude("**/org/koin/ksp/generated/**", "**/generated/**") - } - } withType { useJUnitPlatform() doFirst { @@ -172,13 +141,6 @@ tasks { } -project.gradle.taskGraph.whenReady { - if (this.hasTask(":koverGenerateArtifact")) { - val task = this.allTasks.find { it.name == "test" } - val verificationTask = task as VerificationTask - verificationTask.ignoreFailures = true - } -} kover { currentProject { @@ -219,12 +181,6 @@ kover { } } -springBoot { - buildInfo { - - } -} - licenseReport { excludeOwnGroup = true diff --git a/hideout/hideout-mastodon/build.gradle.kts b/hideout/hideout-mastodon/build.gradle.kts index 0b0dd391..af5f950e 100644 --- a/hideout/hideout-mastodon/build.gradle.kts +++ b/hideout/hideout-mastodon/build.gradle.kts @@ -15,8 +15,6 @@ apply { plugin("io.spring.dependency-management") } -group = "dev.usbharu" -version = "1.0-SNAPSHOT" dependencies { detektPlugins(libs.detekt.formatting) @@ -24,7 +22,7 @@ dependencies { implementation("org.springframework.boot:spring-boot-starter-security") implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310") - implementation("dev.usbharu:hideout-core:0.0.1") + implementation(project(":hideout-core")) implementation(libs.jackson.databind) implementation(libs.jackson.module.kotlin) @@ -81,9 +79,6 @@ tasks { } } -kotlin { - jvmToolchain(21) -} sourceSets.main { kotlin.srcDirs( @@ -91,30 +86,6 @@ sourceSets.main { ) } -detekt { - parallel = true - config.setFrom(files("$rootDir/../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()) - } - } -} - -project.gradle.taskGraph.whenReady { - if (this.hasTask(":koverGenerateArtifact")) { - val task = this.allTasks.find { it.name == "test" } - val verificationTask = task as VerificationTask - verificationTask.ignoreFailures = true - } -} - kover { currentProject { sources { @@ -153,20 +124,3 @@ kover { } } - -tasks.withType { - exclude("**/generated/**") - doFirst { - - } - setSource("src/main/kotlin") - exclude("build/") -} - -tasks.withType().configureEach { - exclude("**/org/koin/ksp/generated/**", "**/generated/**") -} - -tasks.withType().configureEach { - exclude("**/org/koin/ksp/generated/**", "**/generated/**") -} \ No newline at end of file