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 19, 2024
1 parent 1c2c021 commit ee9c1eb
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 @@ -42,24 +42,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,6 +107,6 @@ object BuildOptions {
case object Rpm extends NativePackagerType
}

implicit val parser: Parser[BuildOptions] = Parser[BuildOptions]
implicit val help: Help[BuildOptions] = Help[BuildOptions]
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,8 +54,6 @@ final case class DebianOptions(
}

case object DebianOptions {

implicit val parser: Parser[DebianOptions] = Parser[DebianOptions]
implicit val help: Help[DebianOptions] = Help[DebianOptions]

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,8 +57,6 @@ final case class DockerOptions(
}

case object DockerOptions {

implicit val parser: Parser[DockerOptions] = Parser[DockerOptions]
implicit val help: Help[DockerOptions] = Help[DockerOptions]

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,8 +22,6 @@ final case class MacOSOptions(
}

case object MacOSOptions {

implicit val parser: Parser[MacOSOptions] = Parser[MacOSOptions]
implicit val help: Help[MacOSOptions] = Help[MacOSOptions]

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,8 +40,6 @@ final case class RedHatOptions(
}

case object RedHatOptions {

implicit val parser: Parser[RedHatOptions] = Parser[RedHatOptions]
implicit val help: Help[RedHatOptions] = Help[RedHatOptions]

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 {

implicit val parser: Parser[SharedOptions] = Parser[SharedOptions]
implicit val help: Help[SharedOptions] = Help[SharedOptions]
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 @@ -63,6 +63,6 @@ final case class WindowsOptions(

case object WindowsOptions {

implicit val parser: Parser[WindowsOptions] = Parser[WindowsOptions]
implicit val help: Help[WindowsOptions] = Help[WindowsOptions]
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 ee9c1eb

Please sign in to comment.