Skip to content

Commit

Permalink
Update scalac options
Browse files Browse the repository at this point in the history
  • Loading branch information
adpi2 committed Aug 24, 2023
1 parent 583055a commit 182b79f
Show file tree
Hide file tree
Showing 5 changed files with 411 additions and 324 deletions.
17 changes: 8 additions & 9 deletions migrate/src/main/scala/migrate/Scala3Migrate.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import migrate.interfaces.Lib
import migrate.interfaces.MigratedLibsImpl
import migrate.interfaces.MigratedScalacOptions
import migrate.internal.ScalaMigrateLogger
import migrate.internal.ScalacOption.PluginSpecific
import migrate.internal._
import migrate.utils.FileUtils
import migrate.utils.ScalaExtensions._
Expand Down Expand Up @@ -174,16 +173,16 @@ class Scala3Migrate(scalafixSrv: ScalafixService) {

object Scala3Migrate {
def migrateScalacOptions(scalacOptions: Seq[String]): MigratedScalacOptions = {
val sanitized = ScalacOption.sanitizeScalacOption(scalacOptions)
val scalaSettings = sanitized.map(ScalacOption.from)
val notParsed: Seq[ScalacOption.NotParsed] = scalaSettings.collect { case x: ScalacOption.NotParsed => x }
val scala3cOption: Seq[Scala3cOption] = scalaSettings.collect {
case x: ScalacOption.Specific3 => x;
val sanitized = ScalacOption.sanitize(scalacOptions)
val scalaSettings = sanitized.map(ScalacOption.from)
val notParsed = scalaSettings.collect { case x: ScalacOption.NotParsed => x }
val scala3cOption = scalaSettings.collect {
case x: ScalacOption.Specific3 => x
case x: ScalacOption.Shared => x
}
val pluginsSettings: Seq[PluginSpecific] = scalaSettings.collect { case x: ScalacOption.PluginSpecific => x }
val renamed = scalaSettings.collect { case x: ScalacOption.Renamed => x }
val specific2 = scalaSettings.collect { case x: ScalacOption.Specific2 => x }
val pluginsSettings = scalaSettings.collect { case x: ScalacOption.PluginSpecific => x }
val renamed = scalaSettings.collect { case x: ScalacOption.Renamed => x }
val specific2 = scalaSettings.collect { case x: ScalacOption.Specific2 => x }
MigratedScalacOptions(notParsed, specific2, scala3cOption, renamed, pluginsSettings)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import scala.annotation.tailrec
*
* Copied from scala/scala
*/
private object CommandLineParser {
private[migrate] object CommandLineParser {
final private val DQ = '"'
final private val SQ = '\''

Expand Down
9 changes: 6 additions & 3 deletions migrate/src/main/scala/migrate/internal/InitialLib.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import migrate.interfaces.MigratedLibImp
import migrate.interfaces.MigratedLibImp._
import migrate.internal.InitialLib.macroLibs
import migrate.internal.MigratedLib._
import migrate.internal.ScalacOption.Specific3
import migrate.internal.ScalacOption.CoverageOut
import migrate.internal.ScalacOption.KindProjector
import migrate.internal.ScalacOption.SemanticDB
import migrate.utils.CoursierHelper
import migrate.utils.ScalaExtensions._

Expand Down Expand Up @@ -152,8 +154,9 @@ object InitialLib {

val compilerPluginToScalacOption: Map[(Organization, Name), Scala3cOption] =
Map(
(Organization("org.typelevel"), Name("kind-projector")) -> Specific3.KindProjector,
(Organization("org.scalameta"), Name("semanticdb-scalac")) -> Specific3.SemanticDB
(Organization("org.typelevel"), Name("kind-projector")) -> KindProjector,
(Organization("org.scalameta"), Name("semanticdb-scalac")) -> SemanticDB,
(Organization("org.scoverage"), Name("scalac-scoverage-plugin")) -> CoverageOut(":.")
)

val macroLibs: Set[(Organization, Name)] =
Expand Down
Loading

0 comments on commit 182b79f

Please sign in to comment.