Skip to content

Commit

Permalink
Update dependencies (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
gchristov authored Nov 26, 2023
1 parent fa6a928 commit 4a007bf
Show file tree
Hide file tree
Showing 23 changed files with 656 additions and 699 deletions.
4 changes: 3 additions & 1 deletion backend/appBackend/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation(projects.commonFirebaseData)
implementation(projects.search)
implementation(projects.slack)
implementation(projects.monitoringData)
implementation(projects.htmlParseData)
}
}
val jsMain by getting {
Expand All @@ -33,7 +35,7 @@ kotlin {
tasks.named("assemble") {
doLast {
copy {
from(file("$buildDir/productionLibrary"))
from(file("${layout.buildDirectory}/productionLibrary"))
into(file("$rootDir/build/bin"))
}
copy {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.gchristov.thecodinglove

import arrow.core.Either
import arrow.core.flatMap
import arrow.core.raise.either
import arrow.core.sequence
import co.touchlab.kermit.Logger
import com.gchristov.thecodinglove.commonfirebasedata.CommonFirebaseDataModule
Expand Down Expand Up @@ -78,7 +79,7 @@ private fun setupMonitoring(): Either<Throwable, Unit> {
*/
private suspend fun setupServices(): Either<Throwable, List<HttpService>> {
val appService = setupAppService()
return listOf(appService).sequence()
return listOf(appService).let { l -> either { l.bindAll() } }
}

/**
Expand Down Expand Up @@ -108,5 +109,5 @@ private suspend fun setupAppService(): Either<Throwable, HttpService> {

private suspend fun startServices(services: List<HttpService>): Either<Throwable, Unit> = services
.map { it.start() }
.sequence()
.let { l -> either { l.bindAll() } }
.flatMap { Either.Right(Unit) }
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.gchristov.thecodinglove.commonservice.http

import arrow.core.Either
import arrow.core.flatMap
import arrow.core.raise.either
import arrow.core.sequence
import co.touchlab.kermit.Logger
import com.gchristov.thecodinglove.commonkotlin.__dirname
Expand Down Expand Up @@ -41,7 +42,7 @@ internal class ExpressHttpService(
handler.attach(app)
}
}
.sequence()
.let { l -> either { l.bindAll() } }
.flatMap {
log.debug(tag, "Initialised")
Either.Right(Unit)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.gchristov.thecodinglove.commonservice.pubsub

import arrow.core.Either
import arrow.core.flatMap
import arrow.core.leftIfNull
import arrow.core.*
import com.gchristov.thecodinglove.commonkotlin.JsonSerializer
import com.gchristov.thecodinglove.commonservicedata.http.HttpRequest
import com.gchristov.thecodinglove.commonservicedata.pubsub.PubSubDecoder
Expand All @@ -15,6 +13,6 @@ internal class GoogleCloudPubSubDecoder(private val jsonSerializer: JsonSerializ
jsonSerializer = jsonSerializer,
strategy = GoogleCloudPubSubRequestBody.serializer(),
)
.leftIfNull { Exception("Request body is invalid") }
.flatMap { it?.right() ?: Exception("Request body is invalid").left<Throwable>() }
.flatMap { it.toPubSubRequest() }
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ private class TestCommonWriter : LogWriter() {
tag: String,
throwable: Throwable?
) {
println(commonLogger.formatMessage(severity, message, tag, throwable))
throwable?.let { println(it.message) }
commonLogger.log(severity, message, tag, throwable)
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.gchristov.thecodinglove.search

import arrow.core.Either
import arrow.core.flatMap
import arrow.core.leftIfNull
import arrow.core.*
import co.touchlab.kermit.Logger
import com.gchristov.thecodinglove.commonkotlin.JsonSerializer
import com.gchristov.thecodinglove.commonservice.pubsub.BasePubSubHandler
Expand Down Expand Up @@ -47,6 +45,6 @@ class PreloadSearchPubSubHandler(
jsonSerializer = jsonSerializer,
strategy = PreloadSearchPubSubMessage.serializer(),
)
.leftIfNull { Exception("Request body is invalid") }
.flatMap { it?.right() ?: Exception("Request body is invalid").left<Throwable>() }
.flatMap { preloadSearchResultUseCase(searchSessionId = it.searchSessionId) }
}
1 change: 1 addition & 0 deletions backend/slack-data/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation(projects.commonFirebaseData)
implementation(projects.commonServiceData)
implementation(projects.searchData)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.gchristov.thecodinglove.slackdata.usecase

import arrow.core.Either
import arrow.core.raise.either
import arrow.core.sequence
import co.touchlab.kermit.Logger
import com.gchristov.thecodinglove.commonkotlin.debug
Expand Down Expand Up @@ -31,7 +32,7 @@ class RealSlackRevokeTokensUseCase(
log.debug(tag, "Deleting token: id=$it")
slackRepository.deleteAuthToken(it)
}
.sequence()
.let { l -> either { l.bindAll() } }
.map {}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.gchristov.thecodinglove.slack

import arrow.core.Either
import arrow.core.flatMap
import arrow.core.leftIfNull
import arrow.core.*
import co.touchlab.kermit.Logger
import com.gchristov.thecodinglove.commonservice.BaseHttpHandler
import com.gchristov.thecodinglove.commonservicedata.http.*
Expand Down Expand Up @@ -48,7 +46,7 @@ class SlackEventHttpHandler(
strategy = ApiSlackEvent.serializer(),
)
}
.leftIfNull { Exception("Request body is invalid") }
.flatMap { it?.right() ?: Exception("Request body is invalid").left<Throwable>() }
.flatMap {
when (val event = it.toEvent()) {
is SlackEvent.UrlVerification -> event.handle(response)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.gchristov.thecodinglove.slack.interactivity

import arrow.core.Either
import arrow.core.flatMap
import arrow.core.leftIfNull
import arrow.core.*
import co.touchlab.kermit.Logger
import com.gchristov.thecodinglove.commonservice.BaseHttpHandler
import com.gchristov.thecodinglove.commonservicedata.http.HttpHandler
Expand Down Expand Up @@ -51,7 +49,7 @@ class SlackInteractivityHttpHandler(
strategy = ApiSlackInteractivity.serializer(),
)
}
.leftIfNull(default = { Exception("Request body is invalid") })
.flatMap { it?.right() ?: Exception("Request body is invalid").left<Throwable>() }
.flatMap { publishInteractivityMessage(it) }
.flatMap { response.sendEmpty() }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.gchristov.thecodinglove.slack.interactivity

import arrow.core.Either
import arrow.core.flatMap
import arrow.core.leftIfNull
import arrow.core.*
import co.touchlab.kermit.Logger
import com.gchristov.thecodinglove.commonkotlin.JsonSerializer
import com.gchristov.thecodinglove.commonkotlin.error
Expand Down Expand Up @@ -55,7 +53,7 @@ class SlackInteractivityPubSubHandler(
jsonSerializer = jsonSerializer,
strategy = SlackInteractivityPubSubMessage.serializer(),
)
.leftIfNull { Exception("Request body is invalid") }
.flatMap { it?.right() ?: Exception("Request body is invalid").left<Throwable>() }
.flatMap {
when (it.payload) {
is SlackInteractivityPubSubMessage.InteractivityPayload.InteractiveMessage ->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.gchristov.thecodinglove.slack.slashcommand

import arrow.core.Either
import arrow.core.flatMap
import arrow.core.leftIfNull
import arrow.core.*
import co.touchlab.kermit.Logger
import com.gchristov.thecodinglove.commonservice.BaseHttpHandler
import com.gchristov.thecodinglove.commonservicedata.http.HttpHandler
Expand Down Expand Up @@ -51,7 +49,7 @@ class SlackSlashCommandHttpHandler(
strategy = ApiSlackSlashCommand.serializer(),
)
}
.leftIfNull(default = { Exception("Request body is invalid") })
.flatMap { it?.right() ?: Exception("Request body is invalid").left<Throwable>() }
.flatMap { publishSlashCommandMessage(it) }
.flatMap { response.sendEmpty() }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.gchristov.thecodinglove.slack.slashcommand

import arrow.core.Either
import arrow.core.flatMap
import arrow.core.leftIfNull
import arrow.core.*
import co.touchlab.kermit.Logger
import com.gchristov.thecodinglove.commonkotlin.JsonSerializer
import com.gchristov.thecodinglove.commonkotlin.error
Expand Down Expand Up @@ -54,7 +52,7 @@ class SlackSlashCommandPubSubHandler(
jsonSerializer = jsonSerializer,
strategy = SlackSlashCommandPubSubMessage.serializer(),
)
.leftIfNull { Exception("Request body is invalid") }
.flatMap { it?.right() ?: Exception("Request body is invalid").left<Throwable>() }
.flatMap { it.handle() }

private suspend fun SlackSlashCommandPubSubMessage.handle() = slackRepository.postMessageToUrl(
Expand Down
2 changes: 1 addition & 1 deletion client/appWeb/appWeb/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
tasks.named("assemble") {
doLast {
copy {
from(file("$buildDir/distributions"))
from(file("${layout.buildDirectory}/distributions"))
into(file("$rootDir/build/bin/web"))
}
}
Expand Down
14 changes: 6 additions & 8 deletions gradle-plugins/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@ gradlePlugin {
}
plugins.register("backend-executable-plugin") {
id = "backend-executable-plugin"
implementationClass =
"com.gchristov.thecodinglove.gradleplugins.backend.BackendExecutablePlugin"
implementationClass = "com.gchristov.thecodinglove.gradleplugins.backend.BackendExecutablePlugin"
}
plugins.register("backend-service-plugin") {
id = "backend-service-plugin"
implementationClass =
"com.gchristov.thecodinglove.gradleplugins.backend.BackendServicePlugin"
implementationClass = "com.gchristov.thecodinglove.gradleplugins.backend.BackendServicePlugin"
}
}

Expand All @@ -40,8 +38,8 @@ repositories {
}

dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.21")
implementation("org.jetbrains.kotlin:kotlin-serialization:1.8.21")
implementation("dev.petuska:npm-publish-gradle-plugin:3.3.1")
implementation("com.codingfeline.buildkonfig:buildkonfig-gradle-plugin:0.7.0")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.21")
implementation("org.jetbrains.kotlin:kotlin-serialization:1.9.21")
implementation("dev.petuska:npm-publish-gradle-plugin:3.4.1")
implementation("com.codingfeline.buildkonfig:buildkonfig-gradle-plugin:0.15.0")
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,59 +3,55 @@ package com.gchristov.thecodinglove.gradleplugins
@Suppress("unused")
class Deps {
object Arrow {
const val core = "io.arrow-kt:arrow-core:1.1.3"
const val core = "io.arrow-kt:arrow-core:1.2.1"
}

object Crypto {
const val mac = "com.diglol.crypto:mac:0.1.3"
const val encoding = "com.diglol.encoding:encoding:0.1.0"
const val mac = "com.diglol.crypto:mac:0.1.5"
const val encoding = "com.diglol.encoding:encoding:0.3.0"
}

object Google {
val firebaseAdmin = NpmDependency("firebase-admin", "11.11.0")
val pubSub = NpmDependency("@google-cloud/pubsub", "3.7.1")
val firebaseAdmin = NpmDependency("firebase-admin", "11.11.1")
val pubSub = NpmDependency("@google-cloud/pubsub", "4.0.7")
}

object Kermit {
private const val kermitVersion = "1.2.2"
private const val kermitVersion = "2.0.2"
const val logger = "co.touchlab:kermit:$kermitVersion"
}

object Kodein {
const val di = "org.kodein.di:kodein-di:7.15.0"
const val di = "org.kodein.di:kodein-di:7.21.0"
}

object Kotlin {
private const val coroutinesCoreVersion = "1.6.0"
private const val coroutinesTestVersion = "1.6.4"
private const val coroutinesVersion = "1.7.3"

// "-native-mt" is required here, otherwise iOS fails with runtime exception
const val coroutinesCore =
"org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesCoreVersion-native-mt"
const val coroutinesTest =
"org.jetbrains.kotlinx:kotlinx-coroutines-test:${coroutinesTestVersion}"
const val coroutinesCore = "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion"
const val coroutinesTest = "org.jetbrains.kotlinx:kotlinx-coroutines-test:${coroutinesVersion}"
const val test = "org.jetbrains.kotlin:kotlin-test"
const val dateTime = "org.jetbrains.kotlinx:kotlinx-datetime:0.4.0"
const val serialization = "org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1"
const val dateTime = "org.jetbrains.kotlinx:kotlinx-datetime:0.4.1"
const val serialization = "org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.1"
}

object Ktor {
private const val ktorVersion = "2.1.2"
private const val ktorVersion = "2.3.6"
const val client = "io.ktor:ktor-client-core:$ktorVersion"
const val contentNegotiation = "io.ktor:ktor-client-content-negotiation:$ktorVersion"
const val serialization = "io.ktor:ktor-serialization-kotlinx-json:$ktorVersion"
const val logging = "io.ktor:ktor-client-logging:$ktorVersion"
const val logback = "ch.qos.logback:logback-classic:1.2.10"
const val logback = "ch.qos.logback:logback-classic:1.4.11"
}

object Node {
val htmlParser = NpmDependency("node-html-parser", "6.1.4")
val htmlParser = NpmDependency("node-html-parser", "6.1.11")
val express = NpmDependency("express", "4.18.2")
val jsJoda = NpmDependency("@js-joda/core", "5.4.2")
val jsJoda = NpmDependency("@js-joda/core", "5.6.1")
}

object Uuid {
const val uuid = "com.benasher44:uuid:0.6.0"
const val uuid = "com.benasher44:uuid:0.8.2"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ class BackendServicePlugin : Plugin<Project> {
target.plugins.apply("data-plugin")
target.extensions.configure(KotlinMultiplatformExtension::class.java) {
sourceSets.maybeCreate("jsMain").dependencies {
implementation(project(":common-service"))
api(project(":common-service"))
}
sourceSets.maybeCreate("jsTest").dependencies {
implementation(project(":common-service-testfixtures"))
api(project(":common-service-testfixtures"))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class DataPlugin : Plugin<Project> {
target.plugins.apply("module-plugin")
target.extensions.configure(KotlinMultiplatformExtension::class.java) {
sourceSets.maybeCreate("commonMain").dependencies {
implementation(project(":common-network"))
api(project(":common-network"))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ class ModulePlugin : Plugin<Project> {
target.plugins.apply("org.jetbrains.kotlin.plugin.serialization")
target.extensions.configure(KotlinMultiplatformExtension::class.java) {
sourceSets.maybeCreate("commonMain").dependencies {
implementation(project(":common-kotlin"))
implementation(project(":common-test"))
api(project(":common-kotlin"))
api(project(":common-test"))
}
sourceSets.maybeCreate("commonTest").dependencies {
implementation(Deps.Kotlin.coroutinesTest)
api(Deps.Kotlin.coroutinesTest)
}
}
}
Expand Down
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ kotlin.code.style=official

#KMP
kotlin.js.generate.executable.default=false
kotlin.incremental.js.ir=true
kotlin.js.ir.output.granularity=whole-program
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 4a007bf

Please sign in to comment.