Skip to content

Commit

Permalink
Merge branch 'main' into using-test-control
Browse files Browse the repository at this point in the history
  • Loading branch information
danicheg committed Nov 28, 2021
2 parents df62117 + 72ac3d7 commit 3b5edc5
Show file tree
Hide file tree
Showing 131 changed files with 8,485 additions and 423 deletions.
36 changes: 18 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [3.0.2, 2.12.15, 2.13.6]
scala: [3.1.0, 2.12.15, 2.13.7]
java: [adoptium@17]
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -59,16 +59,16 @@ jobs:
- run: sbt ++${{ matrix.scala }} fmtCheck test mimaReportBinaryIssues

- name: Scalafix tests
if: matrix.scala == '2.13.6'
if: matrix.scala == '2.13.7'
run: |
cd scalafix
sbt testCI
- if: matrix.scala == '2.13.6'
- if: matrix.scala == '2.13.7'
run: sbt ++${{ matrix.scala }} microsite/mdoc

- name: Compress target directories
run: tar cf targets.tar target node/js/target core/js/target core/jvm/target io/js/target reactive-streams/target io/jvm/target benchmark/target project/target
run: tar cf targets.tar target node/js/target protocols/js/target core/js/target core/jvm/target scodec/jvm/target scodec/js/target io/js/target reactive-streams/target io/jvm/target protocols/jvm/target benchmark/target project/target

- name: Upload target directories
uses: actions/upload-artifact@v2
Expand All @@ -83,7 +83,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.6]
scala: [2.13.7]
java: [adoptium@17]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -109,12 +109,12 @@ jobs:
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Download target directories (3.0.2)
- name: Download target directories (3.1.0)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-3.0.2-${{ matrix.java }}
name: target-${{ matrix.os }}-3.1.0-${{ matrix.java }}

- name: Inflate target directories (3.0.2)
- name: Inflate target directories (3.1.0)
run: |
tar xf targets.tar
rm targets.tar
Expand All @@ -129,12 +129,12 @@ jobs:
tar xf targets.tar
rm targets.tar
- name: Download target directories (2.13.6)
- name: Download target directories (2.13.7)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-2.13.6-${{ matrix.java }}
name: target-${{ matrix.os }}-2.13.7-${{ matrix.java }}

- name: Inflate target directories (2.13.6)
- name: Inflate target directories (2.13.7)
run: |
tar xf targets.tar
rm targets.tar
Expand All @@ -151,16 +151,16 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.6]
scala: [2.13.7]
java: [adoptium@17]
runs-on: ${{ matrix.os }}
steps:
- name: Download target directories (3.0.2)
- name: Download target directories (3.1.0)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-3.0.2-${{ matrix.java }}
name: target-${{ matrix.os }}-3.1.0-${{ matrix.java }}

- name: Inflate target directories (3.0.2)
- name: Inflate target directories (3.1.0)
run: |
tar xf targets.tar
rm targets.tar
Expand All @@ -175,12 +175,12 @@ jobs:
tar xf targets.tar
rm targets.tar
- name: Download target directories (2.13.6)
- name: Download target directories (2.13.7)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-2.13.6-${{ matrix.java }}
name: target-${{ matrix.os }}-2.13.7-${{ matrix.java }}

- name: Inflate target directories (2.13.6)
- name: Inflate target directories (2.13.7)
run: |
tar xf targets.tar
rm targets.tar
Expand Down
13 changes: 11 additions & 2 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
version = "2.7.5"
version = "3.1.2"

style = default

runner.dialect = scala213source3

project.excludeFilters = [
"scalafix/*"
]

docstrings.wrap = "no"

maxColumn = 100

rewrite.rules = [
Expand All @@ -28,4 +36,5 @@ rewrite.neverInfix.excludeFilters = [until
have
when
size
theSameElementsAs]
theSameElementsAs
at]
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Remember to follow the [code of conduct][coc] in online and offline discourse.

### Prerequisites

You'll need JDK 11, [sbt][sbt], [Node.js][node] (for running Scala.js tests) and [Jekyll][jekyll] (for building the microsite).
You'll need JDK 16, [sbt][sbt], [Node.js][node] (for running Scala.js tests) and [Jekyll][jekyll] (for building the microsite).

We use several sbt plugins to build and check the project, including [MiMa (Migration Manager)][mima], [scalafmt][scalafmt] and [sbt-microsites][sbt-microsites].

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class ParEvalMapBenchmark {
def parEvalMapUnordered10(): Unit =
execute(getStream.parEvalMapUnordered(10)(_ => dummyLoad))

private def getStream: Stream[IO, Unit] = Stream.constant((), chunkSize).take(size).covary[IO]
private def getStream: Stream[IO, Unit] =
Stream.constant((), chunkSize).take(size.toLong).covary[IO]
private def execute(s: Stream[IO, Unit]): Unit = s.compile.drain.unsafeRunSync()
}
2 changes: 1 addition & 1 deletion build-site.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ You can build the site and preview it locally.
## With Nix

1. Run `nix-shell --run "sbt 'microsite/mdoc --watch'"`.
2. Run `nix-shell --run "node_modules/docsify-cli/bin/docsify serve target/website/docs/"` in a different terminal.
2. Run `nix-shell --run "node_modules/docsify-cli/bin/docsify serve target/website/"` in a different terminal.

## Without Nix

Expand Down
125 changes: 104 additions & 21 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import com.typesafe.tools.mima.core._
import sbtcrossproject.crossProject

addCommandAlias("fmt", "; compile:scalafmt; test:scalafmt; it:scalafmt; scalafmtSbt")
addCommandAlias("fmt", "; Compile/scalafmt; Test/scalafmt; IntegrationTest/scalafmt; scalafmtSbt")
addCommandAlias(
"fmtCheck",
"; compile:scalafmtCheck; test:scalafmtCheck; it:scalafmtCheck; scalafmtSbtCheck"
"; Compile/scalafmtCheck; Test/scalafmtCheck; IntegrationTest/scalafmtCheck; scalafmtSbtCheck"
)
addCommandAlias("testJVM", ";rootJVM/test")
addCommandAlias("testJS", "rootJS/test")

Global / onChangedBuildSource := ReloadOnSourceChanges
Global / stQuiet := true

ThisBuild / baseVersion := "3.1"
ThisBuild / baseVersion := "3.2"

ThisBuild / organization := "co.fs2"
ThisBuild / organizationName := "Functional Streams for Scala"

ThisBuild / homepage := Some(url("https://github.com/typelevel/fs2"))
ThisBuild / startYear := Some(2013)

val NewScala = "2.13.6"
val NewScala = "2.13.7"

ThisBuild / crossScalaVersions := Seq("3.0.2", "2.12.15", NewScala)
ThisBuild / crossScalaVersions := Seq("3.1.0", "2.12.15", NewScala)

ThisBuild / githubWorkflowEnv += ("JABBA_INDEX" -> "https://github.com/typelevel/jdk-index/raw/main/index.json")
ThisBuild / githubWorkflowJavaVersions := Seq("adoptium@17")
Expand Down Expand Up @@ -153,13 +153,38 @@ ThisBuild / mimaBinaryIssueFilters ++= Seq(
ProblemFilters.exclude[MissingClassProblem]("fs2.Compiler$TargetLowPriority$MonadCancelTarget"),
ProblemFilters.exclude[MissingClassProblem]("fs2.Compiler$TargetLowPriority$MonadErrorTarget"),
ProblemFilters.exclude[MissingTypesProblem]("fs2.Compiler$TargetLowPriority$SyncTarget"),
ProblemFilters.exclude[MissingClassProblem]("fs2.Chunk$VectorChunk")
ProblemFilters.exclude[MissingClassProblem]("fs2.Chunk$VectorChunk"),
ProblemFilters.exclude[ReversedMissingMethodProblem](
"fs2.compression.DeflateParams.fhCrcEnabled"
),
ProblemFilters.exclude[DirectMissingMethodProblem](
"fs2.compression.DeflateParams#DeflateParamsImpl.copy"
),
ProblemFilters.exclude[DirectMissingMethodProblem](
"fs2.compression.DeflateParams#DeflateParamsImpl.this"
),
ProblemFilters.exclude[MissingTypesProblem]("fs2.compression.DeflateParams$DeflateParamsImpl$"),
ProblemFilters.exclude[DirectMissingMethodProblem](
"fs2.compression.DeflateParams#DeflateParamsImpl.apply"
)
)

lazy val root = project
.in(file("."))
.enablePlugins(NoPublishPlugin, SonatypeCiReleasePlugin)
.aggregate(coreJVM, coreJS, io.jvm, node.js, io.js, reactiveStreams, benchmark)
.aggregate(
coreJVM,
coreJS,
io.jvm,
node.js,
io.js,
scodec.jvm,
scodec.js,
protocols.jvm,
protocols.js,
reactiveStreams,
benchmark
)

lazy val rootJVM = project
.in(file("."))
Expand All @@ -186,8 +211,8 @@ lazy val core = crossProject(JVMPlatform, JSPlatform)
"org.typelevel" %%% "cats-effect-laws" % "3.3-162-2022ef9" % Test,
"org.typelevel" %%% "cats-effect-testkit" % "3.3-162-2022ef9" % Test,
"org.scodec" %%% "scodec-bits" % "1.1.29",
"org.typelevel" %%% "scalacheck-effect-munit" % "1.0.2" % Test,
"org.typelevel" %%% "munit-cats-effect-3" % "1.0.5" % Test,
"org.typelevel" %%% "scalacheck-effect-munit" % "1.0.3" % Test,
"org.typelevel" %%% "munit-cats-effect-3" % "1.0.6" % Test,
"org.typelevel" %%% "discipline-munit" % "1.0.9" % Test
),
Compile / unmanagedSourceDirectories ++= {
Expand Down Expand Up @@ -247,16 +272,24 @@ lazy val node = crossProject(JSPlatform)
stOutputPackage := "fs2.internal.jsdeps",
stPrivateWithin := Some("fs2"),
stStdlib := List("es2020"),
stUseScalaJsDom := false,
stIncludeDev := true
)

lazy val io = crossProject(JVMPlatform, JSPlatform)
.in(file("io"))
.enablePlugins(SbtOsgi)
.jsConfigure(_.enablePlugins(ScalaJSBundlerPlugin))
.jvmEnablePlugins(SbtOsgi)
.jsEnablePlugins(ScalaJSBundlerPlugin)
.settings(
name := "fs2-io",
libraryDependencies += "com.comcast" %%% "ip4s-core" % "3.0.4",
libraryDependencies += "com.comcast" %%% "ip4s-core" % "3.1.1"
)
.jvmSettings(
Test / fork := true,
libraryDependencies ++= Seq(
"com.github.jnr" % "jnr-unixsocket" % "0.38.13" % Optional,
"com.google.jimfs" % "jimfs" % "1.2" % Test
),
OsgiKeys.exportPackage := Seq("fs2.io.*"),
OsgiKeys.privatePackage := Seq(),
OsgiKeys.importPackage := {
Expand All @@ -270,13 +303,6 @@ lazy val io = crossProject(JVMPlatform, JSPlatform)
OsgiKeys.additionalHeaders := Map("-removeheaders" -> "Include-Resource,Private-Package"),
osgiSettings
)
.jvmSettings(
Test / fork := true,
libraryDependencies ++= Seq(
"com.github.jnr" % "jnr-unixsocket" % "0.38.11" % Optional,
"com.google.jimfs" % "jimfs" % "1.2" % Test
)
)
.jsSettings(
scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule)),
Test / npmDevDependencies += "jks-js" -> "1.0.1",
Expand All @@ -286,6 +312,63 @@ lazy val io = crossProject(JVMPlatform, JSPlatform)
.dependsOn(core % "compile->compile;test->test")
.jsConfigure(_.dependsOn(node.js))

lazy val scodec = crossProject(JVMPlatform, JSPlatform)
.in(file("scodec"))
.enablePlugins(SbtOsgi)
.settings(
name := "fs2-scodec",
libraryDependencies += "org.scodec" %%% "scodec-core" % (if (
scalaVersion.value.startsWith("2.")
)
"1.11.9"
else "2.1.0"),
OsgiKeys.exportPackage := Seq("fs2.interop.scodec.*"),
OsgiKeys.privatePackage := Seq(),
OsgiKeys.importPackage := {
val Some((major, minor)) = CrossVersion.partialVersion(scalaVersion.value)
Seq(
s"""scala.*;version="[$major.$minor,$major.${minor + 1})"""",
"""fs2.*;version="${Bundle-Version}"""",
"*"
)
},
OsgiKeys.additionalHeaders := Map("-removeheaders" -> "Include-Resource,Private-Package"),
osgiSettings,
mimaPreviousArtifacts := mimaPreviousArtifacts.value.filter { v =>
VersionNumber(v.revision).matchesSemVer(SemanticSelector(">3.2.0"))
}
)
.jsSettings(
scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule))
)
.dependsOn(core % "compile->compile;test->test", io % "test")

lazy val protocols = crossProject(JVMPlatform, JSPlatform)
.in(file("protocols"))
.enablePlugins(SbtOsgi)
.settings(
name := "fs2-protocols",
OsgiKeys.exportPackage := Seq("fs2.protocols.*"),
OsgiKeys.privatePackage := Seq(),
OsgiKeys.importPackage := {
val Some((major, minor)) = CrossVersion.partialVersion(scalaVersion.value)
Seq(
s"""scala.*;version="[$major.$minor,$major.${minor + 1})"""",
"""fs2.*;version="${Bundle-Version}"""",
"*"
)
},
OsgiKeys.additionalHeaders := Map("-removeheaders" -> "Include-Resource,Private-Package"),
osgiSettings,
mimaPreviousArtifacts := mimaPreviousArtifacts.value.filter { v =>
VersionNumber(v.revision).matchesSemVer(SemanticSelector(">3.2.0"))
}
)
.jsSettings(
scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule))
)
.dependsOn(core % "compile->compile;test->test", scodec, io)

lazy val reactiveStreams = project
.in(file("reactive-streams"))
.enablePlugins(SbtOsgi)
Expand Down Expand Up @@ -336,13 +419,13 @@ lazy val microsite = project
githubWorkflowArtifactUpload := false,
fatalWarningsInCI := false
)
.dependsOn(coreJVM, io.jvm, reactiveStreams)
.dependsOn(coreJVM, io.jvm, reactiveStreams, scodec.jvm)
.enablePlugins(MdocPlugin, NoPublishPlugin)

ThisBuild / githubWorkflowBuildPostamble ++= List(
WorkflowStep.Sbt(
List("microsite/mdoc"),
cond = Some(s"matrix.scala == '2.13.6'")
cond = Some(s"matrix.scala == '2.13.7'")
)
)

Expand Down
8 changes: 8 additions & 0 deletions core/jvm/src/it/scala/fs2/MemoryLeakSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -287,4 +287,12 @@ class MemoryLeakSpec extends FunSuite {
leakTest("merge + parJoinUnbounded") {
Stream(Stream.constant(1).covary[IO].merge(Stream())).parJoinUnbounded
}

leakTest("observe + zip") {
Stream
.iterate(0)(_ + 1)
.covary[IO]
.observe(_.drain)
.zipLeft(Stream.constant(1))
}
}
Loading

0 comments on commit 3b5edc5

Please sign in to comment.