Skip to content

Bump scala and deps, move to sbt #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
May 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 27 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,34 @@ concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true


jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: true

fail-fast: false
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Cache
uses: coursier/cache-action@v6

- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: adopt
java-version: 11

- name: Run tests
run: |
./mill -k --disable-ticker __.resolvedIvyDeps &&
./mill -k --disable-ticker mill.scalalib.scalafmt.ScalafmtModule/checkFormatAll __.sources &&
./mill -j 0 -k --disable-ticker __.test
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "21"
cache: "sbt"

- name: Setup sbt
uses: sbt/setup-sbt@v1

- name: Test
run: sbt ci

- name: Publish ${{ github.ref }}
# todo: uncomment
# if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || (github.ref == 'refs/heads/main'))
run: sbt ci-release
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
1 change: 0 additions & 1 deletion .mill-version

This file was deleted.

1 change: 1 addition & 0 deletions .sbtopts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-J-Xmx6g
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ override def ivyDeps = super.ivyDeps() ++ Agg(ivy"tech.neander::jsonrpclib-fs2::

**/!\ Please be aware that this library is in its early days and offers strictly no guarantee with regards to backward compatibility**

See the examples folder.
See the modules/examples folder.
132 changes: 132 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
import org.typelevel.sbt.tpolecat.DevMode
import org.typelevel.sbt.tpolecat.OptionsMode
import java.net.URI

inThisBuild(
List(
organization := "tech.neander",
homepage := Some(url("https://github.com/neandertech/jsonrpclib")),
licenses := List(License.Apache2),
developers := List(
Developer("Baccata", "Olivier Mélois", "baccata64@gmail.com", URI.create("https://github.com/baccata").toURL)
),
sonatypeCredentialHost := "s01.oss.sonatype.org",
sonatypeRepository := "https://s01.oss.sonatype.org/service/local"
)
)

val scala213 = "2.13.16"
val scala3 = "3.3.5"
val allScalaVersions = List(scala213, scala3)
val jvmScalaVersions = allScalaVersions
val jsScalaVersions = allScalaVersions
val nativeScalaVersions = allScalaVersions

val fs2Version = "3.12.0"

ThisBuild / tpolecatOptionsMode := DevMode

val commonSettings = Seq(
libraryDependencies ++= Seq(
"com.disneystreaming" %%% "weaver-cats" % "0.8.4" % Test
),
mimaPreviousArtifacts := Set(
organization.value %%% name.value % "0.0.7"
),
scalacOptions += "-java-output-version:8"
)

val core = projectMatrix
.in(file("modules") / "core")
.jvmPlatform(
jvmScalaVersions,
Test / unmanagedSourceDirectories ++= Seq(
(projectMatrixBaseDirectory.value / "src" / "test" / "scalajvm-native").getAbsoluteFile
)
)
.jsPlatform(jsScalaVersions)
.nativePlatform(
nativeScalaVersions,
Test / unmanagedSourceDirectories ++= Seq(
(projectMatrixBaseDirectory.value / "src" / "test" / "scalajvm-native").getAbsoluteFile
)
)
.disablePlugins(AssemblyPlugin)
.settings(
name := "jsonrpclib-core",
commonSettings,
libraryDependencies ++= Seq(
"com.github.plokhotnyuk.jsoniter-scala" %%% "jsoniter-scala-macros" % "2.30.2"
)
)

val fs2 = projectMatrix
.in(file("modules") / "fs2")
.jvmPlatform(jvmScalaVersions)
.jsPlatform(jsScalaVersions)
.nativePlatform(nativeScalaVersions)
.disablePlugins(AssemblyPlugin)
.dependsOn(core)
.settings(
name := "jsonrpclib-fs2",
commonSettings,
libraryDependencies ++= Seq(
"co.fs2" %%% "fs2-core" % fs2Version
)
)

val exampleServer = projectMatrix
.in(file("modules") / "examples/server")
.jvmPlatform(List(scala213))
.dependsOn(fs2)
.settings(
commonSettings,
publish / skip := true,
libraryDependencies ++= Seq(
"co.fs2" %%% "fs2-io" % fs2Version
)
)
.disablePlugins(MimaPlugin)

val exampleClient = projectMatrix
.in(file("modules") / "examples/client")
.jvmPlatform(
List(scala213),
Seq(
fork := true,
envVars += "SERVER_JAR" -> (exampleServer.jvm(scala213) / assembly).value.toString
)
)
.disablePlugins(AssemblyPlugin)
.dependsOn(fs2)
.settings(
commonSettings,
publish / skip := true,
libraryDependencies ++= Seq(
"co.fs2" %%% "fs2-io" % fs2Version
)
)
.disablePlugins(MimaPlugin)

val root = project
.in(file("."))
.settings(
publish / skip := true
)
.disablePlugins(MimaPlugin, AssemblyPlugin)
.aggregate(List(core, fs2, exampleServer, exampleClient).flatMap(_.projectRefs): _*)

// The core compiles are a workaround for https://github.com/plokhotnyuk/jsoniter-scala/issues/564
// when we switch to SN 0.5, we can use `makeWithSkipNestedOptionValues` instead: https://github.com/plokhotnyuk/jsoniter-scala/issues/564#issuecomment-2787096068
val compileCoreModules = {
for {
scalaVersionSuffix <- List("", "3")
platformSuffix <- List("", "JS", "Native")
task <- List("compile", "package")
} yield s"core$platformSuffix$scalaVersionSuffix/$task"
}.mkString(";")

addCommandAlias(
"ci",
s"$compileCoreModules;test;scalafmtCheckAll;mimaReportBinaryIssues"
)
Loading
Loading