diff --git a/.scalafix.conf b/.scalafix.conf index 5bc5b4e..0a711f8 100644 --- a/.scalafix.conf +++ b/.scalafix.conf @@ -1,8 +1,5 @@ rules=[ - ExplicitResultTypes, - RemoveUnused, DisableSyntax, LeakingImplicitClassVal, NoValInForComprehension, - ProcedureSyntax ] diff --git a/.scalafmt.conf b/.scalafmt.conf index 9567408..79c162d 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,3 +1,3 @@ version="3.3.1" maxColumn = 120 -runner.dialect = scala213source3 +runner.dialect = scala3 diff --git a/build.sbt b/build.sbt index a0313f0..f95d684 100644 --- a/build.sbt +++ b/build.sbt @@ -2,25 +2,24 @@ lazy val root = (project in file(".")).settings( inThisBuild( List( organization := "com.example", - scalaVersion := "2.13.7", + scalaVersion := "3.1.0", version := "0.1.0-SNAPSHOT", semanticdbEnabled := true, semanticdbVersion := scalafixSemanticdb.revision, - scalafixScalaBinaryVersion := "2.13" + + // This is apparently not supported on Scala 3 currently + // scalafixScalaBinaryVersion := "3.1" ) ), name := "LibreCaptcha", libraryDependencies += "com.sksamuel.scrimage" % "scrimage-core" % "4.0.24", libraryDependencies += "com.sksamuel.scrimage" % "scrimage-filters" % "4.0.24", - libraryDependencies += "org.json4s" % "json4s-jackson_2.13" % "4.0.3" + libraryDependencies += "org.json4s" %% "json4s-jackson" % "4.0.3" ) Compile / unmanagedResourceDirectories += { baseDirectory.value / "lib" } scalacOptions ++= List( - "-Yrangepos", - "-Ywarn-unused", "-deprecation", - "-Xsource:3" ) javacOptions += "-g:none" compileOrder := CompileOrder.JavaThenScala diff --git a/src/main/scala/lc/core/config.scala b/src/main/scala/lc/core/config.scala index 83d84e3..cee03a4 100644 --- a/src/main/scala/lc/core/config.scala +++ b/src/main/scala/lc/core/config.scala @@ -4,6 +4,9 @@ import scala.io.Source.fromFile import org.json4s.{DefaultFormats, JValue, JObject, JField, JString} import org.json4s.jackson.JsonMethods.{parse, render, pretty} import org.json4s.JsonDSL._ +import org.json4s.StringInput +import org.json4s.jvalue2monadic +import org.json4s.jvalue2extractable import java.io.{FileNotFoundException, File, PrintWriter} import java.{util => ju} import lc.misc.HelperFunctions diff --git a/src/main/scala/lc/server/Server.scala b/src/main/scala/lc/server/Server.scala index 5134373..54af9b7 100644 --- a/src/main/scala/lc/server/Server.scala +++ b/src/main/scala/lc/server/Server.scala @@ -1,6 +1,7 @@ package lc.server import org.json4s.jackson.JsonMethods.parse +import org.json4s.jvalue2extractable import lc.core.Captcha import lc.core.ErrorMessageEnum import lc.core.{Answer, ByteConvert, Error, Id, Parameters} diff --git a/tests/run.sh b/tests/run.sh index b26a54b..badfafb 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -4,7 +4,7 @@ python3 -m venv testEnv source ./testEnv/bin/activate pip install locust mkdir -p data/ -java -jar target/scala-2.13/LibreCaptcha.jar & +java -jar target/scala-3.1.0/LibreCaptcha.jar & JAVA_PID=$! sleep 4 @@ -22,7 +22,7 @@ echo Run functional test cp data/config.json data/config.json.bak cp tests/debug-config.json data/config.json -java -jar target/scala-2.13/LibreCaptcha.jar & +java -jar target/scala-3.1.0/LibreCaptcha.jar & JAVA_PID=$! sleep 4