Skip to content

Commit

Permalink
Upgrade dependencies and drop cross compile support
Browse files Browse the repository at this point in the history
  • Loading branch information
gbastkowski committed Jun 25, 2024
1 parent e32deda commit a0ee3ea
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version=3.7.10
style = defaultWithAlign

runner.dialect = scala213
runner.dialect = scala3

maxColumn = 120
project.git = true
Expand Down
17 changes: 5 additions & 12 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,9 @@ val noPublish = List(
)

// === CI/CD settings ===
val scala213 = "2.13.11"
val scala3 = "3.3.0"
val scala3 = "3.4.2"

ThisBuild / scalaVersion := scala213
ThisBuild / crossScalaVersions := List(scala213, scala3)
ThisBuild / scalaVersion := scala3

// publishing
ThisBuild / githubWorkflowTargetTags ++= Seq("v*")
Expand Down Expand Up @@ -73,7 +71,7 @@ ThisBuild / githubWorkflowAddedJobs += WorkflowJob(
WorkflowStep.Sbt(
List("site/makeMicrosite"),
name = Some("Compile Website"),
cond = Some(s"matrix.scala == '$scala213'")
cond = Some(s"matrix.scala == '$scala3'")
) :+
WorkflowStep.Use(
UseRef.Public("peaceiris", "actions-gh-pages", "v3"),
Expand Down Expand Up @@ -138,7 +136,7 @@ ThisBuild / githubWorkflowBuildPostamble ++= List(
WorkflowStep.Sbt(
List("site/mdoc"),
name = Some("Compile Documentation"),
cond = Some(s"matrix.scala == '$scala213'")
cond = Some(s"matrix.scala == '$scala3'")
)
)

Expand All @@ -147,12 +145,7 @@ lazy val core = project
.settings(commonSettings)
.settings(
name := "fs2-gtfs-core",
libraryDependencies ++= Dependencies.core ++ PartialFunction
.condOpt(CrossVersion.partialVersion(scalaVersion.value)) { case Some((2, _)) =>
Dependencies.coreScala2
}
.toList
.flatten
libraryDependencies ++= Dependencies.core
)

lazy val rules = project
Expand Down
18 changes: 7 additions & 11 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import sbt._

object Versions {
val fs2 = "3.7.0"
val fs2Data = "1.8.0"
val fs2 = "3.10.2"
val fs2Data = "1.11.0"
val enumeratum = "1.7.3"
val weaver = "0.8.3"
val circe = "0.14.5"
val log4cats = "2.6.0"
val catsParse = "0.3.10"
val literally = "1.1.0"
val weaver = "0.8.4"
val circe = "0.14.8"
val log4cats = "2.7.0"
val catsParse = "1.0.0"
val literally = "1.2.0"
}

object Dependencies {
Expand All @@ -19,10 +19,6 @@ object Dependencies {
"org.gnieh" %% "fs2-data-csv-generic" % Versions.fs2Data
)

val coreScala2 = List(
"com.beachape" %% "enumeratum" % Versions.enumeratum
)

val rules = List(
"io.circe" %% "circe-core" % Versions.circe,
"org.typelevel" %% "log4cats-core" % Versions.log4cats
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.9.2
sbt.version=1.10.0
4 changes: 2 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ ThisBuild / libraryDependencySchemes ++= Seq(
// strict compiler flags
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.4.4")
// source code formatting
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
// coverage
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.8")
// check dependencies against OWASP vulnerabilities
addSbtPlugin("net.vonbuchholtz" % "sbt-dependency-check" % "5.1.0")
// check and add missing license headers
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0")
// manage github actions from build definition
addSbtPlugin("com.github.sbt" % "sbt-github-actions" % "0.15.0")
addSbtPlugin("com.github.sbt" % "sbt-github-actions" % "0.24.0")
// manage the documentation website
addSbtPlugin("com.47deg" % "sbt-microsites" % "1.4.3")
// generate unified documentation
Expand Down
2 changes: 1 addition & 1 deletion rules/src/main/scala/com/mobimeo/gtfs/rules/Ctx.scala
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ object Ctx {
.traverse { case (k, v) =>
v.as[Ctx](decoder).tupleLeft(k)
}
.map(l => apply(l: _*))
.map(l => apply(l*))
}
)

Expand Down
4 changes: 2 additions & 2 deletions rules/src/main/scala/com/mobimeo/gtfs/rules/Rule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ sealed trait Matcher {
def and(that: Matcher): Matcher = (this, that) match {
case (Matcher.Any, _) => that
case (_, Matcher.Any) => this
case (Matcher.Not(in1), Matcher.Not(in2)) => !(in1 or in2)
case (Matcher.Not(in1), Matcher.Not(in2)) => !(in1.or(in2))
case _ => Matcher.And(this, that)
}

def or(that: Matcher): Matcher =
(this, that) match {
case (Matcher.Any, _) => Matcher.Any
case (_, Matcher.Any) => Matcher.Any
case (Matcher.Not(in1), Matcher.Not(in2)) => !(in1 and in2)
case (Matcher.Not(in1), Matcher.Not(in2)) => !(in1.and(in2))
case _ => Matcher.Or(this, that)
}
}
Expand Down
2 changes: 1 addition & 1 deletion rules/src/main/scala/com/mobimeo/gtfs/rules/dsl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Dsl[F[_]] {

class TransformationBuilder(name: String, matcher: Matcher) {
def perform(t: Transformation[F], ts: Transformation[F]*): RulesBuilder =
RulesBuilder.Apply(name, matcher, NonEmptyList.of(t, ts: _*))
RulesBuilder.Apply(name, matcher, NonEmptyList.of(t, ts*))
def delete: RulesBuilder = RulesBuilder.Delete(name, matcher)
def log(msg: Expr[F], at: LogLevel = LogLevel.Info): RulesBuilder =
RulesBuilder.Log(name, matcher, msg, at)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,10 @@ object RuleParser {
}

val term = repSep(factor.surroundedBy(whitespaces0), min = 1, sep = string("and")).map { fs =>
fs.reduceLeft(_ and _)
fs.reduceLeft(_.and(_))
}

repSep(term.surroundedBy(whitespaces0), min = 1, sep = string("or")).map(ts => ts.reduceLeft(_ or _))
repSep(term.surroundedBy(whitespaces0), min = 1, sep = string("or")).map(ts => ts.reduceLeft(_.or(_)))

}

Expand Down

0 comments on commit a0ee3ea

Please sign in to comment.