From b90b81ddcc65dff1f1507bbcbab0fcd4cfb97ce6 Mon Sep 17 00:00:00 2001 From: Roberto Tyley Date: Wed, 14 Dec 2022 08:45:04 +0000 Subject: [PATCH] Support Scala 3 --- build.sbt | 6 ++++-- scala-git/src/main/scala/com/madgag/diff/MapDiff.scala | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index b4609b7..3ef1206 100644 --- a/build.sbt +++ b/build.sbt @@ -1,15 +1,17 @@ import ReleaseTransformations._ +import Dependencies._ lazy val baseSettings = Seq( scalaVersion := "2.13.10", - crossScalaVersions := Seq(scalaVersion.value), + crossScalaVersions := Seq(scalaVersion.value, "3.2.1"), organization := "com.madgag.scala-git", scmInfo := Some(ScmInfo( url("https://github.com/rtyley/scala-git"), "scm:git:git@github.com:rtyley/scala-git.git" )), licenses := Seq("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")), - scalacOptions ++= Seq("-deprecation", "-unchecked") + scalacOptions ++= Seq("-deprecation", "-unchecked"), + libraryDependencies ++= Seq(madgagCompress % Test, scalatest % Test) ) lazy val `scala-git` = project.settings(baseSettings: _*).dependsOn(`scala-git-test` % Test) diff --git a/scala-git/src/main/scala/com/madgag/diff/MapDiff.scala b/scala-git/src/main/scala/com/madgag/diff/MapDiff.scala index 11c4882..be98a66 100644 --- a/scala-git/src/main/scala/com/madgag/diff/MapDiff.scala +++ b/scala-git/src/main/scala/com/madgag/diff/MapDiff.scala @@ -1,6 +1,6 @@ package com.madgag.diff -import com.madgag.scala.collection.decorators.MapDecorator +import com.madgag.scala.collection.decorators._ object MapDiff { def apply[K,V](before: Map[K,V], after: Map[K,V]): MapDiff[K,V] = @@ -12,7 +12,7 @@ case class MapDiff[K, V](beforeAndAfter: Map[BeforeAndAfter, Map[K,V]]) { lazy val commonElements: Set[K] = beforeAndAfter.values.map(_.keySet).reduce(_ intersect _) lazy val only: Map[BeforeAndAfter, Map[K,V]] = - beforeAndAfter.mapV(_.view.filterKeys(!commonElements(_)).toMap) + beforeAndAfter.mapV(_.view.filterKeys(!commonElements(_)).toMap).toMap lazy val (unchanged, changed) = commonElements.partition(k => beforeAndAfter(Before)(k) == beforeAndAfter(After)(k))