Skip to content
New issue

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

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

Already on GitHub? # to your account

Update versions, fix tests, undertow implementation depends on isMultithreadingEnabled #170

Merged
merged 9 commits into from
Dec 12, 2024
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
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ jobs:
echo "deb https://packages.nginx.org/unit/ubuntu/ jammy unit" | sudo tee -a /etc/apt/sources.list.d/unit.list
echo "deb-src https://packages.nginx.org/unit/ubuntu/ jammy unit" | sudo tee -a /etc/apt/sources.list.d/unit.list
sudo apt-get update
unit_version="1.32*"
unit_version="1.33*"
sudo apt-get install -y libuv1-dev libidn2-dev unit=$unit_version unit-dev=$unit_version
- uses: actions/setup-java@v3
with:
java-version: "11"
architecture: "x64"
distribution: "temurin"
- name: Download dependencies
run:
run: |
./mill --disable-ticker __.prepareOffline
- name: Check formatting
run:
run: |
./mill --disable-ticker mill.scalalib.scalafmt.ScalafmtModule/checkFormatAll __.sources
./mill --disable-ticker --meta-level 1 mill.scalalib.scalafmt.ScalafmtModule/checkFormatAll
./mill --disable-ticker --meta-level 1 mill.scalalib.scalafmt.ScalafmtModule/checkFormatAll __.sources
# - name: Check scalafix
# run: ./mill --disable-ticker __.fix --check
- name: Compile
Expand Down
6 changes: 4 additions & 2 deletions integration/test/src/utils.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package snunit.test

import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
import scala.util.chaining._
import scala.util.control.NonFatal
Expand All @@ -12,11 +11,14 @@ private def runMillCommand(command: String) = os
.proc(
"./mill",
// adding `-i` breaks the ability to close unitd processes
"--no-build-lock",
"--disable-ticker",
"show",
command
)
.call()
.call(
cwd = os.Path(sys.env("MILL_WORKSPACE_ROOT"))
)

def withDeployedExample[T](projectName: String, crossSuffix: String = "")(f: => T): T = {
runMillCommand(s"integration.tests.$projectName$crossSuffix.deployTestApp")
Expand Down
7 changes: 1 addition & 6 deletions integration/tests/tapir-helloworld/src/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,8 @@ object TapirHelloWorld {
.serverLogic[Id](name => Right(s"Hello $name!"))

def main(args: Array[String]): Unit =
val parallelHandler = new snunit.RequestHandler {
def handleRequest(req: snunit.Request) = {
scala.concurrent.ExecutionContext.global.execute(() => toHandler(helloWorld :: Nil))
}
}
snunit.SyncServerBuilder
.setRequestHandler(parallelHandler)
.setRequestHandler(toHandler(helloWorld :: Nil))
.build()
.listen()
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
package io.undertow.server.handlers

import io.undertow.server._
import scala.scalanative.meta.LinktimeInfo

final class BlockingHandler(handler: HttpHandler) extends HttpHandler {
def handleRequest(exchange: HttpServerExchange): Unit = {
exchange.startBlocking()
scala.concurrent.ExecutionContext.global.execute(() =>
if (LinktimeInfo.isMultithreadingEnabled) {
scala.concurrent.ExecutionContext.global.execute(() =>
try { handler.handleRequest(exchange) }
finally { exchange.endExchange() }
)
} else {
try { handler.handleRequest(exchange) }
finally { exchange.endExchange() }
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class FormParserFactory private (builder: FormParserFactory.Builder) {
}
object FormParserFactory {
final class Builder private[FormParserFactory] () {
def withDefaultCharset(defaultCharset: String): Builder = this
def build(): FormParserFactory = new FormParserFactory(this)
}
def builder(): Builder = new Builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ final class HeaderValues private[undertow] (key: String, value: String)

// Members declared in java.util.List
def add(x$1: Int, x$2: String): Unit = ???
def addAll(x$1: Int, x$2: java.util.Collection[_ <: String]): Boolean = ???
def addAll(x$1: Int, x$2: java.util.Collection[? <: String]): Boolean = ???
def get(x$1: Int): String = ???
def indexOf(x$1: Object): Int = ???
def iterator(): java.util.Iterator[String] = Array(value).iterator.asJava
Expand Down
12 changes: 6 additions & 6 deletions versions.mill.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ 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.5"
val upickle = "4.0.1"
val scalaNative = "0.5.6"
val upickle = "4.0.2"
val undertow = "2.3.10.Final"
val scala212 = "2.12.19"
val scala3 = "3.4.2"
val tapir = "1.11.1"
val cask = "0.9.4"
val cask = "0.10.2"
val catsEffect = "3.6-623178c"
val http4s023 = "0.23.26"
val http4s1 = "1.0.0-M41"
val mill011 = "0.11.7"
val mill011 = "0.11.13"
val utest = "0.8.4"
val osLib = "0.9.2"
val sttp = "3.9.6"
val osLib = "0.11.3"
val sttp = "3.10.1"
val pprint = "0.9.0"
val castor = "0.3.0"
val scalaJavaTime = "2.6.0"
Expand Down