Merge pull request #120 from librecaptcha/scala3

update to scala 3
This commit is contained in:
hrj 2022-01-03 19:08:21 +05:30 committed by GitHub
commit d706d91ee1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 12 deletions

View File

@ -1,8 +1,5 @@
rules=[ rules=[
ExplicitResultTypes,
RemoveUnused,
DisableSyntax, DisableSyntax,
LeakingImplicitClassVal, LeakingImplicitClassVal,
NoValInForComprehension, NoValInForComprehension,
ProcedureSyntax
] ]

View File

@ -1,3 +1,3 @@
version="3.3.1" version="3.3.1"
maxColumn = 120 maxColumn = 120
runner.dialect = scala213source3 runner.dialect = scala3

View File

@ -2,25 +2,24 @@ lazy val root = (project in file(".")).settings(
inThisBuild( inThisBuild(
List( List(
organization := "com.example", organization := "com.example",
scalaVersion := "2.13.7", scalaVersion := "3.1.0",
version := "0.1.0-SNAPSHOT", version := "0.1.0-SNAPSHOT",
semanticdbEnabled := true, semanticdbEnabled := true,
semanticdbVersion := scalafixSemanticdb.revision, semanticdbVersion := scalafixSemanticdb.revision,
scalafixScalaBinaryVersion := "2.13"
// This is apparently not supported on Scala 3 currently
// scalafixScalaBinaryVersion := "3.1"
) )
), ),
name := "LibreCaptcha", name := "LibreCaptcha",
libraryDependencies += "com.sksamuel.scrimage" % "scrimage-core" % "4.0.24", libraryDependencies += "com.sksamuel.scrimage" % "scrimage-core" % "4.0.24",
libraryDependencies += "com.sksamuel.scrimage" % "scrimage-filters" % "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" } Compile / unmanagedResourceDirectories += { baseDirectory.value / "lib" }
scalacOptions ++= List( scalacOptions ++= List(
"-Yrangepos",
"-Ywarn-unused",
"-deprecation", "-deprecation",
"-Xsource:3"
) )
javacOptions += "-g:none" javacOptions += "-g:none"
compileOrder := CompileOrder.JavaThenScala compileOrder := CompileOrder.JavaThenScala

View File

@ -4,6 +4,9 @@ import scala.io.Source.fromFile
import org.json4s.{DefaultFormats, JValue, JObject, JField, JString} import org.json4s.{DefaultFormats, JValue, JObject, JField, JString}
import org.json4s.jackson.JsonMethods.{parse, render, pretty} import org.json4s.jackson.JsonMethods.{parse, render, pretty}
import org.json4s.JsonDSL._ import org.json4s.JsonDSL._
import org.json4s.StringInput
import org.json4s.jvalue2monadic
import org.json4s.jvalue2extractable
import java.io.{FileNotFoundException, File, PrintWriter} import java.io.{FileNotFoundException, File, PrintWriter}
import java.{util => ju} import java.{util => ju}
import lc.misc.HelperFunctions import lc.misc.HelperFunctions

View File

@ -1,6 +1,7 @@
package lc.server package lc.server
import org.json4s.jackson.JsonMethods.parse import org.json4s.jackson.JsonMethods.parse
import org.json4s.jvalue2extractable
import lc.core.Captcha import lc.core.Captcha
import lc.core.ErrorMessageEnum import lc.core.ErrorMessageEnum
import lc.core.{Answer, ByteConvert, Error, Id, Parameters} import lc.core.{Answer, ByteConvert, Error, Id, Parameters}

View File

@ -4,7 +4,7 @@ python3 -m venv testEnv
source ./testEnv/bin/activate source ./testEnv/bin/activate
pip install locust pip install locust
mkdir -p data/ mkdir -p data/
java -jar target/scala-2.13/LibreCaptcha.jar & java -jar target/scala-3.1.0/LibreCaptcha.jar &
JAVA_PID=$! JAVA_PID=$!
sleep 4 sleep 4
@ -22,7 +22,7 @@ echo Run functional test
cp data/config.json data/config.json.bak cp data/config.json data/config.json.bak
cp tests/debug-config.json data/config.json 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=$! JAVA_PID=$!
sleep 4 sleep 4