Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.

Commit

Permalink
Cross-compile between Scala 2.12 and 2.13
Browse files Browse the repository at this point in the history
  • Loading branch information
exoego committed Aug 27, 2019
1 parent 60bd4ec commit 1a5acee
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ lazy val awsDirectoryService = defineAwsProject("DirectoryService
lazy val awsDLM = defineAwsProject("DLM")
lazy val awsDMS = defineAwsProject("DMS")
lazy val awsDocDb = defineAwsProject("DocDB")
lazy val awsDynamoDB = defineAwsProject("DynamoDB")
lazy val awsDynamoDB = defineAwsProject("DynamoDB").settings(libraryDependencies += Dependencies.shared.compat.value)
lazy val awsDynamoDBStreams = defineAwsProject("DynamoDBStreams")
lazy val awsEC2 = defineAwsProject("EC2")
lazy val awsEC2InstanceConnect = defineAwsProject("EC2InstanceConnect")
Expand Down
3 changes: 2 additions & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import autoImport._

object Dependencies {
object shared {
val scalatest = Def.setting("org.scalatest" %%% "scalatest" % "3.0.8" % Test)
val scalatest = Def.setting("org.scalatest" %%% "scalatest" % "3.0.8" % Test)
val compat = Def.setting("org.scala-lang.modules" %%% "scala-collection-compat" % "2.1.2")
}
object scalajs {
val nodejs = Def.setting("net.exoego" %%% "scala-js-nodejs-v8" % "0.8.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ object AttributeValueMapper {
implicit val AttributeValueTypeList: AttributeValueMapper[ListAttributeValue] =
AttributeValueMapper("L", identity[ListAttributeValue])

implicit def AttributeValueTypeMapT[T: AttributeValueMapper]: AttributeValueMapper[Map[String, T]] =
implicit def AttributeValueTypeMapT[T: AttributeValueMapper]: AttributeValueMapper[Map[String, T]] = {
import scala.collection.compat._
AttributeValueMapper(
"M",
(seq: Map[String, T]) => js.Dictionary(seq.view.mapValues(implicitly[AttributeValueMapper[T]]).toSeq: _*)
)
}

implicit def AttributeValueTypeSeqT[T: AttributeValueMapper]: AttributeValueMapper[Seq[T]] =
AttributeValueMapper("L", (seq: Seq[T]) => js.Array(seq.map(implicitly[AttributeValueMapper[T]]): _*))
Expand Down

0 comments on commit 1a5acee

Please sign in to comment.