Skip to content

Commit

Permalink
Merge branch 'main' into scala3-migration
Browse files Browse the repository at this point in the history
  • Loading branch information
kubukoz committed Oct 28, 2024
2 parents 1710cd4 + 6775bea commit cbf81eb
Show file tree
Hide file tree
Showing 101 changed files with 659 additions and 569 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ jobs:
timeout-minutes: 10
steps:

- uses: actions/checkout@v3.5.3
- uses: actions/checkout@v4.1.1

- uses: cachix/install-nix-action@v22
- uses: cachix/install-nix-action@v23

- uses: cachix/cachix-action@v12
with:
name: kubukoz
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'

- name: Cache sbt
uses: actions/cache@v3.3.1
uses: actions/cache@v3.3.2
with:
path: |
~/.sbt
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependency-graph.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v3.5.3
- uses: actions/checkout@v4.1.1
- uses: scalacenter/sbt-dependency-submission@v2
15 changes: 15 additions & 0 deletions .scalafix.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
rules = [
NoAutoTupling,
DisableSyntax,
LeakingImplicitClassVal,
NoValInForComprehension,
RedundantSyntax,
RemoveUnused
]

DisableSyntax.noVars = true
DisableSyntax.noNulls = true
DisableSyntax.noReturns = true
DisableSyntax.noWhileLoops = true

OrganizeImports.targetDialect = Scala3
9 changes: 9 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,12 @@ rewrite {
sort = ascii
}
}

fileOverride {
"glob:**.sbt" {
runner.dialect = sbt1
}
"glob:**/project/**" {
runner.dialect = scala212
}
}
58 changes: 32 additions & 26 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ inThisBuild(
)
)

import scala.sys.process._
import scala.sys.process.*

def crossPlugin(
x: sbt.librarymanagement.ModuleID
Expand All @@ -27,27 +27,28 @@ val compilerPlugins =
Nil
else
List(
crossPlugin("org.typelevel" % "kind-projector" % "0.13.2")
crossPlugin("org.typelevel" % "kind-projector" % "0.13.3")
))

ThisBuild / versionScheme := Some("early-semver")

Global / onChangedBuildSource := ReloadOnSourceChanges

ThisBuild / scalaVersion := "3.3.1"
ThisBuild / crossScalaVersions := Seq("3.3.1")
// todo: change to 3.3.x in plugin module
ThisBuild / scalaVersion := "3.5.2"
ThisBuild / crossScalaVersions := Seq("3.5.2")

// For coursier's "latest.integration"
ThisBuild / dynverSeparator := "-"

val commonSettings = Seq(
organization := "com.kubukoz.playground",
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-core" % "2.10.0",
"org.typelevel" %% "cats-mtl" % "1.3.1",
"com.disneystreaming" %% "weaver-cats" % "0.8.3" % Test,
"com.disneystreaming" %% "weaver-discipline" % "0.8.3" % Test,
"com.disneystreaming" %% "weaver-scalacheck" % "0.8.3" % Test,
"org.typelevel" %% "cats-core" % "2.12.0",
"org.typelevel" %% "cats-mtl" % "1.5.0",
"com.disneystreaming" %% "weaver-cats" % "0.8.4" % Test,
"com.disneystreaming" %% "weaver-discipline" % "0.8.4" % Test,
"com.disneystreaming" %% "weaver-scalacheck" % "0.8.4" % Test,
"com.softwaremill.diffx" %% "diffx-core" % "0.9.0" % Test,
"com.softwaremill.diffx" %% "diffx-cats" % "0.9.0" % Test,
),
Expand All @@ -63,12 +64,16 @@ val commonSettings = Seq(
Test / scalacOptions -= "-Wunused:params",
Test / scalacOptions -= "-Wunused:privates",
//
scalacOptions += "-Wnonunit-statement",
scalacOptions += "-no-indent",
scalacOptions ++= Seq("-Xsource:3.0"),
scalacOptions ++= Seq(
"-source:3.7",
"-experimental",
),
Test / scalacOptions += "-Wconf:cat=deprecation:silent,msg=Specify both message and version:silent",
scalacOptions ++= Seq("-release", "11"),
mimaFailOnNoPrevious := false,
semanticdbEnabled := true,
semanticdbVersion := scalafixSemanticdb.revision,
)

def module(
Expand Down Expand Up @@ -105,10 +110,10 @@ lazy val source = module("source")
lazy val parser = module("parser")
.settings(
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-parse" % "0.3.10",
"io.circe" %% "circe-generic" % "0.14.6" % Test,
"io.circe" %% "circe-parser" % "0.14.6" % Test,
"co.fs2" %% "fs2-io" % "3.9.2" % Test,
"org.typelevel" %% "cats-parse" % "1.0.0",
"io.circe" %% "circe-generic" % "0.14.10" % Test,
"io.circe" %% "circe-parser" % "0.14.10" % Test,
"co.fs2" %% "fs2-io" % "3.11.0" % Test,
)
)
.dependsOn(
Expand All @@ -120,7 +125,7 @@ lazy val parser = module("parser")
lazy val formatter = module("formatter")
.settings(
libraryDependencies ++= Seq(
"org.typelevel" %% "paiges-cats" % "0.4.3"
"org.typelevel" %% "paiges-cats" % "0.4.4"
)
)
.dependsOn(
Expand All @@ -134,15 +139,16 @@ lazy val formatter = module("formatter")
lazy val core = module("core")
.settings(
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-effect" % "3.5.2",
"com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.24.1",
"org.typelevel" %% "cats-effect" % "3.5.5",
"com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.31.1",
"com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion.value,
"com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value,
"com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value,
"com.disneystreaming.smithy4s" % "smithy4s-protocol" % smithy4sVersion.value % Test,
"com.disneystreaming.alloy" % "alloy-core" % "0.2.8" % Test,
"software.amazon.smithy" % "smithy-aws-traits" % "1.39.1" % Test,
"com.disneystreaming.alloy" % "alloy-core" % "0.3.14" % Test,
"software.amazon.smithy" % "smithy-aws-traits" % "1.52.1" % Test,
),
// todo: move this to a separate module like "examples"
Smithy4sCodegenPlugin.defaultSettings(Test),
)
.enablePlugins(Smithy4sCodegenPlugin)
Expand All @@ -162,15 +168,15 @@ lazy val languageSupport = module("language-support")
lazy val lsp = module("lsp")
.settings(
libraryDependencies ++= Seq(
"org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.21.1",
"io.circe" %% "circe-core" % "0.14.6",
"org.http4s" %% "http4s-ember-client" % "0.23.23",
"org.http4s" %% "http4s-ember-server" % "0.23.23" % Test,
("io.get-coursier" % "coursier" % "2.1.7")
"org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.23.1",
"io.circe" %% "circe-core" % "0.14.10",
"org.http4s" %% "http4s-ember-client" % "0.23.29",
"org.http4s" %% "http4s-ember-server" % "0.23.29" % Test,
("io.get-coursier" % "coursier" % "2.1.14")
.cross(CrossVersion.for3Use2_13)
.exclude("org.scala-lang.modules", "scala-collection-compat_2.13")
.exclude("com.github.plokhotnyuk.jsoniter-scala", "jsoniter-scala-core_2.13"),
"org.typelevel" %% "cats-tagless-core" % "0.15.0",
"org.typelevel" %% "cats-tagless-core" % "0.16.2",
),
buildInfoPackage := "playground.lsp.buildinfo",
buildInfoKeys ++= Seq(version, scalaBinaryVersion),
Expand Down
30 changes: 24 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
devShell = pkgs.mkShell {
buildInputs = [
pkgs.yarn
pkgs.nodejs-14_x
pkgs.nodejs
pkgs.sbt
pkgs.jless
pkgs.gnupg
Expand Down
2 changes: 1 addition & 1 deletion modules/ast/src/main/scala/playground/smithyql/AST.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import cats.Functor
import cats.Id
import cats.Show
import cats.data.NonEmptyList
import cats.implicits._
import cats.kernel.Eq
import cats.kernel.Order
import cats.syntax.all.*
import cats.~>

/** The main type for AST nodes of SmithyQL. The type parameter `F[_]` is a type constructor that
Expand Down
6 changes: 3 additions & 3 deletions modules/ast/src/main/scala/playground/smithyql/DSL.scala
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package playground.smithyql

import cats.Id
import cats.implicits._
import cats.syntax.all.*

object DSL {

implicit class StringDSLOps(
val s: String
private val s: String
) extends AnyVal {

def call(
Expand All @@ -16,7 +16,7 @@ object DSL {
)*
): Query[Id] = Query[Id](
operationName = QueryOperationName[Id](None, OperationName(s)),
input = struct(args: _*),
input = struct(args*),
)

}
Expand Down
4 changes: 2 additions & 2 deletions modules/ast/src/test/scala/playground/Assertions.scala
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package playground

import cats.Id
import cats.implicits._
import cats.syntax.all.*
import com.softwaremill.diffx.Diff
import com.softwaremill.diffx.ShowConfig
import playground.smithyql._
import playground.smithyql.*
import weaver.Expectations
import weaver.SourceLocation

Expand Down
9 changes: 5 additions & 4 deletions modules/core/src/main/scala/playground/CompilationError.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package playground
import cats.Id
import cats.data.IorNel
import cats.data.NonEmptyList
import cats.implicits._
import cats.kernel.Eq
import playground.CompilationErrorDetails._
import playground.smithyql._
import cats.kernel.Order.catsKernelOrderingForOrder
import cats.syntax.all.*
import playground.CompilationErrorDetails.*
import playground.smithyql.*
import playground.smithyql.format.Formatter
import smithy.api.TimestampFormat
import smithy4s.ShapeId
Expand Down Expand Up @@ -110,7 +111,7 @@ sealed trait CompilationErrorDetails extends Product with Serializable {
s"""Matching enums by value is deprecated and may be removed in the future. Use $enumName instead.""".stripMargin
case DuplicateItem => "Duplicate item - some entries will be dropped to fit in a set shape."
case AmbiguousService(workspaceServices) =>
s"""Couldn't determine service for this operation. Add a use clause, or use an explicit reference to specify the service you want to use.
"""Couldn't determine service for this operation. Add a use clause, or use an explicit reference to specify the service you want to use.
|Available services:""".stripMargin + workspaceServices
.sorted
.map(UseClause[Id](_).mapK(WithSource.liftId))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package playground

import cats.MonadThrow
import cats.implicits._
import cats.syntax.all.*
import smithy4s.Document
import smithy4s.Endpoint
import smithy4s.Service
import smithy4s.kinds._
import smithy4s.kinds.*
import smithy4s.schema.Schema

class DynamicServiceProxy[Alg[_[_, _, _, _, _]], Op[_, _, _, _, _]](
Expand Down
3 changes: 1 addition & 2 deletions modules/core/src/main/scala/playground/FileCompiler.scala
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package playground

import cats.Parallel
import cats.implicits._
import cats.syntax.all.*
import cats.~>
import playground._
import playground.smithyql.SourceFile
import playground.smithyql.WithSource

Expand Down
3 changes: 1 addition & 2 deletions modules/core/src/main/scala/playground/FileRunner.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package playground

import cats.data.NonEmptyList
import cats.implicits._
import playground._
import cats.syntax.all.*
import playground.smithyql.SourceFile
import playground.smithyql.SourceRange
import playground.smithyql.WithSource
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/main/scala/playground/IorUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import cats.data.Ior
import cats.data.Ior.Both
import cats.data.Ior.Left
import cats.data.Ior.Right
import cats.implicits._
import cats.kernel.Semigroup
import cats.syntax.all.*

object IorUtils {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package playground

import cats.data.EitherNel
import cats.implicits._
import cats.syntax.all.*
import playground.smithyql.OperationName
import playground.smithyql.QualifiedIdentifier
import playground.smithyql.QueryOperationName
Expand Down
Loading

0 comments on commit cbf81eb

Please sign in to comment.