Skip to content

Commit

Permalink
Apply requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
adpi2 committed Aug 30, 2023
1 parent 9749e8f commit c59a25a
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ To port a build to Scala 3, run the following commands in order, in each project
- `migrateDepedendencies <project>` helps you update the list of `libraryDependencies`
- `migrateScalacOptions <project>` helps you update the list of `scalacOptions`
- `migrateSyntax <project>` fixes a number of syntax incompatibilities between Scala 2.13 and Scala 3
- `migrateTypes <project>` tries to make your code compile with Scala 3 by infering a few types and resolving a few implicits.
- `migrateTypes <project>` 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.**
Expand Down
10 changes: 5 additions & 5 deletions migrate/src/main/scala/migrate/ScalacOptionsMigration.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions plugin/src/main/scala/migrate/CommandStrings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ object CommandStrings {
val migrateBrief =
(
s"$migrateCommand <projectId>",
"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 <projectId>
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion plugin/src/main/scala/migrate/ScalaMigratePlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
1 change: 0 additions & 1 deletion plugin/src/main/scala/migrate/ScalacOptionsMigration.scala
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ private[migrate] object ScalacOptionsMigration {
.value
.collect { case Value(scalacOptions) => scalacOptions }
.flatten
.distinct
}
}

Expand Down

0 comments on commit c59a25a

Please sign in to comment.