Skip to content

Commit

Permalink
Compile with Scala 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Gedochao committed Nov 22, 2024
1 parent a8c79e5 commit eb9f0c5
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ newlines.beforeMultiline = keep
newlines.afterCurlyLambdaParams = keep
newlines.alwaysBeforeElseAfterCurlyIf = true

runner.dialect = scala213source3
runner.dialect = scala3

rewrite.rules = [
RedundantBraces
Expand Down
8 changes: 4 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,24 @@ lazy val cliMainClass = Seq(
)

lazy val compileOptions: Seq[Setting[_]] = Seq(
scalacOptions ++= Seq("-Xfatal-warnings", "-deprecation", "-Xsource:3")
scalacOptions ++= Seq("-Xfatal-warnings", "-deprecation")
)

lazy val packagerProjectSettings = Seq(
name := "scala-packager",
scalaVersion := ScalaVersions.scala213,
scalaVersion := ScalaVersions.scala3,
crossScalaVersions := ScalaVersions.all
)

lazy val imageResizerProjectSettings = Seq(
name := "scala-packager-image-resizer",
scalaVersion := ScalaVersions.scala213,
scalaVersion := ScalaVersions.scala3,
crossScalaVersions := ScalaVersions.all
)

lazy val cliProjectSettings = Seq(
name := "scala-packager-cli",
scalaVersion := ScalaVersions.scala213,
scalaVersion := ScalaVersions.scala3,
crossScalaVersions := ScalaVersions.all,
libraryDependencies ++= Seq(Deps.caseApp)
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package packager.cli.commands

import caseapp.{Group, HelpMessage, Name, Parser, Recurse}
import caseapp._
import caseapp.core.help.Help
import packager.cli.commands.BuildOptions.PackagerType
import packager.config._
Expand Down Expand Up @@ -107,7 +107,6 @@ object BuildOptions {
case object Rpm extends NativePackagerType
}

lazy val parser: Parser[BuildOptions] = Parser.derive
implicit lazy val parserAux: Parser.Aux[BuildOptions, parser.D] = parser
implicit lazy val help: Help[BuildOptions] = Help.derive
implicit lazy val parser: Parser[BuildOptions] = Parser.derive
implicit lazy val help: Help[BuildOptions] = Help.derive
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package packager.cli.commands

import caseapp._
import caseapp.core.help.Help
import caseapp.{Group, HelpMessage, Parser, ValueDescription}
import packager.cli.commands.SettingsHelpers.Mandatory
import packager.config.{DebianSettings, SharedSettings}

Expand Down Expand Up @@ -54,7 +54,6 @@ final case class DebianOptions(
}

case object DebianOptions {
lazy val parser: Parser[DebianOptions] = Parser.derive
implicit lazy val parserAux: Parser.Aux[DebianOptions, parser.D] = parser
implicit lazy val help: Help[DebianOptions] = Help.derive
implicit lazy val parser: Parser[DebianOptions] = Parser.derive
implicit lazy val help: Help[DebianOptions] = Help.derive
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package packager.cli.commands

import caseapp._
import caseapp.core.help.Help
import caseapp.{Group, HelpMessage, Parser, ValueDescription}
import packager.cli.commands.SettingsHelpers.Mandatory
import packager.config.DockerSettings
import java.nio.file.Path;
Expand Down Expand Up @@ -57,9 +57,6 @@ final case class DockerOptions(
}

case object DockerOptions {

lazy val parser: Parser[DockerOptions] = Parser.derive
implicit lazy val parserAux: Parser.Aux[DockerOptions, parser.D] = parser
implicit lazy val help: Help[DockerOptions] = Help.derive

implicit lazy val parser: Parser[DockerOptions] = Parser.derive
implicit lazy val help: Help[DockerOptions] = Help.derive
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package packager.cli.commands

import caseapp.{Group, HelpMessage, Parser}
import caseapp._
import caseapp.core.help.Help
import packager.config.{MacOSSettings, SharedSettings}
import SettingsHelpers._
Expand All @@ -22,7 +22,6 @@ final case class MacOSOptions(
}

case object MacOSOptions {
lazy val parser: Parser[MacOSOptions] = Parser.derive
implicit lazy val parserAux: Parser.Aux[MacOSOptions, parser.D] = parser
implicit lazy val help: Help[MacOSOptions] = Help.derive
implicit lazy val parser: Parser[MacOSOptions] = Parser.derive
implicit lazy val help: Help[MacOSOptions] = Help.derive
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package packager.cli.commands

import caseapp.{Group, HelpMessage, Parser}
import caseapp._
import caseapp.core.help.Help
import packager.config.{RedHatSettings, SharedSettings}
import SettingsHelpers._
Expand Down Expand Up @@ -40,7 +40,6 @@ final case class RedHatOptions(
}

case object RedHatOptions {
lazy val parser: Parser[RedHatOptions] = Parser.derive
implicit lazy val parserAux: Parser.Aux[RedHatOptions, parser.D] = parser
implicit lazy val help: Help[RedHatOptions] = Help.derive
implicit lazy val parser: Parser[RedHatOptions] = Parser.derive
implicit lazy val help: Help[RedHatOptions] = Help.derive
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package packager.cli.commands

import caseapp.{Group, HelpMessage, Name, Parser, ValueDescription}
import caseapp._
import caseapp.core.help.Help

final case class SharedOptions(
Expand Down Expand Up @@ -32,7 +32,6 @@ final case class SharedOptions(
logoPath: Option[String] = None
)
case object SharedOptions {
lazy val parser: Parser[SharedOptions] = Parser.derive
implicit lazy val parserAux: Parser.Aux[SharedOptions, parser.D] = parser
implicit lazy val help: Help[SharedOptions] = Help.derive
implicit lazy val parser: Parser[SharedOptions] = Parser.derive
implicit lazy val help: Help[SharedOptions] = Help.derive
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ final case class WindowsOptions(
}

case object WindowsOptions {
lazy val parser: Parser[WindowsOptions] = Parser.derive
implicit lazy val parserAux: Parser.Aux[WindowsOptions, parser.D] = parser
implicit lazy val help: Help[WindowsOptions] = Help.derive
implicit lazy val parser: Parser[WindowsOptions] = Parser.derive
implicit lazy val help: Help[WindowsOptions] = Help.derive
}
3 changes: 2 additions & 1 deletion project/ScalaVersions.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
object ScalaVersions {
def scala212 = "2.12.20"
def scala213 = "2.13.15"
def all = Seq(scala213, scala212)
def scala3 = "3.3.4" // we stick to the LTS here
def all = Seq(scala3)
}

0 comments on commit eb9f0c5

Please sign in to comment.