Scruid can now cross-build for Scala 2.11, 2.12 and 2.13.
All dependencies have been upgraded, in order to support Scala 2.13. The changes are outlined below:
Circe related changes
Streaming JSON support with Circe is provided by akka-streams-json v0.4.0. However, Circe from version 0.12.0-M4 and later dropped the support for Scala 2.11. As a result, for Scala 2.11 builds, Scruid depends on version 0.11.1 of Circe, while for Scala 2.12+ builds depends on Circe version 0.12.1.
In the current version of Scruid, trait io.circe.java8.time.JavaTimeDecoders is provided by the artifact circe-java8 and is only available in Circe v0.11.1. In Scruid, trait JavaTimeDecoders is extended by DruidResult and DruidClient. For recent versions of Circe (e.g., 0.12.1), as it has been noted here, the java.time instances are now included in the Encoder and Decoder companion objects and therefore the artifact circe-java8 does not exists anymore. To overcome that issue, trait JavaTimeDecoders in Scruid is being replaced by a new utility trait ing.wbaa.druid.client.CirceDecoders which is defined differently per Scala version (see SBT Scala-version specific source directory). For instance, trait CirceDecoders for Scala 2.11 is defined in src/main/scala-2.11/ing/wbaa/druid/client/CirceDecoders.scala and extends the JavaTimeDecoders:
While the same trait for Scala 2.12 is defined in src/main/scala-2.12/ing/wbaa/druid/client/CirceDecoders.scala and does not extends JavaTimeDecoders.
Scala 2.13 related changes
Minor code changes in ing.wbaa.druid.client.DruidAdvancedHttpClient and ing.wbaa.druid.dql.DQLSpec to address the follow warnings in Scala 2.13:
The unicode arrow ⇒ is deprecated, use => instead.
symbol literal is deprecated; use Symbol("") instead.
object JavaConverters in package collection is deprecated (since 2.13.0): Use scala.jdk.CollectionConverters instead
method copyArrayToImmutableIndexedSeq in class LowPriorityImplicits2 is deprecated (since 2.13.0): Implicit conversions from Array to immutable.IndexedSeq are implemented by copying; Use the more efficient non-copying ArraySeq.unsafeWrapArray or an explicit toIndexedSeq call
use -Ywarn-unused:imports insted of -Ywarn-unused-import
CircleCI
When cross-building I was getting java.lang.OutOfMemoryError: Metaspace in CircleCI (not locally). Although I changed the memory settings in .sbtopts as well as in .cicleci/config.yml (e.g., Xmx4G and XX:MaxMetaspaceSize=512M) I was still getting java.lang.OutOfMemoryError: Metaspace. As a result, I also defined separate runs in .cicleci/config.yml, each one for the desired Scala version:
Scruid can now cross-build for Scala 2.11, 2.12 and 2.13.
All dependencies have been upgraded, in order to support Scala 2.13. The changes are outlined below:
Circe related changes
Streaming JSON support with Circe is provided by akka-streams-json v0.4.0. However, Circe from version 0.12.0-M4 and later dropped the support for Scala 2.11. As a result, for Scala 2.11 builds, Scruid depends on version 0.11.1 of Circe, while for Scala 2.12+ builds depends on Circe version 0.12.1.
In the current version of Scruid, trait
io.circe.java8.time.JavaTimeDecoders
is provided by the artifactcirce-java8
and is only available in Circe v0.11.1. In Scruid, traitJavaTimeDecoders
is extended byDruidResult
andDruidClient
. For recent versions of Circe (e.g., 0.12.1), as it has been noted here, thejava.time
instances are now included in theEncoder
andDecoder
companion objects and therefore the artifactcirce-java8
does not exists anymore. To overcome that issue, traitJavaTimeDecoders
in Scruid is being replaced by a new utility traiting.wbaa.druid.client.CirceDecoders
which is defined differently per Scala version (see SBT Scala-version specific source directory). For instance, traitCirceDecoders
for Scala 2.11 is defined insrc/main/scala-2.11/ing/wbaa/druid/client/CirceDecoders.scala
and extends theJavaTimeDecoders
:While the same trait for Scala 2.12 is defined in
src/main/scala-2.12/ing/wbaa/druid/client/CirceDecoders.scala
and does not extendsJavaTimeDecoders
.Scala 2.13 related changes
Minor code changes in
ing.wbaa.druid.client.DruidAdvancedHttpClient
anding.wbaa.druid.dql.DQLSpec
to address the follow warnings in Scala 2.13:⇒
is deprecated, use=>
instead.scala.jdk.CollectionConverters
insteadSince symbol literal is now deprecated in Scala 2.13, the documentation examples use the
d"some_dim"
notation for dimensions.Compiler settings for Scala 2.13:
-Xmax-classfile-name
(see Remove -Xmax-classfile-length; hard-code to 240)-Ywarn-unused:imports
insted of-Ywarn-unused-import
CircleCI
When cross-building I was getting
java.lang.OutOfMemoryError: Metaspace
in CircleCI (not locally). Although I changed the memory settings in.sbtopts
as well as in.cicleci/config.yml
(e.g., Xmx4G and XX:MaxMetaspaceSize=512M) I was still gettingjava.lang.OutOfMemoryError: Metaspace
. As a result, I also defined separate runs in.cicleci/config.yml
, each one for the desired Scala version: