Просмотр исходного кода

Update SNUnit Scala Native framework (#6321)

* Update SNUnit Scala Native framework

* Update SNUnit to 0.0.6
Lorenzo Gabriele 4 лет назад
Родитель
Сommit
547a5392f8

+ 0 - 1
frameworks/Scala/snunit/.gitignore

@@ -1,2 +1 @@
 .bsp
-/lowered.hnir

+ 11 - 6
frameworks/Scala/snunit/build.sbt

@@ -1,12 +1,17 @@
-scalaVersion := "2.11.12"
+import scala.scalanative.build._
 
+scalaVersion := "2.13.4"
+
+val snunitVersion = "0.0.6"
 libraryDependencies ++= Seq(
-  "com.github.lolgab" %%% "snunit" % "0.0.2",
-  "com.github.lolgab" %%% "snunit-async" % "0.0.2",
-  "com.lihaoyi" %%% "upickle" % "1.2.2"
+  "com.github.lolgab" %%% "snunit" % snunitVersion,
+  "com.github.lolgab" %%% "snunit-async" % snunitVersion,
+  "com.lihaoyi" %%% "upickle" % "1.2.3"
 )
 
-nativeMode := "release-full"
-nativeLTO := "thin"
+nativeConfig ~= {
+  _.withMode(Mode.releaseFull)
+   .withLTO(LTO.thin)
+}
 
 enablePlugins(ScalaNativePlugin)

+ 1 - 1
frameworks/Scala/snunit/project/build.properties

@@ -1 +1 @@
-sbt.version=1.4.5
+sbt.version=1.4.6

+ 1 - 1
frameworks/Scala/snunit/project/plugins.sbt

@@ -1 +1 @@
-addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.0-M2")
+addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.0")

+ 1 - 1
frameworks/Scala/snunit/snunit.dockerfile

@@ -20,6 +20,6 @@ FROM nginx/unit:1.21.0-minimal
 RUN apt-get update && apt-get install -y libuv1
 
 COPY /config.json /docker-entrypoint.d/
-COPY --from=builder /workdir/target/scala-2.11/workdir-out /app/example
+COPY --from=builder /workdir/target/scala-2.13/workdir-out /app/example
 
 EXPOSE 8080

+ 3 - 3
frameworks/Scala/snunit/src/main/scala/Main.scala

@@ -13,19 +13,19 @@ object Main {
       .withRequestHandler(req =>
         if (req.method == Method.GET && req.path == "/plaintext")
           req.send(
-            statusCode = 200,
+            statusCode = StatusCode.OK,
             content = "Hello, World!",
             headers = Seq("Content-Type" -> "text/plain")
           )
         else if (req.method == Method.GET && req.path == "/json")
           req.send(
-            statusCode = 200,
+            statusCode = StatusCode.OK,
             content = stream(Message("Hello, World!")),
             headers = Seq.empty
           )
         else
           req.send(
-            statusCode = 404,
+            statusCode = StatusCode.NotFound,
             content = "Not found",
             headers = Seq("Content-Type" -> "text/plain")
           )