Skip to content

Commit

Permalink
dependency updates
Browse files Browse the repository at this point in the history
  • Loading branch information
pshirshov committed Apr 16, 2024
1 parent 873e216 commit 623a153
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 64 deletions.
11 changes: 5 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations.*

ThisBuild / scalaVersion := "2.13.11"
ThisBuild / scalaVersion := "2.13.13"

lazy val root = (project in file("."))
.settings(
name := "baboon",
libraryDependencies ++= Seq("com.lihaoyi" %% "fastparse" % "3.0.1"),
libraryDependencies ++= Seq("com.lihaoyi" %% "fastparse" % "3.1.0"),
libraryDependencies ++= Seq(
"fundamentals-platform",
"fundamentals-functional",
"fundamentals-language",
"fundamentals-collections",
"distage-core",
"distage-testkit-scalatest",
).map("io.7mind.izumi" %% _ % "1.1.0-M27"),
).map("io.7mind.izumi" %% _ % "1.2.8"),
libraryDependencies ++= Seq(
"org.scala-lang.modules" %% "scala-parser-combinators" % "2.3.0"
),
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.2.16" % Test,
"org.scalatest" %% "scalatest" % "3.2.18" % Test,
),
// libraryDependencies ++= Seq("com.lihaoyi" % "mainargs_2.13" % "0.5.0"),
libraryDependencies ++= Seq(
"com.github.alexarchambault" %% "case-app" % "2.1.0-M25"
"com.github.alexarchambault" %% "case-app" % "2.1.0-M26"
),
libraryDependencies ++= Seq(
"io.circe" %% "circe-core",
Expand Down
4 changes: 2 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
//addSbtPlugin("org.jetbrains.scala" % "sbt-ide-settings" % "1.1.1")
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.13")
addSbtPlugin("io.7mind.izumi.sbt" % "sbt-izumi" % "0.0.99")
addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.10.0")
addSbtPlugin("io.7mind.izumi.sbt" % "sbt-izumi" % "0.0.101")
84 changes: 52 additions & 32 deletions src/main/scala/io/septimalmind/baboon/BaboonModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,13 @@ import io.septimalmind.baboon.BaboonCompiler.CompilerOptions
import io.septimalmind.baboon.parser.BaboonParser
import io.septimalmind.baboon.translator.BaboonAbstractTranslator
import io.septimalmind.baboon.translator.csharp.CSValue.CSPackageId
import io.septimalmind.baboon.translator.csharp.{
CSBaboonTranslator,
CSCodecTranslator,
CSDefnTools,
CSDefnTranslator,
CSNSJsonCodecGenerator,
CSTypeTranslator,
CSUEBACodecGenerator,
IndividualConversionHandler
}
import io.septimalmind.baboon.translator.csharp.*
import io.septimalmind.baboon.typer.*
import io.septimalmind.baboon.typer.BaboonTyper.FullRawDefn
import io.septimalmind.baboon.typer.model.*
import io.septimalmind.baboon.util.BLogger
import io.septimalmind.baboon.validator.BaboonValidator
import izumi.distage.LocalContext
import izumi.fundamentals.collections.nonempty.NEList
import izumi.fundamentals.platform.functional.Identity

class BaboonModule(options: CompilerOptions) extends ModuleDef {
make[BaboonCompiler].from[BaboonCompiler.BaboonCompilerImpl]
Expand All @@ -45,31 +34,62 @@ class BaboonModule(options: CompilerOptions) extends ModuleDef {
make[CSTypeTranslator]
make[ScopeSupport].from[ScopeSupport.ScopeSupportImpl]

make[LocalContext[Identity, BaboonTranslator]]
.fromLocalContext(new ModuleDef {
makeSubcontext[BaboonTranslator]
.localDependencies(
List(
DIKey[Pkg],
DIKey[NEList[Scope[FullRawDefn]]],
DIKey[Map[TypeId, DomainMember]]
)
)
.withSubmodule(new ModuleDef {
make[BaboonTranslator]
}.running { (translator: BaboonTranslator) =>
translator
})
.external(
DIKey[Pkg],
DIKey[NEList[Scope[FullRawDefn]]],
DIKey[Map[TypeId, DomainMember]]
)
.extractWith { (translator: BaboonTranslator) =>
translator
}
// make[LocalContext[Identity, BaboonTranslator]]
// .fromLocalContext(new ModuleDef {
// make[BaboonTranslator]
// }.running { (translator: BaboonTranslator) =>
// translator
// })
// .external(
// DIKey[Pkg],
// DIKey[NEList[Scope[FullRawDefn]]],
// DIKey[Map[TypeId, DomainMember]]
// )

make[LocalContext[Identity, IndividualConversionHandler]]
.fromLocalContext(new ModuleDef {
makeSubcontext[IndividualConversionHandler]
.localDependencies(
List(
DIKey[CSPackageId],
DIKey[Version],
DIKey.get[Domain].named("current"),
DIKey.get[Domain].named("source"),
DIKey.get[BaboonRuleset]
)
)
.withSubmodule(new ModuleDef {
make[IndividualConversionHandler]
}.running { (handler: IndividualConversionHandler) =>
handler
})
.external(
DIKey[CSPackageId],
DIKey[Version],
DIKey.get[Domain].named("current"),
DIKey.get[Domain].named("source"),
DIKey.get[BaboonRuleset]
)
.extractWith { (handler: IndividualConversionHandler) =>
handler
}

// make[LocalContext[Identity, IndividualConversionHandler]]
// .fromLocalContext(new ModuleDef {
// make[IndividualConversionHandler]
// }.running { (handler: IndividualConversionHandler) =>
// handler
// })
// .external(
// DIKey[CSPackageId],
// DIKey[Version],
// DIKey.get[Domain].named("current"),
// DIKey.get[Domain].named("source"),
// DIKey.get[BaboonRuleset]
// )

many[CSCodecTranslator]
.add[CSNSJsonCodecGenerator]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import fastparse.*
import io.septimalmind.baboon.parser.{ParserContext, model}
import io.septimalmind.baboon.parser.defns.base.{kw, struct}
import io.septimalmind.baboon.parser.model.{RawAdt, RawAdtMember, RawTypeName}
import izumi.fundamentals.platform.language.Quirks.Discarder




class DefAdt(context: ParserContext, meta: DefMeta, defDto: DefDto) {
context.discard()
def adtMember[$: P]: P[RawAdtMember] =
P(meta.withMeta(defDto.dtoEnclosed)).map {
case (meta, name) =>
Expand Down
13 changes: 4 additions & 9 deletions src/main/scala/io/septimalmind/baboon/parser/defns/DefDto.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,13 @@ package io.septimalmind.baboon.parser.defns
import fastparse.*
import io.septimalmind.baboon.parser.{ParserContext, model}
import io.septimalmind.baboon.parser.defns.base.{idt, kw, struct}
import io.septimalmind.baboon.parser.model.{
RawDto,
RawDtoMember,
RawField,
RawFieldName,
RawTypeName,
RawTypeRef,
ScopedRef
}
import io.septimalmind.baboon.parser.model.{RawDto, RawDtoMember, RawField, RawFieldName, RawTypeName, RawTypeRef, ScopedRef}
import izumi.fundamentals.collections.nonempty.NEList
import izumi.fundamentals.platform.language.Quirks.Discarder

class DefDto(context: ParserContext, meta: DefMeta) {
context.discard()

def typeParams[$: P]: P[NEList[RawTypeRef]] = {
import fastparse.SingleLineWhitespace.whitespace
("[" ~ typeRef.rep(min = 1, sep = ",") ~ "]")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import fastparse.*
import io.septimalmind.baboon.parser.ParserContext
import io.septimalmind.baboon.parser.defns.base.{Literals, idt, kw}
import io.septimalmind.baboon.parser.model.*
import izumi.fundamentals.platform.language.Quirks.Discarder

class DefModel(context: ParserContext,
meta: DefMeta,
Expand All @@ -12,6 +13,7 @@ class DefModel(context: ParserContext,
defAdt: DefAdt,
defForeign: DefForeign,
) {
context.discard()

def header[$: P]: P[RawHeader] =
meta.withMeta(P(kw(kw.model, idt.symbolSeq))).map(RawHeader.tupled)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.septimalmind.baboon.translator.csharp

import distage.Subcontext
import io.circe.syntax.*
import io.septimalmind.baboon.BaboonCompiler.CompilerOptions
import io.septimalmind.baboon.RuntimeGenOpt
Expand All @@ -8,21 +9,19 @@ import io.septimalmind.baboon.translator.csharp.CSBaboonTranslator.*
import io.septimalmind.baboon.translator.csharp.CSValue.{CSPackageId, CSType}
import io.septimalmind.baboon.translator.{BaboonAbstractTranslator, Sources}
import io.septimalmind.baboon.typer.model.*
import izumi.distage.LocalContext
import izumi.functional.IzEither.*
import izumi.fundamentals.collections.IzCollections.*
import izumi.fundamentals.collections.nonempty.NEList
import izumi.fundamentals.platform.functional.Identity
import izumi.fundamentals.collections.nonempty.{NEList, NEMap}
import izumi.fundamentals.platform.strings.TextTree
import izumi.fundamentals.platform.strings.TextTree.*

class CSBaboonTranslator(
defnTranslator: CSDefnTranslator,
trans: CSTypeTranslator,
handler: LocalContext[Identity, IndividualConversionHandler],
options: CompilerOptions,
codecs: Set[CSCodecTranslator],
tools: CSDefnTools,
defnTranslator: CSDefnTranslator,
trans: CSTypeTranslator,
handler: Subcontext[IndividualConversionHandler],
options: CompilerOptions,
codecs: Set[CSCodecTranslator],
tools: CSDefnTools,
) extends BaboonAbstractTranslator {

type Out[T] = Either[NEList[BaboonIssue.TranslationIssue], T]
Expand Down Expand Up @@ -449,8 +448,8 @@ class CSBaboonTranslator(
handler
.provide(pkg)
.provide(srcVer.from)
.provideNamed("current", domain)
.provideNamed("source", lineage.versions(srcVer.from))
.provide[Domain]("current")(domain)
.provide[Domain]("source")(lineage.versions(srcVer.from))
.provide(rules)
.produce()
.use(_.makeConvs())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ class IndividualConversionHandler(transd: CSDefnTranslator,

private def swapCollType(ftNewInit: TextTree[CSValue],
base: String,
fieldRef: Node[Nothing],
fieldRef: TextTree[Nothing],
oldId: TypeId.BuiltinCollection,
newId: TypeId.BuiltinCollection,
newCollArgs: NEList[TypeRef],
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/io/septimalmind/baboon/typer/BaboonTyper.scala
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package io.septimalmind.baboon.typer

import distage.Subcontext
import io.septimalmind.baboon.parser.model.*
import io.septimalmind.baboon.parser.model.issues.BaboonIssue
import io.septimalmind.baboon.typer.model.*
import io.septimalmind.baboon.typer.model.Scope.*
import izumi.distage.LocalContext
import izumi.functional.IzEither.*
import izumi.fundamentals.collections.IzCollections.*
import izumi.fundamentals.collections.nonempty.{NEList, NEMap}
Expand All @@ -27,7 +27,7 @@ object BaboonTyper {
path: NEList[Scope[FullRawDefn]])

class BaboonTyperImpl(enquiries: BaboonEnquiries,
translator: LocalContext[Identity, BaboonTranslator],
translator: Subcontext[BaboonTranslator],
scopeSupport: ScopeSupport)
extends BaboonTyper {
override def process(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class TxtTreeTest extends AnyWordSpec {

assert(q"${TestVal("1")}".dump == "TestVal(1)")

assert((q"test": Node[Nothing]).dump == "test")
assert((q"test": TextTree[Nothing]).dump == "test")
assert(q"test".dump == "test")
assert(q"".dump == "")
}
Expand Down

0 comments on commit 623a153

Please sign in to comment.