diff --git a/build.sbt b/build.sbt index 2b3e7916..c89a7c3b 100644 --- a/build.sbt +++ b/build.sbt @@ -29,14 +29,14 @@ val scalacOpts = List( val dotcOpts = List("-Xdiags:verbose") -ThisBuild / Compile / scalacOptions := { +Compile / scalacOptions := { if (isDotty.value) dotcOpts else scalacOpts } -ThisBuild / Test / scalacOptions := { +Test / scalacOptions := { if (isDotty.value) dotcOpts else scalacOpts } -scalacOptions in (Compile, console) --= Seq( +Compile / console / scalacOptions --= Seq( "-Ywarn-unused:imports", "-Xfatal-warnings" ) @@ -110,6 +110,7 @@ lazy val sconfig = crossProject(JVMPlatform, NativePlatform, JSPlatform) .withDottyCompat(scalaVersion.value) ) .jvmSettings( + crossScalaVersions := versionsJVM, sharedJvmNativeSource, libraryDependencies ++= Seq( "io.crashbox" %% "spray-json" % "1.3.5-7" % Test, @@ -123,28 +124,9 @@ lazy val sconfig = crossProject(JVMPlatform, NativePlatform, JSPlatform) "-g", "-Xlint:unchecked" ), - // Dotty is missing serializable support - // Can Filter based on Test name but not method name with "erializ" - // so exclude the Tests with the 19 that cannot pass - // 530 - 19 = 511 Only 346 get run this way so we lose coverage - Test / testOptions := { - if (isDotty.value) - Seq( - Tests.Exclude( - Seq( - "org.ekrich.config.impl.ValidationTest", - "org.ekrich.config.impl.PublicApiTest", - "org.ekrich.config.impl.ConfigValueTest", - "org.ekrich.config.impl.ConfigTest" - ) - ) - ) - else Seq(Tests.Exclude(Seq())) - }, // because we test some global state such as singleton caches, // we have to run tests in serial. Test / parallelExecution := false, - test / fork := true, Test / fork := true, run / fork := true, Test / run / fork := true, diff --git a/project/build.properties b/project/build.properties index 6db98425..0837f7a1 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.4.0 +sbt.version=1.3.13 diff --git a/sconfig/jvm/src/test/scala/org/ekrich/config/impl/TestUtils.scala b/sconfig/jvm/src/test/scala/org/ekrich/config/impl/TestUtils.scala index 9e55b8d1..df8fe653 100644 --- a/sconfig/jvm/src/test/scala/org/ekrich/config/impl/TestUtils.scala +++ b/sconfig/jvm/src/test/scala/org/ekrich/config/impl/TestUtils.scala @@ -998,8 +998,10 @@ abstract trait TestUtils { .sortBy(_.path) .sortBy(_.origin.lineNumber) - //for (problem <- problems) - // System.err.println(problem.origin.description() + ": " + problem.path() + ": " + problem.problem()) + // for (problem <- problems) + // System.err.println( + // problem.origin.description + ": " + problem.path + ": " + problem.problem + // ) for ((problem, expected) <- problems zip expecteds) { expected.check(problem) diff --git a/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ValidationTest.scala b/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ValidationTest.scala index f78687ce..8b451405 100644 --- a/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ValidationTest.scala +++ b/sconfig/jvm/src/test/scala/org/ekrich/config/impl/ValidationTest.scala @@ -113,7 +113,7 @@ class ValidationTest extends TestUtils { checkValidationException(e, expecteds) } - @Test + @Test @Ignore("https://github.com/lampepfl/dotty/issues/9881") def validationFailedSerializable(): Unit = { // Reusing a previous test case to generate an error val reference = parseConfig("""{ a : [{},{},{}] }""") @@ -121,7 +121,6 @@ class ValidationTest extends TestUtils { val e = intercept[ConfigException.ValidationFailed] { conf.checkValid(reference) } - val expecteds = Seq(WrongType("a", 1, "list", "number")) val actual = checkSerializableNoMeaningfulEquals(e) diff --git a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigException.scala b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigException.scala index 64802298..12108077 100644 --- a/sconfig/shared/src/main/scala/org/ekrich/config/ConfigException.scala +++ b/sconfig/shared/src/main/scala/org/ekrich/config/ConfigException.scala @@ -63,18 +63,21 @@ object ConfigException { origin: ConfigOrigin ): Unit = { // circumvent "final" - var f: Field = null - try { - f = clazz.getDeclaredField("origin"); - } catch { - case e: NoSuchFieldException => - throw new IOException(clazz.getSimpleName + " has no origin field?", e) - case e: SecurityException => - throw new IOException( - "unable to fill out origin field in " + clazz.getSimpleName, - e - ) - } + val f: Field = + try { + clazz.getDeclaredField("origin"); + } catch { + case e: NoSuchFieldException => + throw new IOException( + clazz.getSimpleName + " has no origin field?", + e + ) + case e: SecurityException => + throw new IOException( + "unable to fill out origin field in " + clazz.getSimpleName, + e + ) + } f.setAccessible(true) try {