From ff96956f1012cc45f1112688b16f3abafff87097 Mon Sep 17 00:00:00 2001 From: Juan Pedro Moreno Date: Tue, 2 May 2023 21:08:35 +0200 Subject: [PATCH] Adds a scala gradle module where.. will be placing the scala version of the library. Later on the amount of dependencies will be reduced according to the kotlin migration --- gradle.properties | 2 ++ gradle/libs.versions.toml | 36 +++++++++++++++++++++++++++++++++++- scala/build.gradle.kts | 34 ++++++++++++++++++++++++++++++++++ settings.gradle.kts | 2 ++ 4 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 scala/build.gradle.kts diff --git a/gradle.properties b/gradle.properties index 587551220..c9eb9e071 100644 --- a/gradle.properties +++ b/gradle.properties @@ -20,3 +20,5 @@ systemProp.org.gradle.unsafe.kotlin.assignment=true # Workaround to disable Dokka setup from Arrow Gradle Config dokkaEnabled=false + +scalaVersions = 3.2.2 \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index bebc3f8c9..06b06e0ca 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -16,6 +16,18 @@ postgresql = "42.5.1" testcontainers = "1.17.6" hikari = "5.0.1" dokka = "1.8.10" +scalaMultiversion = "2.0.4" +ciris = "3.1.0" +http4s = "0.23.18" +circe = "0.14.4" +catsEffect = "3.4.8" +log4cats = "2.5.0" +catsRetry = "3.1.0" +memeid4cats = "0.8.0" +doobie = "1.0.0-RC2" +scalaTestContainers = "0.40.10" +munit = "0.7.28" +munitCatsEffect = "1.0.5" [libraries] arrow-core = { module = "io.arrow-kt:arrow-core", version.ref = "arrow" } @@ -39,6 +51,27 @@ klogging = { module = "io.github.oshai:kotlin-logging", version.ref = "klogging" hikari = { module = "com.zaxxer:HikariCP", version.ref = "hikari" } postgresql = { module = "org.postgresql:postgresql", version.ref = "postgresql" } testcontainers-postgresql = { module = "org.testcontainers:postgresql", version.ref = "testcontainers" } +ciris-core = { module = "is.cir:ciris_%%", version.ref = "ciris" } +ciris-refined = { module = "is.cir:ciris-refined_%%", version.ref = "ciris" } +ciris-http4s = { module = "is.cir:ciris-http4s_%%", version.ref = "ciris" } +http4s-dsl = { module = "org.http4s:http4s-dsl_%%", version.ref = "http4s" } +http4s-client = { module = "org.http4s:http4s-client_%%", version.ref = "http4s" } +http4s-circe = { module = "org.http4s:http4s-circe_%%", version.ref = "http4s" } +http4s-emberClient = { module = "org.http4s:http4s-ember-client_%%", version.ref = "http4s" } +doobie-core = { module = "org.tpolecat:doobie-core_%%", version.ref = "doobie" } +doobie-postgres = { module = "org.tpolecat:doobie-postgres_%%", version.ref = "doobie" } +doobie-hikari = { module = "org.tpolecat:doobie-hikari_%%", version.ref = "doobie" } +doobie-munit = { module = "org.tpolecat:doobie-munit_%%", version.ref = "doobie" } +circe = { module = "io.circe:circe-generic_%%", version.ref = "circe" } +cats-effect = { module = "org.typelevel:cats-effect_%%", version.ref = "catsEffect" } +logger = { module = "org.typelevel:log4cats-slf4j_%%", version.ref = "log4cats" } +openai = { module = "com.theokanning.openai-gpt3-java:service_%%", version.ref = "openai" } +cats-retry = { module = "com.github.cb372:cats-retry_%%", version.ref = "catsRetry" } +memeid = { module = "com.47deg:memeid4s-cats_%%", version.ref = "memeid4cats" } +munit-core = { module = "org.scalameta:munit_%%", version.ref = "munit" } +munit-cats-effect = { module = "org.typelevel:munit-cats-effect-3_%%", version.ref = "munitCatsEffect" } +scala-testcontainers-munit = { module = "com.dimafeng:testcontainers-scala-munit_%%", version.ref = "scalaTestContainers" } +scala-testcontainers-postgresql = { module = "com.dimafeng:testcontainers-scala-postgresql_%%", version.ref = "scalaTestContainers" } [bundles] arrow = [ @@ -58,4 +91,5 @@ kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", vers spotless = { id = "com.diffplug.spotless", version.ref = "spotless" } dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } arrow-gradle-nexus = { id = "io.arrow-kt.arrow-gradle-config-nexus", version.ref = "arrowGradle" } -arrow-gradle-publish = { id = "io.arrow-kt.arrow-gradle-config-publish", version.ref = "arrowGradle" } \ No newline at end of file +arrow-gradle-publish = { id = "io.arrow-kt.arrow-gradle-config-publish", version.ref = "arrowGradle" } +scala-multiversion = { id = "com.adtran.scala-multiversion-plugin", version.ref = "scalaMultiversion" } \ No newline at end of file diff --git a/scala/build.gradle.kts b/scala/build.gradle.kts new file mode 100644 index 000000000..6d143a07f --- /dev/null +++ b/scala/build.gradle.kts @@ -0,0 +1,34 @@ +@file:Suppress("DSL_SCOPE_VIOLATION") + +plugins { + scala + alias(libs.plugins.scala.multiversion) +} + +dependencies { + implementation(libs.ciris.core) + implementation(libs.ciris.refined) + implementation(libs.ciris.http4s) + implementation(libs.http4s.dsl) + implementation(libs.http4s.client) + implementation(libs.http4s.circe) + implementation(libs.http4s.emberClient) + implementation(libs.doobie.core) + implementation(libs.doobie.postgres) + implementation(libs.doobie.hikari) + implementation(libs.doobie.munit) + implementation(libs.circe) + implementation(libs.cats.effect) + implementation(libs.logger) + implementation(libs.openai) + implementation(libs.cats.retry) + implementation(libs.memeid) + testImplementation(libs.munit.core) + testImplementation(libs.munit.cats.effect) + testImplementation(libs.scala.testcontainers.munit) + testImplementation(libs.scala.testcontainers.postgresql) +} + +tasks.withType().configureEach { + useJUnit() +} \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 8fccd216f..7aa7d8b55 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -7,3 +7,5 @@ pluginManagement { } rootProject.name = "langchain4k" +include("langchain4k-scala") +project(":langchain4k-scala").projectDir = file("scala") \ No newline at end of file