diff --git a/.scalafmt.conf b/.scalafmt.conf index c1c5328..3194834 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -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" +] \ No newline at end of file diff --git a/build.sbt b/build.sbt index 86a6f34..f48d7fe 100644 --- a/build.sbt +++ b/build.sbt @@ -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") ), @@ -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) ) diff --git a/modules/cli/src/main/scala/packager/cli/PackagerCli.scala b/modules/cli/src/main/scala/packager/cli/PackagerCli.scala index fd12678..625c723 100644 --- a/modules/cli/src/main/scala/packager/cli/PackagerCli.scala +++ b/modules/cli/src/main/scala/packager/cli/PackagerCli.scala @@ -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( diff --git a/modules/cli/src/main/scala/packager/cli/commands/Build.scala b/modules/cli/src/main/scala/packager/cli/commands/Build.scala index c73837c..387c51e 100644 --- a/modules/cli/src/main/scala/packager/cli/commands/Build.scala +++ b/modules/cli/src/main/scala/packager/cli/commands/Build.scala @@ -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, diff --git a/modules/cli/src/main/scala/packager/cli/commands/BuildOptions.scala b/modules/cli/src/main/scala/packager/cli/commands/BuildOptions.scala index 7d5fa5b..b033f89 100644 --- a/modules/cli/src/main/scala/packager/cli/commands/BuildOptions.scala +++ b/modules/cli/src/main/scala/packager/cli/commands/BuildOptions.scala @@ -6,56 +6,56 @@ 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) @@ -63,9 +63,8 @@ final case class BuildOptions( 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" @@ -73,7 +72,6 @@ final case class BuildOptions( else if (pkg) "app.pkg" else if (msi) "app.msi" else "app" - } def toDebianSettings(sharedSettings: SharedSettings): DebianSettings = debian.toDebianSettings( @@ -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] } diff --git a/modules/cli/src/main/scala/packager/cli/commands/DebianOptions.scala b/modules/cli/src/main/scala/packager/cli/commands/DebianOptions.scala index c40fd85..e1f39d1 100644 --- a/modules/cli/src/main/scala/packager/cli/commands/DebianOptions.scala +++ b/modules/cli/src/main/scala/packager/cli/commands/DebianOptions.scala @@ -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, @@ -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] } diff --git a/modules/cli/src/main/scala/packager/cli/commands/DockerOptions.scala b/modules/cli/src/main/scala/packager/cli/commands/DockerOptions.scala index 4dac244..938e936 100644 --- a/modules/cli/src/main/scala/packager/cli/commands/DockerOptions.scala +++ b/modules/cli/src/main/scala/packager/cli/commands/DockerOptions.scala @@ -8,39 +8,38 @@ import java.nio.file.Path; import java.nio.file.Paths; final case class DockerOptions( - @Group("Docker") - @HelpMessage( - "Building the container from base image" - ) - @ValueDescription("ubuntu|ubuntu:latest|adoptopenjdk/openjdk8:debian-jre|…") - from: Option[String] = None, - @Group("Docker") - @HelpMessage( - "The image registry, if empty the default registry will be used (Docker Hub)" - ) - registry: Option[String] = None, - @Group("Docker") - @HelpMessage( - "The image repository" - ) - repository: Option[String] = None, - @Group("Docker") - @HelpMessage( - "The image tag, the default tag is latest" - ) - tag: Option[String] = None, - @Group("Docker") - @HelpMessage( - "Executable that will run an application, default sh" - ) - exec: Option[String] = Some("sh"), - - @Group("Docker") - @HelpMessage( - "docker executable that will be used. ex. docker, podman" - ) - @ValueDescription("docker") - dockerExecutable: Option[Path] = Some(Paths.get("docker")) + @Group("Docker") + @HelpMessage( + "Building the container from base image" + ) + @ValueDescription("ubuntu|ubuntu:latest|adoptopenjdk/openjdk8:debian-jre|…") + from: Option[String] = None, + @Group("Docker") + @HelpMessage( + "The image registry, if empty the default registry will be used (Docker Hub)" + ) + registry: Option[String] = None, + @Group("Docker") + @HelpMessage( + "The image repository" + ) + repository: Option[String] = None, + @Group("Docker") + @HelpMessage( + "The image tag, the default tag is latest" + ) + tag: Option[String] = None, + @Group("Docker") + @HelpMessage( + "Executable that will run an application, default sh" + ) + exec: Option[String] = Some("sh"), + @Group("Docker") + @HelpMessage( + "docker executable that will be used. ex. docker, podman" + ) + @ValueDescription("docker") + dockerExecutable: Option[Path] = Some(Paths.get("docker")) ) { def toDockerSettings: DockerSettings = DockerSettings( @@ -60,6 +59,6 @@ final case class DockerOptions( case object DockerOptions { implicit val parser: Parser[DockerOptions] = Parser[DockerOptions] - implicit val help: Help[DockerOptions] = Help[DockerOptions] + implicit val help: Help[DockerOptions] = Help[DockerOptions] } diff --git a/modules/cli/src/main/scala/packager/cli/commands/MacOSOptions.scala b/modules/cli/src/main/scala/packager/cli/commands/MacOSOptions.scala index 6fe0b3c..270119b 100644 --- a/modules/cli/src/main/scala/packager/cli/commands/MacOSOptions.scala +++ b/modules/cli/src/main/scala/packager/cli/commands/MacOSOptions.scala @@ -6,11 +6,11 @@ import packager.config.{MacOSSettings, SharedSettings} import SettingsHelpers._ final case class MacOSOptions( - @Group("MacOS") - @HelpMessage( - "CF Bundle Identifier" - ) - identifier: Option[String] = None + @Group("MacOS") + @HelpMessage( + "CF Bundle Identifier" + ) + identifier: Option[String] = None ) { def toMacOSSettings(sharedSettings: SharedSettings): MacOSSettings = MacOSSettings( @@ -24,6 +24,6 @@ final case class MacOSOptions( case object MacOSOptions { implicit val parser: Parser[MacOSOptions] = Parser[MacOSOptions] - implicit val help: Help[MacOSOptions] = Help[MacOSOptions] + implicit val help: Help[MacOSOptions] = Help[MacOSOptions] } diff --git a/modules/cli/src/main/scala/packager/cli/commands/RedHatOptions.scala b/modules/cli/src/main/scala/packager/cli/commands/RedHatOptions.scala index ecda205..8c7027e 100644 --- a/modules/cli/src/main/scala/packager/cli/commands/RedHatOptions.scala +++ b/modules/cli/src/main/scala/packager/cli/commands/RedHatOptions.scala @@ -6,25 +6,25 @@ import packager.config.{RedHatSettings, SharedSettings} import SettingsHelpers._ final case class RedHatOptions( - @Group("RedHat") - @HelpMessage( - "License that are supported by the repository - list of licenses https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing" - ) - license: Option[String] = None, - @Group("RedHat") - @HelpMessage( - "The number of times this version of the software was released, default: 1" - ) - release: String = "1", - @HelpMessage( - "Architecture that are supported by the repository, default: noarch" - ) - rpmArchitecture: String = "noarch" + @Group("RedHat") + @HelpMessage( + "License that are supported by the repository - list of licenses https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing" + ) + license: Option[String] = None, + @Group("RedHat") + @HelpMessage( + "The number of times this version of the software was released, default: 1" + ) + release: String = "1", + @HelpMessage( + "Architecture that are supported by the repository, default: noarch" + ) + rpmArchitecture: String = "noarch" ) { def toRedHatSettings( - sharedSettings: SharedSettings, - description: Option[String] + sharedSettings: SharedSettings, + description: Option[String] ): RedHatSettings = RedHatSettings( shared = sharedSettings, @@ -42,6 +42,6 @@ final case class RedHatOptions( case object RedHatOptions { implicit val parser: Parser[RedHatOptions] = Parser[RedHatOptions] - implicit val help: Help[RedHatOptions] = Help[RedHatOptions] + implicit val help: Help[RedHatOptions] = Help[RedHatOptions] } diff --git a/modules/cli/src/main/scala/packager/cli/commands/SettingsHelpers.scala b/modules/cli/src/main/scala/packager/cli/commands/SettingsHelpers.scala index 3362c5c..216b9d2 100644 --- a/modules/cli/src/main/scala/packager/cli/commands/SettingsHelpers.scala +++ b/modules/cli/src/main/scala/packager/cli/commands/SettingsHelpers.scala @@ -2,14 +2,13 @@ package packager.cli.commands object SettingsHelpers { implicit class Mandatory[A](x: Option[A]) { - def mandatory(error: String): A = { + def mandatory(error: String): A = x match { case Some(v) => v case None => System.err.println(error) sys.exit(1) } - } } implicit class Validate[A](x: Option[A]) { diff --git a/modules/cli/src/main/scala/packager/cli/commands/SharedOptions.scala b/modules/cli/src/main/scala/packager/cli/commands/SharedOptions.scala index 90ee876..040c0b0 100644 --- a/modules/cli/src/main/scala/packager/cli/commands/SharedOptions.scala +++ b/modules/cli/src/main/scala/packager/cli/commands/SharedOptions.scala @@ -4,35 +4,35 @@ import caseapp.{Group, HelpMessage, Name, Parser, ValueDescription} import caseapp.core.help.Help final case class SharedOptions( - @Group("Shared") - @HelpMessage("Set launcher app name, default: name of source app") - @ValueDescription("launcher-app-name") - launcherApp: Option[String] = None, - @Group("Shared") - @HelpMessage("The version is set to 1.0.0 by default") - @Name("v") - version: String = "1.0.0", - @Group("Shared") - @HelpMessage( - "Set package description, default: Native package building by scala-packager" - ) - @ValueDescription("Description") - @Name("d") - description: Option[String] = None, - @Group("Shared") - @HelpMessage( - "It should contains names and email addresses of co-maintainers of the package" - ) - @Name("m") - maintainer: Option[String] = None, - @Group("Windows") - @HelpMessage( - "Path to application logo in png format, it will be used to generate icon and banner/dialog in msi installer" - ) - logoPath: Option[String] = None + @Group("Shared") + @HelpMessage("Set launcher app name, default: name of source app") + @ValueDescription("launcher-app-name") + launcherApp: Option[String] = None, + @Group("Shared") + @HelpMessage("The version is set to 1.0.0 by default") + @Name("v") + version: String = "1.0.0", + @Group("Shared") + @HelpMessage( + "Set package description, default: Native package building by scala-packager" + ) + @ValueDescription("Description") + @Name("d") + description: Option[String] = None, + @Group("Shared") + @HelpMessage( + "It should contains names and email addresses of co-maintainers of the package" + ) + @Name("m") + maintainer: Option[String] = None, + @Group("Windows") + @HelpMessage( + "Path to application logo in png format, it will be used to generate icon and banner/dialog in msi installer" + ) + logoPath: Option[String] = None ) case object SharedOptions { implicit val parser: Parser[SharedOptions] = Parser[SharedOptions] - implicit val help: Help[SharedOptions] = Help[SharedOptions] + implicit val help: Help[SharedOptions] = Help[SharedOptions] } diff --git a/modules/cli/src/main/scala/packager/cli/commands/WindowsOptions.scala b/modules/cli/src/main/scala/packager/cli/commands/WindowsOptions.scala index 4b88756..5a2e1a3 100644 --- a/modules/cli/src/main/scala/packager/cli/commands/WindowsOptions.scala +++ b/modules/cli/src/main/scala/packager/cli/commands/WindowsOptions.scala @@ -6,39 +6,39 @@ import SettingsHelpers.{Mandatory, Validate} import packager.config.{SharedSettings, WindowsSettings} final case class WindowsOptions( - @Group("Windows") - @HelpMessage("Path to license file") - licensePath: Option[String] = None, - @Group("Windows") - @HelpMessage("Name of product, default: Scala packager") - productName: String = "Scala packager", - @Group("Windows") - @HelpMessage("Text will be displayed on exit dialog") - exitDialog: Option[String] = None, - @Group("Windows") - @HelpMessage( - "Suppress Wix ICE validation (required for users that are neither interactive, not local administrators)" - ) - suppressValidation: Boolean = false, - @Group("Windows") - @HelpMessage("Path to extra WIX config content") - @ValueDescription("path") - extraConfigs: List[String] = Nil, - @Group("Windows") - @HelpMessage("Whether a 64-bit executable is getting packaged") - @Name("64") - is64Bits: Boolean = true, - @Group("Windows") - @HelpMessage("WIX installer version") - installerVersion: Option[String] = None, - @Group("Windows") - @HelpMessage("The GUID to identify that the windows package can be upgraded.") - wixUpgradeCodeGuid: Option[String] = None + @Group("Windows") + @HelpMessage("Path to license file") + licensePath: Option[String] = None, + @Group("Windows") + @HelpMessage("Name of product, default: Scala packager") + productName: String = "Scala packager", + @Group("Windows") + @HelpMessage("Text will be displayed on exit dialog") + exitDialog: Option[String] = None, + @Group("Windows") + @HelpMessage( + "Suppress Wix ICE validation (required for users that are neither interactive, not local administrators)" + ) + suppressValidation: Boolean = false, + @Group("Windows") + @HelpMessage("Path to extra WIX config content") + @ValueDescription("path") + extraConfigs: List[String] = Nil, + @Group("Windows") + @HelpMessage("Whether a 64-bit executable is getting packaged") + @Name("64") + is64Bits: Boolean = true, + @Group("Windows") + @HelpMessage("WIX installer version") + installerVersion: Option[String] = None, + @Group("Windows") + @HelpMessage("The GUID to identify that the windows package can be upgraded.") + wixUpgradeCodeGuid: Option[String] = None ) { def toWindowsSettings( - sharedSettings: SharedSettings, - maintainer: Option[String] + sharedSettings: SharedSettings, + maintainer: Option[String] ): WindowsSettings = WindowsSettings( shared = sharedSettings, @@ -64,5 +64,5 @@ final case class WindowsOptions( case object WindowsOptions { implicit val parser: Parser[WindowsOptions] = Parser[WindowsOptions] - implicit val help: Help[WindowsOptions] = Help[WindowsOptions] + implicit val help: Help[WindowsOptions] = Help[WindowsOptions] } diff --git a/modules/image-resizer/src/main/scala/packager/windows/DefaultImageResizer.scala b/modules/image-resizer/src/main/scala/packager/windows/DefaultImageResizer.scala index 343a5b5..131a35e 100644 --- a/modules/image-resizer/src/main/scala/packager/windows/DefaultImageResizer.scala +++ b/modules/image-resizer/src/main/scala/packager/windows/DefaultImageResizer.scala @@ -13,7 +13,7 @@ import javax.imageio.ImageIO case object DefaultImageResizer extends ImageResizer { def generateIcon(logoPath: os.Path, workDirPath: os.Path): os.Path = { - val icoTmpPath = workDirPath / "logo_tmp.ico" + val icoTmpPath = workDirPath / "logo_tmp.ico" val resizedLogoPath = resizeLogo(logoPath, 32, 32, workDirPath) val iconImage: BufferedImage = ImageIO.read(new File(resizedLogoPath.toString())); @@ -27,10 +27,10 @@ case object DefaultImageResizer extends ImageResizer { new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB) private def resizeLogo( - logoPath: os.Path, - width: Int, - height: Int, - workDir: os.Path + logoPath: os.Path, + width: Int, + height: Int, + workDir: os.Path ) = { val resizedPath = workDir / "resized-logo.png" Thumbnails @@ -44,7 +44,7 @@ case object DefaultImageResizer extends ImageResizer { def generateBanner(logoPath: os.Path, workDirPath: os.Path): os.Path = { val emptyBanner = generateEmptyImage(493, 58) - val bannerPath = workDirPath / s"banner.bmp" + val bannerPath = workDirPath / s"banner.bmp" val resizedLogoPath = resizeLogo(logoPath, 55, 55, workDirPath) Thumbnails @@ -64,7 +64,7 @@ case object DefaultImageResizer extends ImageResizer { def generateDialog(logoPath: os.Path, workDirPath: os.Path): os.Path = { val emptyDialog = generateEmptyImage(493, 312) - val dialogPath = workDirPath / s"dialog.bmp" + val dialogPath = workDirPath / s"dialog.bmp" val resizedLogoPath = resizeLogo(logoPath, 165, 330, workDirPath) diff --git a/modules/image-resizer/src/test/scala/packager/windows/WindowsPackageTests.scala b/modules/image-resizer/src/test/scala/packager/windows/WindowsPackageTests.scala index 1c2b25d..c19cea9 100644 --- a/modules/image-resizer/src/test/scala/packager/windows/WindowsPackageTests.scala +++ b/modules/image-resizer/src/test/scala/packager/windows/WindowsPackageTests.scala @@ -63,6 +63,6 @@ class WindowsPackageTests extends munit.FunSuite with NativePackageHelper { extraConfigs = Nil, is64Bits = false, installerVersion = None, - wixUpgradeCodeGuid = None, + wixUpgradeCodeGuid = None ) } diff --git a/modules/image-resizer/src/test/scala/packager/windows/WixLogoSpec.scala b/modules/image-resizer/src/test/scala/packager/windows/WixLogoSpec.scala index 89282c6..d028fd7 100644 --- a/modules/image-resizer/src/test/scala/packager/windows/WixLogoSpec.scala +++ b/modules/image-resizer/src/test/scala/packager/windows/WixLogoSpec.scala @@ -5,7 +5,7 @@ import packager.TestUtils class WixLogoSpec extends munit.FunSuite { - private lazy val workDirPath = TestUtils.tmpUtilDir + private lazy val workDirPath = TestUtils.tmpUtilDir private lazy val logoPath: os.Path = TestUtils.logo(workDirPath) test("should prepare icon for wix installer") { diff --git a/modules/packager/src/main/scala/packager/FileUtils.scala b/modules/packager/src/main/scala/packager/FileUtils.scala index bddc8e5..2004153 100644 --- a/modules/packager/src/main/scala/packager/FileUtils.scala +++ b/modules/packager/src/main/scala/packager/FileUtils.scala @@ -6,7 +6,7 @@ import packager.config.{BuildSettings, NativeSettings} object FileUtils { def alreadyExistsCheck( - destPath: os.Path + destPath: os.Path )(implicit buildOptions: NativeSettings): Unit = if (!buildOptions.shared.force && os.exists(destPath)) { System.err.println( @@ -16,21 +16,21 @@ object FileUtils { } def copy(from: os.Path, to: os.Path)(implicit - buildOptions: NativeSettings + buildOptions: NativeSettings ): Unit = { alreadyExistsCheck(to) os.copy.over(from, to) } def move(from: os.Path, to: os.Path)(implicit - buildOptions: NativeSettings + buildOptions: NativeSettings ): Unit = { alreadyExistsCheck(to) os.move.over(from, to) } def write(destPath: os.Path, content: String, perms: PermSet = null)(implicit - buildOptions: NativeSettings + buildOptions: NativeSettings ): Unit = { alreadyExistsCheck(destPath) os.write.over(destPath, content, perms) diff --git a/modules/packager/src/main/scala/packager/config/DebianSettings.scala b/modules/packager/src/main/scala/packager/config/DebianSettings.scala index e26be12..50ae08d 100644 --- a/modules/packager/src/main/scala/packager/config/DebianSettings.scala +++ b/modules/packager/src/main/scala/packager/config/DebianSettings.scala @@ -1,12 +1,12 @@ package packager.config case class DebianSettings( - shared: SharedSettings, - maintainer: String, - description: String, - debianConflicts: List[String], - debianDependencies: List[String], - architecture: String, - priority: Option[String], - section: Option[String] + shared: SharedSettings, + maintainer: String, + description: String, + debianConflicts: List[String], + debianDependencies: List[String], + architecture: String, + priority: Option[String], + section: Option[String] ) extends NativeSettings diff --git a/modules/packager/src/main/scala/packager/config/DockerSettings.scala b/modules/packager/src/main/scala/packager/config/DockerSettings.scala index 203d446..d14ca03 100644 --- a/modules/packager/src/main/scala/packager/config/DockerSettings.scala +++ b/modules/packager/src/main/scala/packager/config/DockerSettings.scala @@ -2,12 +2,11 @@ package packager.config import java.nio.file.Path; - case class DockerSettings( - from: String, - registry: Option[String], - repository: String, - tag: Option[String], - exec: Option[String], - dockerExecutable: Option[Path] + from: String, + registry: Option[String], + repository: String, + tag: Option[String], + exec: Option[String], + dockerExecutable: Option[Path] ) extends BuildSettings diff --git a/modules/packager/src/main/scala/packager/config/MacOSSettings.scala b/modules/packager/src/main/scala/packager/config/MacOSSettings.scala index a58e2f2..a5903ef 100644 --- a/modules/packager/src/main/scala/packager/config/MacOSSettings.scala +++ b/modules/packager/src/main/scala/packager/config/MacOSSettings.scala @@ -1,6 +1,6 @@ package packager.config case class MacOSSettings( - shared: SharedSettings, - identifier: String + shared: SharedSettings, + identifier: String ) extends NativeSettings diff --git a/modules/packager/src/main/scala/packager/config/RedHatSettings.scala b/modules/packager/src/main/scala/packager/config/RedHatSettings.scala index 555dc92..0eefa76 100644 --- a/modules/packager/src/main/scala/packager/config/RedHatSettings.scala +++ b/modules/packager/src/main/scala/packager/config/RedHatSettings.scala @@ -1,9 +1,9 @@ package packager.config case class RedHatSettings( - shared: SharedSettings, - description: String, - license: String, - release: String, - rpmArchitecture: String + shared: SharedSettings, + description: String, + license: String, + release: String, + rpmArchitecture: String ) extends NativeSettings diff --git a/modules/packager/src/main/scala/packager/config/SharedSettings.scala b/modules/packager/src/main/scala/packager/config/SharedSettings.scala index be94fa9..1181e45 100644 --- a/modules/packager/src/main/scala/packager/config/SharedSettings.scala +++ b/modules/packager/src/main/scala/packager/config/SharedSettings.scala @@ -1,11 +1,11 @@ package packager.config case class SharedSettings( - sourceAppPath: os.Path, - version: String, - force: Boolean = false, - workingDirectoryPath: Option[os.Path] = None, - outputPath: os.Path, - logoPath: Option[os.Path], - launcherApp: Option[String] = None + sourceAppPath: os.Path, + version: String, + force: Boolean = false, + workingDirectoryPath: Option[os.Path] = None, + outputPath: os.Path, + logoPath: Option[os.Path], + launcherApp: Option[String] = None ) diff --git a/modules/packager/src/main/scala/packager/config/WindowsSettings.scala b/modules/packager/src/main/scala/packager/config/WindowsSettings.scala index 4487f64..6ef6d27 100644 --- a/modules/packager/src/main/scala/packager/config/WindowsSettings.scala +++ b/modules/packager/src/main/scala/packager/config/WindowsSettings.scala @@ -1,14 +1,14 @@ package packager.config case class WindowsSettings( - shared: SharedSettings, - maintainer: String, - licencePath: os.ReadablePath, - productName: String, - exitDialog: Option[String], - suppressValidation: Boolean, - extraConfigs: List[String], - is64Bits: Boolean, - installerVersion: Option[String], - wixUpgradeCodeGuid: Option[String] + shared: SharedSettings, + maintainer: String, + licencePath: os.ReadablePath, + productName: String, + exitDialog: Option[String], + suppressValidation: Boolean, + extraConfigs: List[String], + is64Bits: Boolean, + installerVersion: Option[String], + wixUpgradeCodeGuid: Option[String] ) extends NativeSettings diff --git a/modules/packager/src/main/scala/packager/deb/DebianMetaData.scala b/modules/packager/src/main/scala/packager/deb/DebianMetaData.scala index 05d8925..089ed7a 100644 --- a/modules/packager/src/main/scala/packager/deb/DebianMetaData.scala +++ b/modules/packager/src/main/scala/packager/deb/DebianMetaData.scala @@ -1,12 +1,12 @@ package packager.deb case class DebianMetaData( - debianInfo: DebianPackageInfo, - architecture: String = "all", - dependsOn: List[String] = Nil, - conflicts: List[String] = Nil, - priority: Option[String], - section: Option[String] + debianInfo: DebianPackageInfo, + architecture: String = "all", + dependsOn: List[String] = Nil, + conflicts: List[String] = Nil, + priority: Option[String], + section: Option[String] ) { def generateContent(): String = { diff --git a/modules/packager/src/main/scala/packager/deb/DebianPackage.scala b/modules/packager/src/main/scala/packager/deb/DebianPackage.scala index 9d1544c..77796ea 100644 --- a/modules/packager/src/main/scala/packager/deb/DebianPackage.scala +++ b/modules/packager/src/main/scala/packager/deb/DebianPackage.scala @@ -5,10 +5,10 @@ import packager.config.DebianSettings case class DebianPackage(buildSettings: DebianSettings) extends NativePackager { - private val debianBasePath = basePath / "debian" - private val usrDirectory = debianBasePath / "usr" - private val packageInfo = buildDebianInfo() - private val metaData = buildDebianMetaData(packageInfo) + private val debianBasePath = basePath / "debian" + private val usrDirectory = debianBasePath / "usr" + private val packageInfo = buildDebianInfo() + private val metaData = buildDebianMetaData(packageInfo) private val mainDebianDirectory = debianBasePath / "DEBIAN" override def build(): Unit = { @@ -67,8 +67,8 @@ case class DebianPackage(buildSettings: DebianSettings) extends NativePackager { os.makeDir.all(binDirectory) val launchScriptFile = binDirectory / launcherApp val content = s"""#!/bin/bash - |/usr/share/scala/$launcherApp \"$$@\" - |""".stripMargin + |/usr/share/scala/$launcherApp \"$$@\" + |""".stripMargin FileUtils.write(launchScriptFile, content, FileUtils.executablePerms) } diff --git a/modules/packager/src/main/scala/packager/deb/DebianPackageInfo.scala b/modules/packager/src/main/scala/packager/deb/DebianPackageInfo.scala index d7d55c3..1f29458 100644 --- a/modules/packager/src/main/scala/packager/deb/DebianPackageInfo.scala +++ b/modules/packager/src/main/scala/packager/deb/DebianPackageInfo.scala @@ -1,8 +1,8 @@ package packager.deb case class DebianPackageInfo( - packageName: String, - version: String, - maintainer: String, - description: String + packageName: String, + version: String, + maintainer: String, + description: String ) diff --git a/modules/packager/src/main/scala/packager/docker/DockerPackage.scala b/modules/packager/src/main/scala/packager/docker/DockerPackage.scala index cb3362d..c2b123c 100644 --- a/modules/packager/src/main/scala/packager/docker/DockerPackage.scala +++ b/modules/packager/src/main/scala/packager/docker/DockerPackage.scala @@ -1,11 +1,6 @@ package packager.docker -import com.google.cloud.tools.jib.api.{ - Containerizer, - DockerDaemonImage, - ImageReference, - Jib -} +import com.google.cloud.tools.jib.api.{Containerizer, DockerDaemonImage, ImageReference, Jib} import com.google.cloud.tools.jib.api.buildplan.{ AbsoluteUnixPath, FileEntriesLayer, @@ -35,8 +30,8 @@ case class DockerPackage(sourceAppPath: os.Path, buildSettings: DockerSettings) .getOrElse(List(s"/$launcherApp")) def makeFileEntryLayerConfiguration( - resourcePath: os.Path, - dest: String + resourcePath: os.Path, + dest: String ): FileEntriesLayer = { val layerConfigurationBuilder = FileEntriesLayer.builder layerConfigurationBuilder.addEntry( @@ -55,7 +50,9 @@ case class DockerPackage(sourceAppPath: os.Path, buildSettings: DockerSettings) .setCreationTime(Instant.now()) .setEntrypoint(entrypoint: _*) .containerize( - Containerizer.to(buildSettings.dockerExecutable.map(targetImage.setDockerExecutable).getOrElse(targetImage)) + Containerizer.to( + buildSettings.dockerExecutable.map(targetImage.setDockerExecutable).getOrElse(targetImage) + ) ) } diff --git a/modules/packager/src/main/scala/packager/mac/MacOSInfoPlist.scala b/modules/packager/src/main/scala/packager/mac/MacOSInfoPlist.scala index db1f13e..bedc4fd 100644 --- a/modules/packager/src/main/scala/packager/mac/MacOSInfoPlist.scala +++ b/modules/packager/src/main/scala/packager/mac/MacOSInfoPlist.scala @@ -3,16 +3,17 @@ package packager.mac case class MacOSInfoPlist(executableName: String, identifier: String) { def generateContent: String = { - val content = s""" - | - | - | - | CFBundleExecutable - | $executableName - | CFBundleIdentifier - | $identifier - | - |""".stripMargin + val content = + s""" + | + | + | + | CFBundleExecutable + | $executableName + | CFBundleIdentifier + | $identifier + | + |""".stripMargin content } diff --git a/modules/packager/src/main/scala/packager/mac/MacOSNativePackager.scala b/modules/packager/src/main/scala/packager/mac/MacOSNativePackager.scala index 27d8465..92ec2d6 100644 --- a/modules/packager/src/main/scala/packager/mac/MacOSNativePackager.scala +++ b/modules/packager/src/main/scala/packager/mac/MacOSNativePackager.scala @@ -6,8 +6,8 @@ import packager.config.MacOSSettings trait MacOSNativePackager extends NativePackager { protected val macOSAppPath: os.Path = basePath / s"$packageName.app" - protected val contentPath: os.Path = macOSAppPath / "Contents" - protected val macOsPath: os.Path = contentPath / "MacOS" + protected val contentPath: os.Path = macOSAppPath / "Contents" + protected val macOsPath: os.Path = contentPath / "MacOS" protected val infoPlist: MacOSInfoPlist = MacOSInfoPlist(packageName, buildSettings.identifier) diff --git a/modules/packager/src/main/scala/packager/mac/dmg/DmgPackage.scala b/modules/packager/src/main/scala/packager/mac/dmg/DmgPackage.scala index c743f8c..9627515 100644 --- a/modules/packager/src/main/scala/packager/mac/dmg/DmgPackage.scala +++ b/modules/packager/src/main/scala/packager/mac/dmg/DmgPackage.scala @@ -8,7 +8,7 @@ case class DmgPackage(buildSettings: MacOSSettings) private val tmpPackageName = s"$packageName-tmp" private val mountpointPath = basePath / "mountpoint" - private val appSize: Long = os.size(sourceAppPath) / (1024L * 1024L) + 1 + private val appSize: Long = os.size(sourceAppPath) / (1024L * 1024L) + 1 override def build(): Unit = { os.proc( diff --git a/modules/packager/src/main/scala/packager/mac/pkg/PkgPackage.scala b/modules/packager/src/main/scala/packager/mac/pkg/PkgPackage.scala index eb29e9d..66d9cd7 100644 --- a/modules/packager/src/main/scala/packager/mac/pkg/PkgPackage.scala +++ b/modules/packager/src/main/scala/packager/mac/pkg/PkgPackage.scala @@ -35,9 +35,10 @@ case class PkgPackage(buildSettings: MacOSSettings) } private def createScriptFile(): Unit = { - val content = s"""#!/bin/bash - |rm -f /usr/local/bin/$launcherApp - |ln -s /Applications/$packageName.app/Contents/MacOS/$launcherApp /usr/local/bin/$launcherApp""".stripMargin + val content = + s"""#!/bin/bash + |rm -f /usr/local/bin/$launcherApp + |ln -s /Applications/$packageName.app/Contents/MacOS/$launcherApp /usr/local/bin/$launcherApp""".stripMargin os.makeDir.all(scriptsPath) val postInstallPath = scriptsPath / "postinstall" FileUtils.write(postInstallPath, content, FileUtils.executablePerms) diff --git a/modules/packager/src/main/scala/packager/rpm/RedHatPackage.scala b/modules/packager/src/main/scala/packager/rpm/RedHatPackage.scala index e064d61..c8f1c4e 100644 --- a/modules/packager/src/main/scala/packager/rpm/RedHatPackage.scala +++ b/modules/packager/src/main/scala/packager/rpm/RedHatPackage.scala @@ -5,11 +5,11 @@ import packager.config.RedHatSettings case class RedHatPackage(buildSettings: RedHatSettings) extends NativePackager { - private val redHatBasePath = basePath / "rpmbuild" + private val redHatBasePath = basePath / "rpmbuild" private val sourcesDirectory = redHatBasePath / "SOURCES" - private val specsDirectory = redHatBasePath / "SPECS" - private val rpmsDirectory = redHatBasePath / "RPMS" - private val redHatSpec = buildRedHatSpec() + private val specsDirectory = redHatBasePath / "SPECS" + private val rpmsDirectory = redHatBasePath / "RPMS" + private val redHatSpec = buildRedHatSpec() override def build(): Unit = { createRedHatDir() @@ -40,7 +40,7 @@ case class RedHatPackage(buildSettings: RedHatSettings) extends NativePackager { } private def createSpecFile(): Unit = { - val content = redHatSpec.generateContent + val content = redHatSpec.generateContent val specFilePath = specsDirectory / s"$packageName.spec" FileUtils.write(specFilePath, content) } diff --git a/modules/packager/src/main/scala/packager/rpm/RedHatSpecPackage.scala b/modules/packager/src/main/scala/packager/rpm/RedHatSpecPackage.scala index e364c4f..8867ea3 100644 --- a/modules/packager/src/main/scala/packager/rpm/RedHatSpecPackage.scala +++ b/modules/packager/src/main/scala/packager/rpm/RedHatSpecPackage.scala @@ -1,12 +1,12 @@ package packager.rpm case class RedHatSpecPackage( - launcherAppName: String, - version: String, - description: String, - buildArch: String, - license: String, - release: String + launcherAppName: String, + version: String, + description: String, + buildArch: String, + license: String, + release: String ) { def generateContent: String = diff --git a/modules/packager/src/main/scala/packager/windows/WindowsPackage.scala b/modules/packager/src/main/scala/packager/windows/WindowsPackage.scala index d90ef25..1fb4423 100644 --- a/modules/packager/src/main/scala/packager/windows/WindowsPackage.scala +++ b/modules/packager/src/main/scala/packager/windows/WindowsPackage.scala @@ -4,12 +4,12 @@ import packager.{FileUtils, NativePackager} import packager.config.WindowsSettings case class WindowsPackage( - buildSettings: WindowsSettings, - imageResizerOpt: Option[ImageResizer] = None + buildSettings: WindowsSettings, + imageResizerOpt: Option[ImageResizer] = None ) extends NativePackager { private val wixConfigPath: os.Path = basePath / s"$packageName.wxs" - private val licensePath: os.Path = basePath / s"license.rtf" + private val licensePath: os.Path = basePath / s"license.rtf" override def build(): Unit = { @@ -50,9 +50,9 @@ case class WindowsPackage( createConfFile(wixConfig) copyLicenseToBasePath() - val wixBin = Option(System.getenv("WIX")).getOrElse("\"%WIX%bin\"") + val wixBin = Option(System.getenv("WIX")).getOrElse("\"%WIX%bin\"") val candleBinPath = os.Path(wixBin) / "bin" / "candle.exe" - val lightBinPath = os.Path(wixBin) / "bin" / "light.exe" + val lightBinPath = os.Path(wixBin) / "bin" / "light.exe" val lightExtraArguments = if (buildSettings.suppressValidation) Seq("-sval") diff --git a/modules/packager/src/main/scala/packager/windows/WindowsWixConfig.scala b/modules/packager/src/main/scala/packager/windows/WindowsWixConfig.scala index b38382f..21cd65b 100644 --- a/modules/packager/src/main/scala/packager/windows/WindowsWixConfig.scala +++ b/modules/packager/src/main/scala/packager/windows/WindowsWixConfig.scala @@ -6,21 +6,21 @@ import java.nio.charset.Charset import scala.io.Codec case class WindowsWixConfig( - packageName: String, - sourcePath: os.Path, - iconPath: Option[os.Path], - bannerPath: Option[os.Path], - dialogPath: Option[os.Path], - licensePath: os.Path, - exitDialog: Option[String], - productName: String, - version: String, - maintainer: String, - launcherAppName: String, - extraConfigs: List[String], - is64Bits: Boolean, - installerVersion: Option[String], - wixUpgradeCodeGuid: Option[String] + packageName: String, + sourcePath: os.Path, + iconPath: Option[os.Path], + bannerPath: Option[os.Path], + dialogPath: Option[os.Path], + licensePath: os.Path, + exitDialog: Option[String], + productName: String, + version: String, + maintainer: String, + launcherAppName: String, + extraConfigs: List[String], + is64Bits: Boolean, + installerVersion: Option[String], + wixUpgradeCodeGuid: Option[String] ) { lazy val extraConfig: Option[String] = @@ -76,8 +76,8 @@ case class WindowsWixConfig( + "200" + )}" Compressed="yes" Comments="Windows Installer Package"/> @@ -85,7 +85,8 @@ case class WindowsWixConfig( - + diff --git a/modules/packager/src/main/scala/packager/windows/wix/WixId.scala b/modules/packager/src/main/scala/packager/windows/wix/WixId.scala index 9d205bb..ace1e65 100644 --- a/modules/packager/src/main/scala/packager/windows/wix/WixId.scala +++ b/modules/packager/src/main/scala/packager/windows/wix/WixId.scala @@ -10,4 +10,4 @@ case object WixUIDialogBmp extends WixVariableId sealed trait PropertyId extends WixId case object WIXUI_EXITDIALOGOPTIONALTEXT extends PropertyId -case object ARPPRODUCTICON extends PropertyId +case object ARPPRODUCTICON extends PropertyId diff --git a/modules/packager/src/test/scala/packager/PackagerHelper.scala b/modules/packager/src/test/scala/packager/PackagerHelper.scala index 38ffd12..e084b95 100644 --- a/modules/packager/src/test/scala/packager/PackagerHelper.scala +++ b/modules/packager/src/test/scala/packager/PackagerHelper.scala @@ -3,10 +3,10 @@ package packager import packager.config.BuildSettings trait PackagerHelper { - lazy val packageName = "echo" - lazy val tmpDir: os.Path = TestUtils.tmpUtilDir + lazy val packageName = "echo" + lazy val tmpDir: os.Path = TestUtils.tmpUtilDir lazy val echoLauncherPath: os.Path = TestUtils.echoLauncher(tmpDir) - lazy val echoNativePath: os.Path = TestUtils.echoNative(tmpDir) + lazy val echoNativePath: os.Path = TestUtils.echoNative(tmpDir) def buildSettings: BuildSettings } diff --git a/modules/packager/src/test/scala/packager/deb/DebianPackageTests.scala b/modules/packager/src/test/scala/packager/deb/DebianPackageTests.scala index b51b82c..5ba930c 100644 --- a/modules/packager/src/test/scala/packager/deb/DebianPackageTests.scala +++ b/modules/packager/src/test/scala/packager/deb/DebianPackageTests.scala @@ -17,7 +17,7 @@ class DebianPackageTests extends munit.FunSuite with NativePackageHelper { // create app directory dmgPackage.createDebianDir() - val debianDirectoryPath = tmpDir / "debian" + val debianDirectoryPath = tmpDir / "debian" val expectedAppDirectoryPath = debianDirectoryPath / "DEBIAN" val expectedEchoLauncherPath = debianDirectoryPath / "usr" / "share" / "scala" / packageName diff --git a/modules/packager/src/test/scala/packager/dmg/DmgPackageTests.scala b/modules/packager/src/test/scala/packager/dmg/DmgPackageTests.scala index a6c18bf..b3a6687 100644 --- a/modules/packager/src/test/scala/packager/dmg/DmgPackageTests.scala +++ b/modules/packager/src/test/scala/packager/dmg/DmgPackageTests.scala @@ -49,7 +49,7 @@ class DmgPackageTests extends munit.FunSuite with NativePackageHelper { test("size dmg package should be similar to the app") { - val dmgPackage = DmgPackage(buildSettings) + val dmgPackage = DmgPackage(buildSettings) val echoLauncherSize = os.size(echoLauncherPath) // create dmg package diff --git a/modules/packager/src/test/scala/packager/docker/DockerPackageTests.scala b/modules/packager/src/test/scala/packager/docker/DockerPackageTests.scala index 5ba41ea..a9985e8 100644 --- a/modules/packager/src/test/scala/packager/docker/DockerPackageTests.scala +++ b/modules/packager/src/test/scala/packager/docker/DockerPackageTests.scala @@ -9,56 +9,52 @@ import scala.util.Properties class DockerPackageTests extends munit.FunSuite with PackagerHelper { - private val qualifier = "latest" + private val qualifier = "latest" private val repository = "echo-scala-packager" if (Properties.isLinux) { test("should build docker image") { - { - val dockerPackage = DockerPackage(echoLauncherPath, buildSettings) - // build docker image - dockerPackage.build() + val dockerPackage = DockerPackage(echoLauncherPath, buildSettings) + // build docker image + dockerPackage.build() - val expectedImage = - s"$repository:$qualifier" - val expectedOutput = "echo" + val expectedImage = + s"$repository:$qualifier" + val expectedOutput = "echo" - val output = os - .proc("docker", "run", expectedImage, expectedOutput) - .call(cwd = os.root) - .out - .text() - .trim + val output = os + .proc("docker", "run", expectedImage, expectedOutput) + .call(cwd = os.root) + .out + .text() + .trim - expect(output == expectedOutput) + expect(output == expectedOutput) - // clear - os.proc("docker", "rmi", "-f", expectedImage).call(cwd = os.root) - } + // clear + os.proc("docker", "rmi", "-f", expectedImage).call(cwd = os.root) } test("should build docker image with native application") { - { - val nativeAppSettings = buildSettings.copy(exec = None) - val dockerPackage = DockerPackage(echoNativePath, nativeAppSettings) - // build docker image - dockerPackage.build() + val nativeAppSettings = buildSettings.copy(exec = None) + val dockerPackage = DockerPackage(echoNativePath, nativeAppSettings) + // build docker image + dockerPackage.build() - val expectedImage = - s"$repository:$qualifier" - val expectedOutput = "echo" + val expectedImage = + s"$repository:$qualifier" + val expectedOutput = "echo" - val output = os - .proc("docker", "run", expectedImage, expectedOutput) - .call(cwd = os.root) - .out - .text() - .trim + val output = os + .proc("docker", "run", expectedImage, expectedOutput) + .call(cwd = os.root) + .out + .text() + .trim - expect(output == expectedOutput) + expect(output == expectedOutput) - // clear - os.proc("docker", "rmi", "-f", expectedImage).call(cwd = os.root) - } + // clear + os.proc("docker", "rmi", "-f", expectedImage).call(cwd = os.root) } } diff --git a/modules/packager/src/test/scala/packager/pkg/PkgPackageTests.scala b/modules/packager/src/test/scala/packager/pkg/PkgPackageTests.scala index 9dfaf49..a15b55b 100644 --- a/modules/packager/src/test/scala/packager/pkg/PkgPackageTests.scala +++ b/modules/packager/src/test/scala/packager/pkg/PkgPackageTests.scala @@ -106,7 +106,7 @@ class PkgPackageTests extends munit.FunSuite with NativePackageHelper { val outPath = tmpDir / "out" os.proc("pkgutil", "--expand", outputPackagePath, outPath).call() - val scriptsPath = outPath / "Scripts" + val scriptsPath = outPath / "Scripts" val postInstallScriptPath = scriptsPath / "postinstall" expect(os.isDir(scriptsPath)) diff --git a/modules/packager/src/test/scala/packager/rpm/RedHatPackageTests.scala b/modules/packager/src/test/scala/packager/rpm/RedHatPackageTests.scala index 3777f88..f786eb5 100644 --- a/modules/packager/src/test/scala/packager/rpm/RedHatPackageTests.scala +++ b/modules/packager/src/test/scala/packager/rpm/RedHatPackageTests.scala @@ -18,7 +18,7 @@ class RedHatPackageTests extends munit.FunSuite with NativePackageHelper { // create app directory rpmPackage.createRedHatDir() - val rpmDirectoryPath = tmpDir / "rpmbuild" + val rpmDirectoryPath = tmpDir / "rpmbuild" val expectedAppDirectoryPath = rpmDirectoryPath / "SOURCES" val expectedEchoLauncherPath = expectedAppDirectoryPath / packageName diff --git a/project/Deps.scala b/project/Deps.scala index 31a9c9d..97c48e7 100644 --- a/project/Deps.scala +++ b/project/Deps.scala @@ -1,12 +1,12 @@ import sbt._ object Deps { - def expecty = "com.eed3si9n.expecty" %% "expecty" % "0.16.0" - def munit = "org.scalameta" %% "munit" % "0.7.29" - def osLib = "com.lihaoyi" %% "os-lib" % "0.9.1" - def caseApp = "com.github.alexarchambault" %% "case-app" % "2.1.0-M24" - def thumbnailator = "net.coobird" % "thumbnailator" % "0.4.20" - def image4j = "org.jclarion" % "image4j" % "0.7" - def jib = "com.google.cloud.tools" % "jib-core" % "0.24.0" - def commonsIo = "commons-io" % "commons-io" % "2.13.0" + def expecty = "com.eed3si9n.expecty" %% "expecty" % "0.16.0" + def munit = "org.scalameta" %% "munit" % "0.7.29" + def osLib = "com.lihaoyi" %% "os-lib" % "0.9.1" + def caseApp = "com.github.alexarchambault" %% "case-app" % "2.1.0-M24" + def thumbnailator = "net.coobird" % "thumbnailator" % "0.4.20" + def image4j = "org.jclarion" % "image4j" % "0.7" + def jib = "com.google.cloud.tools" % "jib-core" % "0.24.0" + def commonsIo = "commons-io" % "commons-io" % "2.13.0" } diff --git a/project/ScalaVersions.scala b/project/ScalaVersions.scala index 4a1baea..9d6b824 100644 --- a/project/ScalaVersions.scala +++ b/project/ScalaVersions.scala @@ -1,5 +1,5 @@ object ScalaVersions { def scala212 = "2.12.20" def scala213 = "2.13.15" - def all = Seq(scala213, scala212) + def all = Seq(scala213, scala212) } diff --git a/project/plugins.sbt b/project/plugins.sbt index b421953..0bb6799 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,2 +1,2 @@ addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.9.0") -addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0") +addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")