Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update scalafmt to 3.8.3, sbt-scalafmt to 2.5.2 and re-configure formatting #190

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 42 additions & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1 +1,42 @@
version = 3.7.5
version = "3.8.3"

align.preset = more
maxColumn = 100
assumeStandardLibraryStripMargin = true
indent.defnSite = 2
indentOperator.topLevelOnly = false
align.preset = more
align.openParenCallSite = false
newlines.source = keep
newlines.beforeMultiline = keep
newlines.afterCurlyLambdaParams = keep
newlines.alwaysBeforeElseAfterCurlyIf = true

runner.dialect = scala213source3

rewrite.rules = [
RedundantBraces
RedundantParens
SortModifiers
]

rewrite.redundantBraces {
ifElseExpressions = true
includeUnitMethods = false
stringInterpolation = true
}

rewrite.sortModifiers.order = [
"private", "final", "override", "protected",
"implicit", "sealed", "abstract", "lazy"
]

project.excludeFilters = [
".bloop"
".metals"
".scala-build"
"examples" # Scala 3 scripts and using directives not supported yet
"out"
"target"
"scala-version.scala"
]
14 changes: 7 additions & 7 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Settings.project
inThisBuild(
List(
organization := "org.virtuslab",
homepage := Some(url("https://github.com/VirtuslabRnD/scala-packager")),
homepage := Some(url("https://github.com/VirtuslabRnD/scala-packager")),
licenses := List(
"Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")
),
Expand Down Expand Up @@ -46,20 +46,20 @@ lazy val compileOptions: Seq[Setting[_]] = Seq(
)

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

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

lazy val cliProjectSettings = Seq(
name := "scala-packager-cli",
scalaVersion := ScalaVersions.scala213,
name := "scala-packager-cli",
scalaVersion := ScalaVersions.scala213,
crossScalaVersions := ScalaVersions.all,
libraryDependencies ++= Seq(Deps.caseApp)
)
Expand Down
2 changes: 1 addition & 1 deletion modules/cli/src/main/scala/packager/cli/PackagerCli.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ object PackagerCli extends CommandsEntryPoint {

final override def defaultCommand = Some(Build)

override def enableCompleteCommand = true
override def enableCompleteCommand = true
override def enableCompletionsCommand = true

val commands = Seq(
Expand Down
10 changes: 5 additions & 5 deletions modules/cli/src/main/scala/packager/cli/commands/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ import packager.windows.{DefaultImageResizer, WindowsPackage}

object Build extends Command[BuildOptions] {
override def run(
options: BuildOptions,
remainingArgs: RemainingArgs
options: BuildOptions,
remainingArgs: RemainingArgs
): Unit = {

val pwd = os.pwd
val pwd = os.pwd
val destinationFileName = options.output.getOrElse(options.defaultName)

val sourceAppPath: os.Path = os.Path(options.sourceAppPath, pwd)
val sourceAppPath: os.Path = os.Path(options.sourceAppPath, pwd)
val destinationPath: os.Path = os.Path(destinationFileName, pwd)
val workingDirectoryPath = options.workingDirectory.map(os.Path(_, pwd))
val workingDirectoryPath = options.workingDirectory.map(os.Path(_, pwd))

val sharedSettings: SharedSettings = SharedSettings(
sourceAppPath = sourceAppPath,
Expand Down
108 changes: 53 additions & 55 deletions modules/cli/src/main/scala/packager/cli/commands/BuildOptions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,74 +6,72 @@ import packager.cli.commands.BuildOptions.PackagerType
import packager.config._

final case class BuildOptions(
@Group("Packager")
@HelpMessage("Set destination path")
@Name("o")
output: Option[String] = None,
@Recurse
sharedOptions: SharedOptions = SharedOptions(),
@Recurse
debian: DebianOptions = DebianOptions(),
@Recurse
redHat: RedHatOptions = RedHatOptions(),
@Recurse
macOS: MacOSOptions = MacOSOptions(),
@Recurse
windows: WindowsOptions = WindowsOptions(),
@Recurse
dockerOptions: DockerOptions = DockerOptions(),
@Group("Packager")
@HelpMessage("Overwrite destination file if it exists")
@Name("f")
force: Boolean = false,
@Group("Packager")
@HelpMessage("Set working directory path")
@Name("w")
workingDirectory: Option[String] = None,
@Group("Packager")
@HelpMessage("Source app path")
@Name("a")
sourceAppPath: String,
@Group("Packager")
@HelpMessage("Build debian package, available only on linux")
deb: Boolean = false,
@Group("Packager")
@HelpMessage("Build rpm package, available only on linux")
rpm: Boolean = false,
@Group("Packager")
@HelpMessage("Build msi package, available only on windows")
msi: Boolean = false,
@Group("Packager")
@HelpMessage("Build dmg package, available only on centOS")
dmg: Boolean = false,
@Group("Packager")
@HelpMessage("Build pkg package, available only on centOS")
pkg: Boolean = false,
@Group("Packager")
@HelpMessage("Build docker image")
docker: Boolean = false
@Group("Packager")
@HelpMessage("Set destination path")
@Name("o")
output: Option[String] = None,
@Recurse
sharedOptions: SharedOptions = SharedOptions(),
@Recurse
debian: DebianOptions = DebianOptions(),
@Recurse
redHat: RedHatOptions = RedHatOptions(),
@Recurse
macOS: MacOSOptions = MacOSOptions(),
@Recurse
windows: WindowsOptions = WindowsOptions(),
@Recurse
dockerOptions: DockerOptions = DockerOptions(),
@Group("Packager")
@HelpMessage("Overwrite destination file if it exists")
@Name("f")
force: Boolean = false,
@Group("Packager")
@HelpMessage("Set working directory path")
@Name("w")
workingDirectory: Option[String] = None,
@Group("Packager")
@HelpMessage("Source app path")
@Name("a")
sourceAppPath: String,
@Group("Packager")
@HelpMessage("Build debian package, available only on linux")
deb: Boolean = false,
@Group("Packager")
@HelpMessage("Build rpm package, available only on linux")
rpm: Boolean = false,
@Group("Packager")
@HelpMessage("Build msi package, available only on windows")
msi: Boolean = false,
@Group("Packager")
@HelpMessage("Build dmg package, available only on centOS")
dmg: Boolean = false,
@Group("Packager")
@HelpMessage("Build pkg package, available only on centOS")
pkg: Boolean = false,
@Group("Packager")
@HelpMessage("Build docker image")
docker: Boolean = false
) {

import BuildOptions.NativePackagerType
def packagerType: Option[PackagerType] = {
def packagerType: Option[PackagerType] =
if (deb) Some(NativePackagerType.Debian)
else if (rpm) Some(NativePackagerType.Rpm)
else if (msi) Some(NativePackagerType.Msi)
else if (dmg) Some(NativePackagerType.Dmg)
else if (pkg) Some(NativePackagerType.Pkg)
else if (docker) Some(PackagerType.Docker)
else None
}

def defaultName: String = {
def defaultName: String =
if (deb) "app.deb"
else if (rpm) "app.rpm"
else if (msi) "app.msi"
else if (dmg) "app.dmg"
else if (pkg) "app.pkg"
else if (msi) "app.msi"
else "app"
}

def toDebianSettings(sharedSettings: SharedSettings): DebianSettings =
debian.toDebianSettings(
Expand Down Expand Up @@ -103,12 +101,12 @@ object BuildOptions {
sealed abstract class NativePackagerType extends PackagerType
case object NativePackagerType {
case object Debian extends NativePackagerType
case object Msi extends NativePackagerType
case object Dmg extends NativePackagerType
case object Pkg extends NativePackagerType
case object Rpm extends NativePackagerType
case object Msi extends NativePackagerType
case object Dmg extends NativePackagerType
case object Pkg extends NativePackagerType
case object Rpm extends NativePackagerType
}

implicit val parser: Parser[BuildOptions] = Parser[BuildOptions]
implicit val help: Help[BuildOptions] = Help[BuildOptions]
implicit val help: Help[BuildOptions] = Help[BuildOptions]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,36 @@ import packager.cli.commands.SettingsHelpers.Mandatory
import packager.config.{DebianSettings, SharedSettings}

final case class DebianOptions(
@Group("Debian")
@HelpMessage(
"The list of debian package that this package is absolute incompatibility"
)
@ValueDescription("debian dependencies conflicts")
debianConflicts: List[String] = Nil,
@Group("Debian")
@HelpMessage("The list of debian package that this package depends on")
@ValueDescription("debian dependencies")
debianDependencies: List[String] = Nil,
@Group("Debian")
@HelpMessage(
"Architecture that are supported by the repository, default: all"
)
debArchitecture: String = "all",
@Group("Debian")
@HelpMessage(
"This field represents how important it is that the user have the package installed"
)
priority: Option[String] = None,
@Group("Debian")
@HelpMessage(
"This field specifies an application area into which the package has been classified"
)
section: Option[String] = None
@Group("Debian")
@HelpMessage(
"The list of debian package that this package is absolute incompatibility"
)
@ValueDescription("debian dependencies conflicts")
debianConflicts: List[String] = Nil,
@Group("Debian")
@HelpMessage("The list of debian package that this package depends on")
@ValueDescription("debian dependencies")
debianDependencies: List[String] = Nil,
@Group("Debian")
@HelpMessage(
"Architecture that are supported by the repository, default: all"
)
debArchitecture: String = "all",
@Group("Debian")
@HelpMessage(
"This field represents how important it is that the user have the package installed"
)
priority: Option[String] = None,
@Group("Debian")
@HelpMessage(
"This field specifies an application area into which the package has been classified"
)
section: Option[String] = None
) {
def toDebianSettings(
sharedSettings: SharedSettings,
maintainer: Option[String],
description: Option[String]
sharedSettings: SharedSettings,
maintainer: Option[String],
description: Option[String]
): DebianSettings =
DebianSettings(
shared = sharedSettings,
Expand All @@ -56,6 +56,6 @@ final case class DebianOptions(
case object DebianOptions {

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

}
Loading
Loading