マルチプロジェクト構成に変更

This commit is contained in:
usbharu 2024-12-19 18:19:35 +09:00
parent 4216beaf8a
commit 73451a1918
Signed by: usbharu
GPG Key ID: 95CBCF7046307B77
6 changed files with 57 additions and 200 deletions

2
.gitignore vendored
View File

@ -49,6 +49,6 @@ out/
/hideout-core/.kotlin/sessions/ /hideout-core/.kotlin/sessions/
/hideout-mastodon/.kotlin/sessions/ /hideout-mastodon/.kotlin/sessions/
/http-client.private.env.json /http-client.private.env.json
/logs/ **/logs/
/hideout-mastodon/logs/ /hideout-mastodon/logs/
/hideout-mastodon/files/ /hideout-mastodon/files/

View File

@ -14,52 +14,4 @@
* limitations under the License. * 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"
}

View File

@ -2,6 +2,7 @@ plugins {
alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.spring.boot) alias(libs.plugins.spring.boot)
alias(libs.plugins.kotlin.spring) alias(libs.plugins.kotlin.spring)
alias(libs.plugins.detekt)
} }
apply { apply {
@ -9,10 +10,13 @@ apply {
} }
group = "dev.usbharu.hideout"
version = "unspecified"
allprojects { allprojects {
group = "dev.usbharu.hideout"
version = "1.0.0-SNAPSHOT"
repositories { repositories {
mavenCentral() mavenCentral()
maven { 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 { tasks {
register("run") { register("run") {
dependsOn(gradle.includedBuild("hideout-core").task(":run")) dependsOn(gradle.includedBuild("hideout-core").task(":run"))
} }
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/**")
}
}
kotlin {
jvmToolchain(21)
}
} }
dependencies { dependencies {
@ -55,4 +88,22 @@ springBoot {
buildInfo { } buildInfo { }
mainClass = "dev.usbharu.hideout.SpringApplicationKt" 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
} }

View File

@ -2,79 +2,23 @@ import kotlinx.kover.gradle.plugin.dsl.CoverageUnit
plugins { plugins {
alias(libs.plugins.kotlin.jvm) alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.detekt)
alias(libs.plugins.kover) alias(libs.plugins.kover)
} }
group = "dev.usbharu"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
}
dependencies {
testImplementation(kotlin("test"))
detektPlugins(libs.detekt.formatting)
}
tasks.test { tasks.test {
useJUnitPlatform() 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 { tasks {
withType<io.gitlab.arturbosch.detekt.Detekt> {
exclude("**/generated/**") withType<Test> {
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() 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 { kover {
currentProject { currentProject {
sources { sources {

View File

@ -35,11 +35,8 @@ apply {
plugin("io.spring.dependency-management") plugin("io.spring.dependency-management")
} }
group = "dev.usbharu"
version = "0.0.1"
kotlin { kotlin {
jvmToolchain(21)
compilerOptions { compilerOptions {
freeCompilerArgs.add("-Xjsr305=strict") freeCompilerArgs.add("-Xjsr305=strict")
jvmTarget = JvmTarget.JVM_21 jvmTarget = JvmTarget.JVM_21
@ -119,41 +116,13 @@ dependencies {
testImplementation("com.ninja-squad:DbSetup-kotlin:2.1.0") 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 { configurations {
matching { it.name == "detekt" }.all {
resolutionStrategy.eachDependency {
if (requested.group == "org.jetbrains.kotlin") {
useVersion(io.gitlab.arturbosch.detekt.getSupportedKotlinVersion())
}
}
}
all { all {
exclude("org.apache.logging.log4j", "log4j-slf4j2-impl") exclude("org.apache.logging.log4j", "log4j-slf4j2-impl")
} }
} }
tasks { 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> { withType<Test> {
useJUnitPlatform() useJUnitPlatform()
doFirst { 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 { kover {
currentProject { currentProject {
@ -219,12 +181,6 @@ kover {
} }
} }
springBoot {
buildInfo {
}
}
licenseReport { licenseReport {
excludeOwnGroup = true excludeOwnGroup = true

View File

@ -15,8 +15,6 @@ apply {
plugin("io.spring.dependency-management") plugin("io.spring.dependency-management")
} }
group = "dev.usbharu"
version = "1.0-SNAPSHOT"
dependencies { dependencies {
detektPlugins(libs.detekt.formatting) detektPlugins(libs.detekt.formatting)
@ -24,7 +22,7 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-security") implementation("org.springframework.boot:spring-boot-starter-security")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310") 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.databind)
implementation(libs.jackson.module.kotlin) implementation(libs.jackson.module.kotlin)
@ -81,9 +79,6 @@ tasks {
} }
} }
kotlin {
jvmToolchain(21)
}
sourceSets.main { sourceSets.main {
kotlin.srcDirs( 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 { kover {
currentProject { currentProject {
sources { sources {
@ -153,20 +124,3 @@ kover {
} }
} }
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/**")
}