diff --git a/.idea/gradle.xml b/.idea/gradle.xml index f4bb361..cbf7a5a 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -22,7 +22,6 @@ diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml index f8467b4..e805548 100644 --- a/.idea/kotlinc.xml +++ b/.idea/kotlinc.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/backend/src/main/kotlin/jp/skypencil/kosmo/backend/storage/onmemory/OnMemoryDatabase.kt b/backend/src/main/kotlin/jp/skypencil/kosmo/backend/storage/onmemory/OnMemoryDatabase.kt index 2318313..bd1fbb9 100644 --- a/backend/src/main/kotlin/jp/skypencil/kosmo/backend/storage/onmemory/OnMemoryDatabase.kt +++ b/backend/src/main/kotlin/jp/skypencil/kosmo/backend/storage/onmemory/OnMemoryDatabase.kt @@ -2,7 +2,9 @@ package jp.skypencil.kosmo.backend.storage.onmemory import jp.skypencil.kosmo.backend.storage.shared.Table import jp.skypencil.kosmo.backend.storage.shared.Database +import org.koin.core.annotation.Singleton +@Singleton class OnMemoryDatabase : Database { private val tables = mutableMapOf() override suspend fun findTable(name: String): Table = diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 15f9044..10ce082 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -9,5 +9,6 @@ repositories { dependencies { implementation("com.diffplug.spotless:spotless-plugin-gradle:6.22.0") - implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.10") + implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20") + implementation("com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:1.9.20-1.0.14") } diff --git a/buildSrc/src/main/kotlin/jp.skypencil.kosmo.kotlin-application-conventions.gradle.kts b/buildSrc/src/main/kotlin/jp.skypencil.kosmo.kotlin-application-conventions.gradle.kts index 7aa3ff2..ed31bde 100644 --- a/buildSrc/src/main/kotlin/jp.skypencil.kosmo.kotlin-application-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/jp.skypencil.kosmo.kotlin-application-conventions.gradle.kts @@ -1,5 +1,4 @@ plugins { id("jp.skypencil.kosmo.kotlin-common-conventions") - application } diff --git a/buildSrc/src/main/kotlin/jp.skypencil.kosmo.kotlin-common-conventions.gradle.kts b/buildSrc/src/main/kotlin/jp.skypencil.kosmo.kotlin-common-conventions.gradle.kts index a653dff..a5a002f 100644 --- a/buildSrc/src/main/kotlin/jp.skypencil.kosmo.kotlin-common-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/jp.skypencil.kosmo.kotlin-common-conventions.gradle.kts @@ -1,6 +1,12 @@ plugins { id("org.jetbrains.kotlin.jvm") id("com.diffplug.spotless") + id("com.google.devtools.ksp") +} + +sourceSets.main { + // KSP - To use generated sources + java.srcDirs("build/generated/ksp/main/kotlin") } repositories { @@ -14,7 +20,12 @@ java { } val kotest = "5.8.0" +val koin = "3.5.0" +val koinKsp = "1.3.0" dependencies { + implementation("io.insert-koin:koin-core:$koin") + compileOnly("io.insert-koin:koin-annotations:$koinKsp") + ksp("io.insert-koin:koin-ksp-compiler:$koinKsp") testImplementation("io.kotest:kotest-assertions-core:$kotest") testImplementation("io.kotest:kotest-property:$kotest") testRuntimeOnly("io.kotest:kotest-runner-junit5:$kotest") diff --git a/frontend/build.gradle.kts b/frontend/build.gradle.kts deleted file mode 100644 index b8e4637..0000000 --- a/frontend/build.gradle.kts +++ /dev/null @@ -1,3 +0,0 @@ -plugins { - id("jp.skypencil.kosmo.kotlin-application-conventions") -} diff --git a/frontend/src/main/kotlin/jp/skypencil/kosmo/list/LinkedList.kt b/frontend/src/main/kotlin/jp/skypencil/kosmo/list/LinkedList.kt deleted file mode 100644 index 5781e6c..0000000 --- a/frontend/src/main/kotlin/jp/skypencil/kosmo/list/LinkedList.kt +++ /dev/null @@ -1,86 +0,0 @@ -/* - * This Kotlin source file was generated by the Gradle 'init' task. - */ -package jp.skypencil.kosmo.list - -class LinkedList { - private var head: Node? = null - - fun add(element: String) { - val newNode = Node(element) - - val it = tail(head) - if (it == null) { - head = newNode - } else { - it.next = newNode - } - } - - private fun tail(head: Node?): Node? { - var it: Node? - - it = head - while (it?.next != null) { - it = it.next - } - - return it - } - - fun remove(element: String): Boolean { - var result = false - var previousIt: Node? = null - var it: Node? = head - while (!result && it != null) { - if (0 == element.compareTo(it.data)) { - result = true - unlink(previousIt, it) - break - } - previousIt = it - it = it.next - } - - return result - } - - private fun unlink(previousIt: Node?, currentIt: Node) { - if (currentIt == head) { - head = currentIt.next - } else { - previousIt?.next = currentIt.next - } - } - - fun size(): Int { - var size = 0 - - var it = head - while (it != null) { - ++size - it = it.next - } - - return size - } - - fun get(idx: Int): String { - var index = idx - var it = head - while (index > 0 && it != null) { - it = it.next - index-- - } - - if (it == null) { - throw IndexOutOfBoundsException("Index is out of range") - } - - return it.data - } - - private data class Node(val data: String) { - var next: Node? = null - } -} diff --git a/settings.gradle.kts b/settings.gradle.kts index ed45956..47d533e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -3,4 +3,4 @@ plugins { } rootProject.name = "kosmo" -include("backend", "frontend") +include("backend")