Skip to content

Commit ade9fdb

Browse files
authored
Bump scala and deps, move to sbt (#75)
1 parent 80a82f0 commit ade9fdb

File tree

40 files changed

+227
-510
lines changed

40 files changed

+227
-510
lines changed

.github/workflows/ci.yml

+27-21
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,34 @@ concurrency:
1010
group: ci-${{ github.ref }}
1111
cancel-in-progress: true
1212

13-
1413
jobs:
1514
build:
16-
runs-on: ubuntu-latest
1715
strategy:
18-
fail-fast: true
19-
16+
fail-fast: false
17+
runs-on: ubuntu-latest
2018
steps:
21-
- name: Checkout
22-
uses: actions/checkout@v2
23-
24-
- name: Cache
25-
uses: coursier/cache-action@v6
26-
27-
- name: Setup Java
28-
uses: actions/setup-java@v2
29-
with:
30-
distribution: adopt
31-
java-version: 11
32-
33-
- name: Run tests
34-
run: |
35-
./mill -k --disable-ticker __.resolvedIvyDeps &&
36-
./mill -k --disable-ticker mill.scalalib.scalafmt.ScalafmtModule/checkFormatAll __.sources &&
37-
./mill -j 0 -k --disable-ticker __.test
19+
- uses: actions/checkout@v3
20+
with:
21+
fetch-depth: 0
22+
23+
- uses: actions/setup-java@v3
24+
with:
25+
distribution: "temurin"
26+
java-version: "21"
27+
cache: "sbt"
28+
29+
- name: Setup sbt
30+
uses: sbt/setup-sbt@v1
31+
32+
- name: Test
33+
run: sbt ci
34+
35+
- name: Publish ${{ github.ref }}
36+
# todo: uncomment
37+
# if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || (github.ref == 'refs/heads/main'))
38+
run: sbt ci-release
39+
env:
40+
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
41+
PGP_SECRET: ${{ secrets.PGP_SECRET }}
42+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
43+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}

.mill-version

-1
This file was deleted.

.sbtopts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-J-Xmx6g

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ override def ivyDeps = super.ivyDeps() ++ Agg(ivy"tech.neander::jsonrpclib-fs2::
3838

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

41-
See the examples folder.
41+
See the modules/examples folder.

build.sbt

+132
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
import org.typelevel.sbt.tpolecat.DevMode
2+
import org.typelevel.sbt.tpolecat.OptionsMode
3+
import java.net.URI
4+
5+
inThisBuild(
6+
List(
7+
organization := "tech.neander",
8+
homepage := Some(url("https://github.com/neandertech/jsonrpclib")),
9+
licenses := List(License.Apache2),
10+
developers := List(
11+
Developer("Baccata", "Olivier Mélois", "[email protected]", URI.create("https://github.com/baccata").toURL)
12+
),
13+
sonatypeCredentialHost := "s01.oss.sonatype.org",
14+
sonatypeRepository := "https://s01.oss.sonatype.org/service/local"
15+
)
16+
)
17+
18+
val scala213 = "2.13.16"
19+
val scala3 = "3.3.5"
20+
val allScalaVersions = List(scala213, scala3)
21+
val jvmScalaVersions = allScalaVersions
22+
val jsScalaVersions = allScalaVersions
23+
val nativeScalaVersions = allScalaVersions
24+
25+
val fs2Version = "3.12.0"
26+
27+
ThisBuild / tpolecatOptionsMode := DevMode
28+
29+
val commonSettings = Seq(
30+
libraryDependencies ++= Seq(
31+
"com.disneystreaming" %%% "weaver-cats" % "0.8.4" % Test
32+
),
33+
mimaPreviousArtifacts := Set(
34+
organization.value %%% name.value % "0.0.7"
35+
),
36+
scalacOptions += "-java-output-version:8"
37+
)
38+
39+
val core = projectMatrix
40+
.in(file("modules") / "core")
41+
.jvmPlatform(
42+
jvmScalaVersions,
43+
Test / unmanagedSourceDirectories ++= Seq(
44+
(projectMatrixBaseDirectory.value / "src" / "test" / "scalajvm-native").getAbsoluteFile
45+
)
46+
)
47+
.jsPlatform(jsScalaVersions)
48+
.nativePlatform(
49+
nativeScalaVersions,
50+
Test / unmanagedSourceDirectories ++= Seq(
51+
(projectMatrixBaseDirectory.value / "src" / "test" / "scalajvm-native").getAbsoluteFile
52+
)
53+
)
54+
.disablePlugins(AssemblyPlugin)
55+
.settings(
56+
name := "jsonrpclib-core",
57+
commonSettings,
58+
libraryDependencies ++= Seq(
59+
"com.github.plokhotnyuk.jsoniter-scala" %%% "jsoniter-scala-macros" % "2.30.2"
60+
)
61+
)
62+
63+
val fs2 = projectMatrix
64+
.in(file("modules") / "fs2")
65+
.jvmPlatform(jvmScalaVersions)
66+
.jsPlatform(jsScalaVersions)
67+
.nativePlatform(nativeScalaVersions)
68+
.disablePlugins(AssemblyPlugin)
69+
.dependsOn(core)
70+
.settings(
71+
name := "jsonrpclib-fs2",
72+
commonSettings,
73+
libraryDependencies ++= Seq(
74+
"co.fs2" %%% "fs2-core" % fs2Version
75+
)
76+
)
77+
78+
val exampleServer = projectMatrix
79+
.in(file("modules") / "examples/server")
80+
.jvmPlatform(List(scala213))
81+
.dependsOn(fs2)
82+
.settings(
83+
commonSettings,
84+
publish / skip := true,
85+
libraryDependencies ++= Seq(
86+
"co.fs2" %%% "fs2-io" % fs2Version
87+
)
88+
)
89+
.disablePlugins(MimaPlugin)
90+
91+
val exampleClient = projectMatrix
92+
.in(file("modules") / "examples/client")
93+
.jvmPlatform(
94+
List(scala213),
95+
Seq(
96+
fork := true,
97+
envVars += "SERVER_JAR" -> (exampleServer.jvm(scala213) / assembly).value.toString
98+
)
99+
)
100+
.disablePlugins(AssemblyPlugin)
101+
.dependsOn(fs2)
102+
.settings(
103+
commonSettings,
104+
publish / skip := true,
105+
libraryDependencies ++= Seq(
106+
"co.fs2" %%% "fs2-io" % fs2Version
107+
)
108+
)
109+
.disablePlugins(MimaPlugin)
110+
111+
val root = project
112+
.in(file("."))
113+
.settings(
114+
publish / skip := true
115+
)
116+
.disablePlugins(MimaPlugin, AssemblyPlugin)
117+
.aggregate(List(core, fs2, exampleServer, exampleClient).flatMap(_.projectRefs): _*)
118+
119+
// The core compiles are a workaround for https://github.com/plokhotnyuk/jsoniter-scala/issues/564
120+
// when we switch to SN 0.5, we can use `makeWithSkipNestedOptionValues` instead: https://github.com/plokhotnyuk/jsoniter-scala/issues/564#issuecomment-2787096068
121+
val compileCoreModules = {
122+
for {
123+
scalaVersionSuffix <- List("", "3")
124+
platformSuffix <- List("", "JS", "Native")
125+
task <- List("compile", "package")
126+
} yield s"core$platformSuffix$scalaVersionSuffix/$task"
127+
}.mkString(";")
128+
129+
addCommandAlias(
130+
"ci",
131+
s"$compileCoreModules;test;scalafmtCheckAll;mimaReportBinaryIssues"
132+
)

0 commit comments

Comments
 (0)