Skip to content
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

Update scala-library to 2.13.12 #169

Merged
merged 7 commits into from
Nov 28, 2023
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
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
coverage-aggregate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: olafurpg/setup-scala@v13
- uses: actions/checkout@v4
- uses: coursier/setup-action@v1
- name: branch-names
id: branch-name
uses: tj-actions/branch-names@v2.2
uses: tj-actions/branch-names@v7
- run: sbt coverage +test coverageReport
- run: sbt coverageAggregate coveralls
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sbt-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ jobs:
publish:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2.3.4
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: olafurpg/setup-scala@v10
- uses: coursier/setup-action@v1
- uses: olafurpg/setup-gpg@v3
- run: sbt ci-release
env:
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.idea/
.bsp/
target/
target/
.bloop/
.metals/
.vscode/
metals.sbt
12 changes: 5 additions & 7 deletions all/src/main/scala/zhongl/stream/netty/all/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import scala.reflect.ClassTag

package object all {

implicit val sct: Transport[SocketChannel] = findAvailable[SocketTransports, SocketChannel]
implicit val ssct: Transport[ServerSocketChannel] = findAvailable[SocketTransports, ServerSocketChannel]
implicit val dsct: Transport[DomainSocketChannel] = findAvailable[DomainSocketTransports, DomainSocketChannel]
implicit val sdsct: Transport[ServerDomainSocketChannel] = findAvailable[DomainSocketTransports, ServerDomainSocketChannel]
implicit def sct: Transport[SocketChannel] = findAvailable[SocketTransports, SocketChannel]
implicit def ssct: Transport[ServerSocketChannel] = findAvailable[SocketTransports, ServerSocketChannel]
implicit def dsct: Transport[DomainSocketChannel] = findAvailable[DomainSocketTransports, DomainSocketChannel]
implicit def sdsct: Transport[ServerDomainSocketChannel] = findAvailable[DomainSocketTransports, ServerDomainSocketChannel]

implicit private def stss: Seq[SocketTransports] = Seq(EpollTransports, KQueueTransports, NioTransports)
implicit private def dstss: Seq[DomainSocketTransports] = Seq(EpollTransports, KQueueTransports)
Expand All @@ -37,9 +37,7 @@ package object all {
c: ClassTag[C],
g: GetTransport[T, C]
): Transport[C] = {
s.find(_.available).map(g(_)).getOrElse {
throw new IllegalStateException(s"${c.runtimeClass.getName} is unavailable in your environment")
}
s.find(_.available).map(g(_)).getOrElse { Transport.dummy[C] }
}

}
10 changes: 7 additions & 3 deletions all/src/test/scala/zhongl/stream/netty/all/ImplicitlySpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package zhongl.stream.netty.all

import java.net._
import java.nio.file.Files
import scala.concurrent.Future
import akka.actor.ActorSystem
import akka.stream.{ActorMaterializer, Materializer}
import akka.stream.scaladsl.{Flow, Sink, Source}
Expand Down Expand Up @@ -45,7 +46,7 @@ class ImplicitlySpec extends TestKit(ActorSystem("implicitly")) with AsyncWordSp
} else if (Epoll.isAvailable) {
cc shouldBe classOf[EpollDomainSocketChannel]
} else {
assertThrows[IllegalStateException](cc)
cc shouldBe classOf[DomainSocketChannel]
}
}

Expand All @@ -62,7 +63,10 @@ class ImplicitlySpec extends TestKit(ActorSystem("implicitly")) with AsyncWordSp
}
}

private def runEcho[C <: DuplexChannel, S <: ServerChannel](address: SocketAddress)(implicit t: Transport[C], s: Transport[S]) = {
private def runEcho[C <: DuplexChannel, S <: ServerChannel](
address: SocketAddress
)(implicit t: Transport[C], s: Transport[S]): Future[Assertion] = {
if (t.isInstanceOf[Transport.Dummy[C]]) return Future(Assertions.succeed)
Netty().bindAndHandle[S](Flow[ByteString].map(identity), address).flatMap { sb =>
val msg = ByteString("a")
Source
Expand All @@ -73,5 +77,5 @@ class ImplicitlySpec extends TestKit(ActorSystem("implicitly")) with AsyncWordSp
.flatMap(a => sb.unbind().map(_ => a))
}
}
override protected def afterAll(): Unit = TestKit.shutdownActorSystem(system)
override protected def afterAll(): Unit = TestKit.shutdownActorSystem(system)
}
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import Dependencies._

inThisBuild(
Seq(
scalaVersion := "2.13.8",
scalaVersion := "2.13.12",
scalafmtOnCompile := true,
scalacOptions ++= Seq(
"-deprecation",
"-encoding",
"UTF-8"
),
crossScalaVersions := Seq(scalaVersion.value, "2.12.15"),
crossScalaVersions := Seq(scalaVersion.value, "2.12.18"),
organization := "com.github.zhongl",
homepage := Some(url("https://github.com/hanabix/akka-stream-netty")),
licenses := List(
Expand Down
8 changes: 8 additions & 0 deletions core/src/main/scala/zhongl/stream/netty/Transport.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,12 @@ object Transport {
override def channel = implicitly[ClassTag[C]].runtimeClass.asInstanceOf[Class[C]]
override def group = _group
}

def dummy[C <: Channel: ClassTag] = new Dummy(implicitly[ClassTag[C]])

class Dummy[C <: Channel](c: ClassTag[C]) extends Transport[C] {
override def channel: Class[_ <: C] = c.runtimeClass.asInstanceOf[Class[C]]
override def group: EventLoopGroup = throw new UnsupportedOperationException(s"${channel.getName} is unavailable in your environment")

}
}
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version = 1.7.2
sbt.version = 1.9.7
9 changes: 0 additions & 9 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.9.2")

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.9")

addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.3.11")

addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")

addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1")

addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.13")

addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")

addSbtPlugin("com.github.sbt" % "sbt-git" % "2.0.0")

addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")