addSbtPlugin(" ch.epfl.scala" % " sbt-scalafix" % " 0.9.13" )
import scalafix .sbt .ScalafixPlugin .autoImport .{scalafixDependencies , scalafixSemanticdb }
scalafixDependencies in ThisBuild + = " org.scala-lang.modules" %% " scala-collection-migrations" % " 2.1.4" ,
libraryDependencies + = " org.scala-lang.modules" %% " scala-collection-compat" % " 2.1.4" ,
scalacOptions ++ = List (" -Yrangepos" , " -P:semanticdb:synthetics:on" ),
scalafixEnable
;test:scalafix Collection213CrossCompat ;scalafix Collection213CrossCompat
;test:scalafix Collection213Upgrade ;scalafix Collection213Upgrade
git add -A && git stash && git stash apply && git co project && git st
git commit -m ' Run Collection213CrossCompat scalafix'
for f in $( seq 23) ; do find . -type f -name ' *.scala' -exec perl -pi -e ' s/^([^"]+?)→/\1->/g; s/^([^"]+?)←/\1<-/g; s/^([^"]+?)⇒/\1=>/g' {} +; done
find . -type f -name ' *.scala' -exec perl -pi -e '
s/\b(?:Gen)?Traversable/Iterable/g;
s/\\033/\\u001b/g;
s/CanBuildFrom *\[[A-Za-z0-9_ \[\]]+, */Factory[/g;
s/import scala.collection.generic.CanBuildFrom/import scala.collection.Factory/;
s/\btoIterator\b/iterator/g;
s/(cbf[A-Z]*)\([a-zA-Z0-9_]*\)/\1.newBuilder/g;
s/\bto *\[ *([A-Za-z]+) *\]/to(\1)/g;
' {} +
find . -type f -path ' */test/*.scala' -exec perl -pi -e '
s/^( *)' " '" ' ([^ ]+)\{/\1"\2" - {/;
s/^( *)' " '" ' ([^ ]+)( +)(?:- *)?\{/\1"\2"\3- {/;
s/^( *)' " '" ' ([^ ]+)( +)-/\1"\2"\3-/;
s/^(\s+)(?:override +)(?:val|def) +tests += +TestSuite *{ *$/\1override def tests = Tests {/;
' {} +
SBT config for macro annotations
def byScalaVersion [A ](f : PartialFunction [(Long , Long ), Seq [A ]]): Def .Initialize [Seq [A ]] =
Def .setting(CrossVersion .partialVersion(scalaVersion.value).flatMap(f.lift).getOrElse(Nil ))
def addMacroParadisePlugin = Def .settings(
Seq (
libraryDependencies ++ = byScalaVersion {
case (2 , 12 ) => Seq (compilerPlugin(" org.scalamacros" % " paradise" % Ver .MacroParadise cross CrossVersion .patch))
case (2 , 13 ) => Nil
}.value,
scalacOptions ++ = byScalaVersion {
case (2 , 12 ) => Nil
case (2 , 13 ) => Seq (" -Ymacro-annotations" )
}.value
))
were you on scala212?