diff --git a/README.md b/README.md index 8b91b042..98380efe 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ To port a build to Scala 3, run the following commands in order, in each project - `migrateDepedendencies ` helps you update the list of `libraryDependencies` - `migrateScalacOptions ` helps you update the list of `scalacOptions` - `migrateSyntax ` fixes a number of syntax incompatibilities between Scala 2.13 and Scala 3 -- `migrateTypes ` tries to make your code compile with Scala 3 by infering a few types and resolving a few implicits. +- `migrateTypes ` tries to make your code compile with Scala 3 by inferring a few types and resolving a few implicits. ## Contributions and feedbacks are welcome The tool is still under development, and **we would love to hear from you.** diff --git a/migrate/src/main/scala/migrate/ScalacOptionsMigration.scala b/migrate/src/main/scala/migrate/ScalacOptionsMigration.scala index 8344254e..2b5f636c 100644 --- a/migrate/src/main/scala/migrate/ScalacOptionsMigration.scala +++ b/migrate/src/main/scala/migrate/ScalacOptionsMigration.scala @@ -10,7 +10,7 @@ import migrate.internal.MigratedScalacOption._ object ScalacOptionsMigration { def migrate(scalacOptions: Seq[String]): MigratedScalacOptions = { - val migrated = sanitize(scalacOptions).map(migrate) + val migrated = sanitize(scalacOptions).distinct.map(migrate) val valid = migrated.collect { case x: Valid => x.value }.toArray val renamed = migrated.collect { case x: Renamed => x.scala2Value -> x.scala3Value }.toMap val removed = migrated.collect { case x: Removed => x.value }.toArray @@ -338,10 +338,10 @@ object ScalacOptionsMigration { case s"-Ytest-pickler$_" => Valid(scalacOption) case s"-Yunsound-match-types$_" => Valid(scalacOption) case "-Xcheck-macros" | "--Xcheck-macros" => Valid(scalacOption) - case "-Xsemanticdb" | "-Ysemanticdb" => Ignored - case "-Ykind-projector" => Ignored - case s"-coverage-out$_" => Ignored - case s"--coverage-out$_" => Ignored + case "-Xsemanticdb" | "-Ysemanticdb" => Valid(scalacOption) + case "-Ykind-projector" => Valid(scalacOption) + case s"-coverage-out$_" => Valid(scalacOption) + case s"--coverage-out$_" => Valid(scalacOption) // plugin specific scalacOption case s"-P$_" => Ignored diff --git a/migrate/src/test/scala/migrate/ScalacOptionsMigrationSuite.scala b/migrate/src/test/scala/migrate/ScalacOptionsMigrationSuite.scala index cdb008d3..20dd4deb 100644 --- a/migrate/src/test/scala/migrate/ScalacOptionsMigrationSuite.scala +++ b/migrate/src/test/scala/migrate/ScalacOptionsMigrationSuite.scala @@ -14,7 +14,9 @@ class ScalacOpionsMigrationSuite extends AnyFunSuiteLike with DiffAssertions { "-language:existentials", "-Xlint:_,-type-parameter-shadow", "-Xfatal-warnings", - "-Wunused patvars" + "-Wunused patvars", + "-encoding", + "UTF-8", ) val expected = Seq( "-encoding UTF-8", diff --git a/plugin/src/main/scala/migrate/CommandStrings.scala b/plugin/src/main/scala/migrate/CommandStrings.scala index b2a0fd40..d550e429 100644 --- a/plugin/src/main/scala/migrate/CommandStrings.scala +++ b/plugin/src/main/scala/migrate/CommandStrings.scala @@ -15,7 +15,7 @@ object CommandStrings { val migrateBrief = ( s"$migrateCommand ", - "Migrate the project to Scala 3 by infering necessary types and implicits" + "Migrate the project to Scala 3 by inferring necessary types and implicits" ) val migrateDetailed = s"""|Usage : $migrateCommand @@ -49,7 +49,7 @@ object CommandStrings { |The status of a dependency can be: |- Valid: it can be used in Scala 3 |- Updated version: the version needs to be updated - |- For 3 use 2.13: it is compatible with Scala 3 using CrossVersion.for3Use2.13 + |- For 3 use 2.13: it is compatible with Scala 3 using CrossVersion.for3Use2_13 |- Incompatible: it is incompatible with Scala 3 because it is a macro library or a compiler plugin |- Unclassified: sbt-scala3-migrate does not know how to migrate this dependency |""".stripMargin diff --git a/plugin/src/main/scala/migrate/ScalaMigratePlugin.scala b/plugin/src/main/scala/migrate/ScalaMigratePlugin.scala index 588735dd..049ffe17 100644 --- a/plugin/src/main/scala/migrate/ScalaMigratePlugin.scala +++ b/plugin/src/main/scala/migrate/ScalaMigratePlugin.scala @@ -56,7 +56,7 @@ object ScalaMigratePlugin extends AutoPlugin { val internalMigrateSyntax = taskKey[Unit]("fix some syntax incompatibilities with scala 3").withRank(KeyRanks.Invisible) - val internalMigrateScalacOptions = taskKey[Unit]("igrate of the scalacOptions").withRank(KeyRanks.Invisible) + val internalMigrateScalacOptions = taskKey[Unit]("migrate of the scalacOptions").withRank(KeyRanks.Invisible) val internalMigrateDependencies = taskKey[Unit]("migrate dependencies").withRank(KeyRanks.Invisible) val internalMigrateTypes = taskKey[Unit]("migrate types to scala 3").withRank(KeyRanks.Invisible) } diff --git a/plugin/src/main/scala/migrate/ScalacOptionsMigration.scala b/plugin/src/main/scala/migrate/ScalacOptionsMigration.scala index 4f1c01cb..514a3527 100644 --- a/plugin/src/main/scala/migrate/ScalacOptionsMigration.scala +++ b/plugin/src/main/scala/migrate/ScalacOptionsMigration.scala @@ -52,7 +52,6 @@ private[migrate] object ScalacOptionsMigration { .value .collect { case Value(scalacOptions) => scalacOptions } .flatten - .distinct } }