diff --git a/build.mill.scala b/build.mill.scala index 42df6ab..5d9cf56 100644 --- a/build.mill.scala +++ b/build.mill.scala @@ -92,16 +92,16 @@ object snunit extends Common.Native with Publish { } } -// object `snunit-async-cats-effect` extends Common.Native with Publish { -// def moduleDeps = Seq(snunit) +object `snunit-async-cats-effect` extends Common.Native with Publish { + def moduleDeps = Seq(snunit) -// def ivyDeps = -// Task { -// super.ivyDeps() ++ Agg( -// ivy"org.typelevel::cats-effect::${Versions.catsEffect}" -// ) -// } -// } + def ivyDeps = + Task { + super.ivyDeps() ++ Agg( + ivy"org.typelevel::cats-effect::${Versions.catsEffect}" + ) + } +} object `snunit-undertow` extends Common.Native with Publish { def moduleDeps = Seq(snunit) @@ -127,35 +127,40 @@ object `snunit-tapir` extends Common.Native with Publish { def moduleDeps = Seq(snunit) def ivyDeps = super.ivyDeps() ++ Agg(ivy"com.softwaremill.sttp.tapir::tapir-server::${Versions.tapir}") } -// object `snunit-tapir-cats-effect` extends Common.Native with Publish { -// def moduleDeps = Seq( -// `snunit-tapir`, -// `snunit-async-cats-effect` -// ) -// def ivyDeps = super.ivyDeps() ++ Agg( -// ivy"com.softwaremill.sttp.tapir::tapir-cats-effect::${Versions.tapir}" -// ) -// } +object `snunit-tapir-cats-effect` extends Common.Native with Publish { + def moduleDeps = Seq( + `snunit-tapir`, + `snunit-async-cats-effect` + ) + def ivyDeps = super.ivyDeps() ++ Agg( + ivy"com.softwaremill.sttp.tapir::tapir-cats-effect::${Versions.tapir}" + ) +} -// object `snunit-http4s` extends Cross[SNUnitHttp4s] -// trait SNUnitHttp4s extends Common.Native with Cross.Module[String] with Publish { -// val http4sVersion = crossValue -// def moduleDeps = Seq( -// snunit, -// `snunit-async-cats-effect` -// ) -// val http4sBinaryVersion = http4sVersion match { -// case s"0.23.$_" => "0.23" -// case s"1.$_" => "1" -// } -// def artifactName = s"snunit-http4s$http4sBinaryVersion" -// def ivyDeps = super.ivyDeps() ++ Agg( -// ivy"org.http4s::http4s-server::$http4sVersion" -// ) -// def sources = T.sources { -// super.sources() ++ Agg(PathRef(millSourcePath / s"http4s-$http4sBinaryVersion" / "src")) -// } -// } +object `snunit-http4s` extends Common.Native with Publish { + val http4sVersion = Versions.http4s023 + def moduleDeps = Seq( + snunit, + `snunit-async-cats-effect` + ) + val http4sBinaryVersion = http4sVersion match { + case s"0.23.$_" => "0.23" + case s"1.$_" => "1" + } + def artifactName = s"snunit-http4s$http4sBinaryVersion" + def ivyDeps = super.ivyDeps() ++ Agg( + ivy"org.http4s::http4s-server::$http4sVersion" + ) + def sources = T.sources { + super.sources() ++ Agg(PathRef(millSourcePath / s"http4s-$http4sBinaryVersion" / "src")) + } + + def repositoriesTask = Task.Anon { + super.repositoriesTask() ++ Seq( + coursier.MavenRepository("https://central.sonatype.com/repository/maven-snapshots/") + ) + } +} def caskSources = Task { val dest = Task.dest diff --git a/snunit-async-cats-effect/src/snunit/CEAsyncServerBuilder.scala b/snunit-async-cats-effect/src/snunit/CEAsyncServerBuilder.scala index cb979a3..5b89b34 100644 --- a/snunit-async-cats-effect/src/snunit/CEAsyncServerBuilder.scala +++ b/snunit-async-cats-effect/src/snunit/CEAsyncServerBuilder.scala @@ -126,9 +126,10 @@ private[snunit] object CEAsyncServerBuilder { ) ) - def stop(): Unit = { + def stop(): Unit = this.synchronized { stopped = true - PortData.stopped.put(this, ()) + PortData.stop(this) + } } @@ -139,9 +140,14 @@ private[snunit] object CEAsyncServerBuilder { def isLastFDStopped: Boolean = references == stopped + def stop(pd: PortData): Unit = + this.synchronized: + PortData.stopped.put(pd, ()) + def register(ctx: nxt_unit_ctx_t_*, port: nxt_unit_port_t_*): Unit = val portData = new PortData(ctx, port) - references.put(portData, ()) + this.synchronized: + references.put(portData, ()) port.data = fromRawPtr(Intrinsics.castObjectToRawPtr(portData)) def fromPort(port: nxt_unit_port_t_*): PortData = { diff --git a/versions.mill.scala b/versions.mill.scala index 79a8486..bbe4466 100644 --- a/versions.mill.scala +++ b/versions.mill.scala @@ -3,15 +3,15 @@ package build // This file is system-linked in sbt-plugin/project/Versions.scala // It needs to be a valid Scala file so we can't use top level `val`s object Versions { - val scalaNative = "0.5.7" + val scalaNative = "0.5.8" val upickle = "4.0.2" val undertow = "2.3.18.Final" val scala212 = "2.12.19" - val scala3 = "3.3.4" - val tapir = "1.11.1" + val scala3 = "3.3.6" + val tapir = "1.11.44" val cask = "0.10.2" - val catsEffect = "3.6-623178c" - val http4s023 = "0.23.26" + val catsEffect = "3.7.0-RC1" + val http4s023 = "0.23.30-161-f5b9629-SNAPSHOT" val http4s1 = "1.0.0-M41" val mill011 = "0.11.13" val utest = "0.8.4"