Skip to content

Commit

Permalink
Update scalafmt setting. enforce new wildcard syntax (#1668)
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k authored Jan 11, 2025
1 parent 29461e8 commit 379b670
Show file tree
Hide file tree
Showing 27 changed files with 85 additions and 72 deletions.
15 changes: 14 additions & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Version https://scalameta.org/scalafmt/docs/configuration.html#version
version = 3.8.3
# Dialect https://scalameta.org/scalafmt/docs/configuration.html#scala-dialects
runner.dialect = scala212
runner.dialect = scala212source3

style = IntelliJ
maxColumn = 120
Expand All @@ -14,3 +14,16 @@ project.excludePaths = [
"glob:**/src/main/scala/com/typesafe/sbt/packager/windows/WixHelper.scala"
]
project.layout = StandardConvention

fileOverride {
"glob:**/src/**/scala-3/**" {
runner.dialect = scala3
runner.dialectOverride.allowAsForImportRename = false
}
}

rewrite.scala3.convertToNewSyntax = true
rewrite.scala3.newSyntax.control = false
runner.dialectOverride.allowSignificantIndentation = false
runner.dialectOverride.allowAsForImportRename = false
runner.dialectOverride.allowStarWildcardImport = false
4 changes: 2 additions & 2 deletions src/main/scala/com/typesafe/sbt/PackagerPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ object SbtNativePackager extends AutoPlugin {
* }}}
*/
@deprecated("Use enablePlugins(JavaAppPackaging)", "1.x")
def java_application: Seq[Setting[_]] =
def java_application: Seq[Setting[?]] =
projectSettings ++
universal.UniversalPlugin.projectSettings ++
linux.LinuxPlugin.projectSettings ++
Expand All @@ -113,7 +113,7 @@ object SbtNativePackager extends AutoPlugin {
* }}}
*/
@deprecated("Use enablePlugins(JavaServerAppPackaging)", "1.x")
def java_server: Seq[Setting[_]] =
def java_server: Seq[Setting[?]] =
java_application ++ archetypes.JavaServerAppPackaging.projectSettings
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/com/typesafe/sbt/packager/FileUtil.scala
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ object permissions {

/** Enriches string with `oct` interpolator, parsing string as base 8 integer. */
implicit class OctalString(val sc: StringContext) extends AnyVal {
def oct(args: Any*) = Integer.parseInt(sc.s(args: _*), 8)
def oct(args: Any*) = Integer.parseInt(sc.s(args*), 8)
}

}
Expand Down
6 changes: 3 additions & 3 deletions src/main/scala/com/typesafe/sbt/packager/SettingsHelper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ object SettingsHelper {
packageTask: TaskKey[PluginCompat.FileRef],
extension: String,
classifier: Option[String] = None
): Seq[Setting[_]] =
): Seq[Setting[?]] =
inConfig(config)(
addArtifact(
name.apply(Artifact(_, extension, extension, classifier = classifier, configurations = Vector.empty, None)),
Expand All @@ -31,7 +31,7 @@ object SettingsHelper {
packageTask: TaskKey[PluginCompat.FileRef],
extension: String,
classifier: Option[String] = None
): Seq[Setting[_]] =
): Seq[Setting[?]] =
// Why do we need the ivyPublishSettings and jvmPublishSettings ?
inConfig(config)(Classpaths.ivyPublishSettings ++ Classpaths.jvmPublishSettings) ++ inConfig(config)(
Seq(
Expand Down Expand Up @@ -97,6 +97,6 @@ object SettingsHelper {
* @param config
* the ivy configuration to look for resolvers
*/
private def addResolver(config: Configuration): Seq[Setting[_]] =
private def addResolver(config: Configuration): Seq[Setting[?]] =
Seq(otherResolvers ++= (config / publishTo).value.toSeq)
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ object JavaServerAppPackaging extends AutoPlugin {
val ETC_DEFAULT = "etc-default"

/** These settings will be provided by this archetype */
def javaServerSettings: Seq[Setting[_]] =
def javaServerSettings: Seq[Setting[?]] =
linuxSettings ++ debianSettings ++ rpmSettings

/**
Expand All @@ -50,7 +50,7 @@ object JavaServerAppPackaging extends AutoPlugin {
* - logging directory
* - config directory
*/
def linuxSettings: Seq[Setting[_]] =
def linuxSettings: Seq[Setting[?]] =
Seq(
Linux / javaOptions := (Universal / javaOptions).value,
// === logging directory mapping ===
Expand All @@ -76,7 +76,7 @@ object JavaServerAppPackaging extends AutoPlugin {
/* etcDefaultConfig is dependent on serverLoading (systemd, systemv, etc.),
* and is therefore distro specific. As such, these settings cannot be defined
* in the global config scope. */
private[this] val etcDefaultConfig: Seq[Setting[_]] = Seq(
private[this] val etcDefaultConfig: Seq[Setting[?]] = Seq(
linuxEtcDefaultTemplate := getEtcTemplateSource(sourceDirectory.value, (serverLoading ?? None).value),
makeEtcDefault := makeEtcDefaultScript(
packageName.value,
Expand All @@ -87,7 +87,7 @@ object JavaServerAppPackaging extends AutoPlugin {
linuxPackageMappings ++= etcDefaultMapping(makeEtcDefault.value, bashScriptEnvConfigLocation.value)
)

def debianSettings: Seq[Setting[_]] = {
def debianSettings: Seq[Setting[?]] = {
import DebianPlugin.Names.{Postinst, Postrm, Preinst, Prerm}
inConfig(Debian)(etcDefaultConfig) ++
inConfig(Debian)(
Expand Down Expand Up @@ -118,7 +118,7 @@ object JavaServerAppPackaging extends AutoPlugin {
)
}

def rpmSettings: Seq[Setting[_]] =
def rpmSettings: Seq[Setting[?]] =
inConfig(Rpm)(etcDefaultConfig) ++
inConfig(Rpm)(
Seq(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ object JlinkPlugin extends AutoPlugin {

override def requires: Plugins = JavaAppPackaging

override lazy val projectSettings: Seq[Setting[_]] = Seq(
override lazy val projectSettings: Seq[Setting[?]] = Seq(
jlinkBuildImage / target := target.value / "jlink" / "output",
jlinkBundledJvmLocation := "jre",
bundledJvmLocation := Some(jlinkBundledJvmLocation.value),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ object BashStartScriptPlugin extends AutoPlugin with ApplicationIniGenerator wit

override protected[this] type SpecializedScriptConfig = BashScriptConfig

override def projectSettings: Seq[Setting[_]] =
override def projectSettings: Seq[Setting[?]] =
Seq(
bashScriptTemplateLocation := (sourceDirectory.value / "templates" / bashTemplate),
bashForwarderTemplateLocation := Some(sourceDirectory.value / "templates" / forwarderTemplateName),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ object BatStartScriptPlugin extends AutoPlugin with ApplicationIniGenerator with

override protected[this] type SpecializedScriptConfig = BatScriptConfig

override def projectSettings: Seq[Setting[_]] =
override def projectSettings: Seq[Setting[?]] =
Seq(
batScriptTemplateLocation := (sourceDirectory.value / "templates" / batTemplate),
batForwarderTemplateLocation := Some(sourceDirectory.value / "templates" / forwarderTemplateName),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ object SystemVPlugin extends AutoPlugin {

override def requires = SystemloaderPlugin

override def projectSettings: Seq[Setting[_]] =
override def projectSettings: Seq[Setting[?]] =
inConfig(Debian)(systemVSettings) ++ debianSettings ++
inConfig(Rpm)(systemVSettings) ++ rpmSettings

def systemVSettings: Seq[Setting[_]] =
def systemVSettings: Seq[Setting[?]] =
Seq(
// used by other archetypes to define systemloader dependent behaviour
serverLoading := Some(ServerLoader.SystemV),
Expand All @@ -49,7 +49,7 @@ object SystemVPlugin extends AutoPlugin {
)
)

def debianSettings: Seq[Setting[_]] =
def debianSettings: Seq[Setting[?]] =
inConfig(Debian)(
Seq(
// set the template
Expand All @@ -61,7 +61,7 @@ object SystemVPlugin extends AutoPlugin {
)
)

def rpmSettings: Seq[Setting[_]] =
def rpmSettings: Seq[Setting[?]] =
inConfig(Rpm)(
Seq(
// set the template
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ object SystemdPlugin extends AutoPlugin {

import autoImport._

override def projectSettings: Seq[Setting[_]] =
override def projectSettings: Seq[Setting[?]] =
debianSettings ++ inConfig(Debian)(systemdSettings) ++ rpmSettings ++ inConfig(Rpm)(systemdSettings)

def systemdSettings: Seq[Setting[_]] =
def systemdSettings: Seq[Setting[?]] =
Seq(
// used by other archetypes to define systemloader dependent behaviour
serverLoading := Some(ServerLoader.Systemd),
Expand All @@ -68,8 +68,8 @@ object SystemdPlugin extends AutoPlugin {
linuxScriptReplacements += ("TimeoutStopSec" -> killTimeout.value.toString)
)

def debianSettings: Seq[Setting[_]] = inConfig(Debian)(defaultLinuxStartScriptLocation := "/lib/systemd/system")
def debianSettings: Seq[Setting[?]] = inConfig(Debian)(defaultLinuxStartScriptLocation := "/lib/systemd/system")

def rpmSettings: Seq[Setting[_]] = inConfig(Rpm)(defaultLinuxStartScriptLocation := "/usr/lib/systemd/system")
def rpmSettings: Seq[Setting[?]] = inConfig(Rpm)(defaultLinuxStartScriptLocation := "/usr/lib/systemd/system")

}
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ object SystemloaderPlugin extends AutoPlugin {
com.typesafe.sbt.packager.archetypes.systemloader.ServerLoader
}

override def projectSettings: Seq[Setting[_]] =
override def projectSettings: Seq[Setting[?]] =
inConfig(Debian)(systemloaderSettings) ++ debianSettings ++
inConfig(Rpm)(systemloaderSettings) ++ rpmSettings

def systemloaderSettings: Seq[Setting[_]] =
def systemloaderSettings: Seq[Setting[?]] =
Seq(
serverLoading := None,
serviceAutostart := true,
Expand Down Expand Up @@ -90,7 +90,7 @@ object SystemloaderPlugin extends AutoPlugin {
if (autostart) s"${addService}\n${startService}" else addService
}

def debianSettings: Seq[Setting[_]] =
def debianSettings: Seq[Setting[?]] =
inConfig(Debian)(
Seq(
// add automatic service start/stop
Expand All @@ -107,7 +107,7 @@ object SystemloaderPlugin extends AutoPlugin {
)
)

def rpmSettings: Seq[Setting[_]] =
def rpmSettings: Seq[Setting[?]] =
inConfig(Rpm)(
Seq(
// add automatic service start/stop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ object UpstartPlugin extends AutoPlugin {

override def requires = SystemloaderPlugin

override def projectSettings: Seq[Setting[_]] =
override def projectSettings: Seq[Setting[?]] =
inConfig(Debian)(upstartSettings) ++ inConfig(Rpm)(upstartSettings)

def upstartSettings: Seq[Setting[_]] =
def upstartSettings: Seq[Setting[?]] =
Seq(
// used by other archetypes to define systemloader dependent behaviour
serverLoading := Some(ServerLoader.Upstart),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ trait DebianNativePackaging extends DebianPluginLike {
/**
* Using the native installed dpkg-build tools to build the debian package.
*/
private[debian] def debianNativeSettings: Seq[Setting[_]] =
private[debian] def debianNativeSettings: Seq[Setting[?]] =
inConfig(Debian)(
Seq(
debianNativeBuildOptions += "-Znone", // packages are largely JARs, which are already compressed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ object DebianPlugin extends AutoPlugin with DebianNativePackaging {
/**
* Enables native packaging by default
*/
override lazy val projectSettings: Seq[Setting[_]] = settings ++ debianSettings ++ debianNativeSettings
override lazy val projectSettings: Seq[Setting[?]] = settings ++ debianSettings ++ debianNativeSettings

/**
* the default debian settings for the debian namespaced settings
Expand Down Expand Up @@ -170,7 +170,7 @@ object DebianPlugin extends AutoPlugin with DebianNativePackaging {
* ==Debian scoped settings==
* Everything used inside the debian scope
*/
private def debianSettings: Seq[Setting[_]] =
private def debianSettings: Seq[Setting[?]] =
inConfig(Debian)(
Seq(
packageArchitecture := "all",
Expand Down Expand Up @@ -479,7 +479,7 @@ object DebianDeployPlugin extends AutoPlugin {

override def requires = DebianPlugin

override def projectSettings: Seq[Setting[_]] =
override def projectSettings: Seq[Setting[?]] =
SettingsHelper.makeDeploymentSettings(Debian, Debian / packageBin, "deb") ++
SettingsHelper.addPackage(Debian, Debian / genChanges, "changes")
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ object JDebPackaging extends AutoPlugin with DebianPluginLike {

override def requires: Plugins = DebianPlugin

override lazy val projectSettings: Seq[Setting[_]] = inConfig(Debian)(jdebSettings)
override lazy val projectSettings: Seq[Setting[?]] = inConfig(Debian)(jdebSettings)

def jdebSettings =
Seq(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ object DockerPlugin extends AutoPlugin {

// Some of the default values are now provided in the global setting based on
// sbt plugin best practice: https://www.scala-sbt.org/release/docs/Plugins-Best-Practices.html#Provide+default+values+in
override lazy val globalSettings: Seq[Setting[_]] = Seq(
override lazy val globalSettings: Seq[Setting[?]] = Seq(
// See https://github.com/sbt/sbt-native-packager/issues/1187
// Note: Do not make this setting depend on the Docker version.
// Docker version may change depending on the person running the build, or even with something like
Expand All @@ -95,7 +95,7 @@ object DockerPlugin extends AutoPlugin {
dockerCmd := Seq()
)

override lazy val projectSettings: Seq[Setting[_]] = Seq(
override lazy val projectSettings: Seq[Setting[?]] = Seq(
dockerAlias := DockerAlias(
(Docker / dockerRepository).value,
(Docker / dockerUsername).value,
Expand Down Expand Up @@ -552,7 +552,7 @@ object DockerPlugin extends AutoPlugin {
List(daemonUser, "||") :::
List("adduser", "-S") :::
(uidOpt.fold[List[String]](Nil)(List("-u", _))) :::
List("-G", daemonGroup, daemonUser, "))")): _*
List("-G", daemonGroup, daemonUser, "))"))*
)

/**
Expand All @@ -570,7 +570,7 @@ object DockerPlugin extends AutoPlugin {
* ENTRYPOINT command
*/
private final def makeEntrypoint(entrypoint: Seq[String]): CmdLike =
ExecCmd("ENTRYPOINT", entrypoint: _*)
ExecCmd("ENTRYPOINT", entrypoint*)

/**
* Default CMD implementation as default parameters to ENTRYPOINT.
Expand All @@ -579,7 +579,7 @@ object DockerPlugin extends AutoPlugin {
* CMD with args in exec form
*/
private final def makeCmd(args: Seq[String]): CmdLike =
ExecCmd("CMD", args: _*)
ExecCmd("CMD", args*)

/**
* @param exposedPorts
Expand Down Expand Up @@ -614,7 +614,7 @@ object DockerPlugin extends AutoPlugin {
Seq(
ExecCmd("RUN", Seq("mkdir", "-p") ++ exposedVolumes: _*),
makeChown(daemonUser, daemonGroup, exposedVolumes),
ExecCmd("VOLUME", exposedVolumes: _*)
ExecCmd("VOLUME", exposedVolumes*)
)

/**
Expand All @@ -624,7 +624,7 @@ object DockerPlugin extends AutoPlugin {
* String representation of the Dockerfile described by commands
*/
private final def makeDockerContent(commands: Seq[CmdLike]): String =
Dockerfile(commands: _*).makeContent
Dockerfile(commands*).makeContent

/**
* @param commands,
Expand All @@ -645,7 +645,7 @@ object DockerPlugin extends AutoPlugin {
/**
* uses the `Universal / mappings` to generate the `Docker / mappings`.
*/
def mapGenericFilesToDocker: Seq[Setting[_]] = {
def mapGenericFilesToDocker: Seq[Setting[?]] = {
def renameDests(from: Seq[(PluginCompat.FileRef, String)], dest: String) =
for {
(f, path) <- from
Expand Down Expand Up @@ -711,7 +711,7 @@ object DockerPlugin extends AutoPlugin {
log.debug("Working directory " + context.toString)

val logger = if (buildkitEnabled) publishLocalBuildkitLogger(log) else publishLocalLogger(log)
val ret = sys.process.Process(buildCommand, context, envVars.toSeq: _*) ! logger
val ret = sys.process.Process(buildCommand, context, envVars.toSeq*) ! logger

if (!buildkitEnabled && removeIntermediateImages) {
val labelKey = "snp-multi-stage-id"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ object DockerSpotifyClientPlugin extends AutoPlugin {

import DockerPlugin.autoImport._

override lazy val projectSettings: Seq[Setting[_]] = inConfig(Docker)(clientSettings)
override lazy val projectSettings: Seq[Setting[?]] = inConfig(Docker)(clientSettings)

def clientSettings =
Seq(
Expand Down
Loading

0 comments on commit 379b670

Please sign in to comment.