Skip to content

Commit

Permalink
Bump scala3 and sqlite-jdbc
Browse files Browse the repository at this point in the history
  • Loading branch information
Alberto Perez Lopez authored and Alberto Perez Lopez committed Jan 14, 2025
1 parent 00e3504 commit 3a79017
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 101 deletions.
186 changes: 93 additions & 93 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,93 +1,93 @@
ThisBuild / organization := "com.albertprz"
ThisBuild / version := "1.0.0"
ThisBuild / Compile / compile / logLevel := Level.Warn
Global / excludeLintKeys += logLevel
Global / onChangedBuildSource := ReloadOnSourceChanges
Test / parallelExecution := false


val scala3Ver = "3.0.0"
val scala2Ver = "2.13.8"


lazy val commonSettings = Seq(

scalaVersion := scala3Ver,

scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 13)) => Seq("-Ytasty-reader")
case _ => Seq("-new-syntax", "-indent")
}),

libraryDependencies ++= (CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 13)) => scalaReflect.map(_ % scalaVersion.value)
case _ => Seq()
})
)


lazy val coreSettings = Seq(
libraryDependencies ++= (CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 13)) => cats ++ catsEffect ++ pureconfig
case _ => cats ++ catsEffect ++ pureconfig.map(_.cross(CrossVersion.for3Use2_13))
})
)


lazy val testSettings = inConfig(IntegrationTest)(Defaults.itSettings) ++
Seq (
IntegrationTest / scalaSource := baseDirectory.value / "src/it/scala",
TaskKey[Unit]("test") := (IntegrationTest / test).dependsOn(Test / test).value,
libraryDependencies ++= (scalaTest ++ sqlite).map(_ % "it,test")
)



lazy val core = project
.in(file("core"))
.settings(
name := "logograph-core",
commonSettings,
coreSettings
)

lazy val macros = project
.in(file("macros"))
.settings(
name := "logograph-macros",
commonSettings,
crossScalaVersions := Seq(scala3Ver, scala2Ver)
)
.dependsOn(core)

lazy val app = project
.in(file("."))
.configs(IntegrationTest)
.settings(
name := "logograph",
commonSettings,
testSettings,
crossScalaVersions := Seq(scala3Ver, scala2Ver)
)
.dependsOn(core, macros)
.aggregate(core, macros)




/// Main Dependencies ///
val scalaReflect = Seq("org.scala-lang" % "scala-reflect")

val cats = Seq("org.typelevel" %% "cats-core" % "2.6.1",
"org.typelevel" %% "cats-kernel" % "2.6.1")

val catsEffect = Seq("org.typelevel" %% "cats-effect" % "3.1.1")

val pureconfig = Seq("com.github.pureconfig" %% "pureconfig" % "0.16.0")


/// Test Dependencies ///
val scalaTest = Seq("org.scalatest" %% "scalatest" % "3.2.9",
"org.scalactic" %% "scalactic" % "3.2.9")

val sqlite = Seq("org.xerial" % "sqlite-jdbc" % "3.14.2")
ThisBuild / organization := "com.albertprz"
ThisBuild / version := "1.0.0"
ThisBuild / Compile / compile / logLevel := Level.Warn
Global / excludeLintKeys += logLevel
Global / onChangedBuildSource := ReloadOnSourceChanges
Test / parallelExecution := false


val scala3Ver = "3.3.4"
val scala2Ver = "2.13.8"


lazy val commonSettings = Seq(

scalaVersion := scala3Ver,

scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 13)) => Seq("-Ytasty-reader")
case _ => Seq("-new-syntax", "-indent")
}),

libraryDependencies ++= (CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 13)) => scalaReflect.map(_ % scalaVersion.value)
case _ => Seq()
})
)


lazy val coreSettings = Seq(
libraryDependencies ++= (CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 13)) => cats ++ catsEffect ++ pureconfig
case _ => cats ++ catsEffect ++ pureconfig.map(_.cross(CrossVersion.for3Use2_13))
})
)


lazy val testSettings = inConfig(IntegrationTest)(Defaults.itSettings) ++
Seq (
IntegrationTest / scalaSource := baseDirectory.value / "src/it/scala",
TaskKey[Unit]("test") := (IntegrationTest / test).dependsOn(Test / test).value,
libraryDependencies ++= (scalaTest ++ sqlite).map(_ % "it,test")
)



lazy val core = project
.in(file("core"))
.settings(
name := "logograph-core",
commonSettings,
coreSettings
)

lazy val macros = project
.in(file("macros"))
.settings(
name := "logograph-macros",
commonSettings,
crossScalaVersions := Seq(scala3Ver, scala2Ver)
)
.dependsOn(core)

lazy val app = project
.in(file("."))
.configs(IntegrationTest)
.settings(
name := "logograph",
commonSettings,
testSettings,
crossScalaVersions := Seq(scala3Ver, scala2Ver)
)
.dependsOn(core, macros)
.aggregate(core, macros)




/// Main Dependencies ///
val scalaReflect = Seq("org.scala-lang" % "scala-reflect")

val cats = Seq("org.typelevel" %% "cats-core" % "2.6.1",
"org.typelevel" %% "cats-kernel" % "2.6.1")

val catsEffect = Seq("org.typelevel" %% "cats-effect" % "3.1.1")

val pureconfig = Seq("com.github.pureconfig" %% "pureconfig" % "0.16.0")


/// Test Dependencies ///
val scalaTest = Seq("org.scalatest" %% "scalatest" % "3.2.9",
"org.scalactic" %% "scalactic" % "3.2.9")

val sqlite = Seq("org.xerial" % "sqlite-jdbc" % "3.47.1.0")
16 changes: 8 additions & 8 deletions core/src/main/scala/SQLExpression.scala
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,12 @@ case class Table(tableName: String) (using cfg: LogographConfig)
case class Column(columnName: String, tableName: String) (using cfg: LogographConfig)
extends SQLClause:

lazy val sql = if columnName != "*" then columnName.convert(cfg.columnConverter
.map(_.getOrElse(tableName, Map.empty)))
.convertCase(cfg.columnCaseConverter)
.wrapBrackets()
else columnName
lazy val sql = if columnName != "*"
then columnName
.convert(cfg.columnConverter.map(_.getOrElse(tableName, Map.empty)))
.convertCase(cfg.columnCaseConverter)
.wrapBrackets()
else columnName

case class Operator(operatorName: String) (using cfg: LogographConfig)
extends SQLClause:
Expand All @@ -99,14 +100,13 @@ private object SQLExpression:
expr match
case fld: Field => if isAgg then List(fld) else List.empty
case op: Operation => op.operands
.flatMap(findAggFields(_, isAgg || SQLOperations.aggOps.contains(op.operator)))
.flatMap(findAggFields(_, isAgg || SQLOperations.aggOps.contains(op.operator)))
case _ => List.empty

def findFields (expr: SQLExpression): List[Field] =
expr match
case fld: Field => List(fld)
case op: Operation => op.operands
.flatMap(findFields)
case op: Operation => op.operands.flatMap(findFields)
case _ => List.empty

private object Predicate:
Expand Down

0 comments on commit 3a79017

Please sign in to comment.