diff --git a/.scalafmt.conf b/.scalafmt.conf
index 11a91203b..9812c0007 100644
--- a/.scalafmt.conf
+++ b/.scalafmt.conf
@@ -1,3 +1,15 @@
+# Version https://scalameta.org/scalafmt/docs/configuration.html#version
+version = 3.8.1
+# Dialect https://scalameta.org/scalafmt/docs/configuration.html#scala-dialects
+runner.dialect = scala212
+
style = IntelliJ
maxColumn = 120
-rewrite.rules = [SortImports, RedundantBraces]
\ No newline at end of file
+rewrite.rules = [SortImports, RedundantBraces]
+docstrings.blankFirstLine = yes
+
+project.excludePaths = [
+ # [error] (Compile / scalafmt) org.scalafmt.sbt.ScalafmtSbtReporter$ScalafmtSbtError: scalafmt:
+ # WixHelper.scala:105: error: Unable to format file due to bug in scalafmt
+ "glob:**/src/main/scala/com/typesafe/sbt/packager/windows/WixHelper.scala"
+]
diff --git a/project/plugins.sbt b/project/plugins.sbt
index aaf85336f..b61f6154a 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -10,7 +10,7 @@ libraryDependencies += "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value
libraryDependencies += "jline" % "jline" % "2.14.6"
// For code formatting
-addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2")
+addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
// binary compatibility checks
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.3")
diff --git a/src/main/scala-sbt-1.0/com/typesafe/sbt/packager/Compat.scala b/src/main/scala-sbt-1.0/com/typesafe/sbt/packager/Compat.scala
index c7b493968..04b741dcb 100644
--- a/src/main/scala-sbt-1.0/com/typesafe/sbt/packager/Compat.scala
+++ b/src/main/scala-sbt-1.0/com/typesafe/sbt/packager/Compat.scala
@@ -1,6 +1,6 @@
package com.typesafe.sbt.packager
-import sbt.{PathFinder, librarymanagement => lm}
+import sbt.{librarymanagement => lm, PathFinder}
import sbt.internal.{librarymanagement => ilm, BuildDependencies => InternalBuildDependencies}
import sbt.util.CacheStore
@@ -14,7 +14,7 @@ object Compat {
/**
* Used in
- * - [[com.typesafe.sbt.packager.archetypes.JavaAppPackaging]]
+ * - [[com.typesafe.sbt.packager.archetypes.JavaAppPackaging]]
*/
type BuildDependencies = InternalBuildDependencies
@@ -24,15 +24,16 @@ object Compat {
/**
* Used in
- * - [[com.typesafe.sbt.packager.docker.DockerPlugin]]
+ * - [[com.typesafe.sbt.packager.docker.DockerPlugin]]
*/
type ProcessLogger = sys.process.ProcessLogger
/**
- * Used in
- * - [[com.typesafe.sbt.packager.Stager]]
+ * Used in
+ * - [[com.typesafe.sbt.packager.Stager]]
* @param file
- * @return a CacheStore
+ * @return
+ * a CacheStore
*/
implicit def fileToCacheStore(file: java.io.File): CacheStore = CacheStore(file)
}
diff --git a/src/main/scala-sbt-1.0/com/typesafe/sbt/packager/MappingsHelper.scala b/src/main/scala-sbt-1.0/com/typesafe/sbt/packager/MappingsHelper.scala
index b245c720b..4e47424be 100644
--- a/src/main/scala-sbt-1.0/com/typesafe/sbt/packager/MappingsHelper.scala
+++ b/src/main/scala-sbt-1.0/com/typesafe/sbt/packager/MappingsHelper.scala
@@ -10,12 +10,13 @@ object MappingsHelper extends Mapper {
* It lightens the build file if one wants to give a string instead of file.
*
* @example
- * {{{
+ * {{{
* mappings in Universal ++= directory("extra")
- * }}}
+ * }}}
*
* @param sourceDir
- * @return mappings
+ * @return
+ * mappings
*/
def directory(sourceDir: String): Seq[(File, String)] =
directory(file(sourceDir))
@@ -24,50 +25,57 @@ object MappingsHelper extends Mapper {
* It lightens the build file if one wants to give a string instead of file.
*
* @example
- * {{{
+ * {{{
* mappings in Universal ++= contentOf("extra")
- * }}}
+ * }}}
*
- * @param sourceDir as string representation
- * @return mappings
+ * @param sourceDir
+ * as string representation
+ * @return
+ * mappings
*/
def contentOf(sourceDir: String): Seq[(File, String)] =
contentOf(file(sourceDir))
/**
- * Create mappings from your classpath. For example if you want to add additional
- * dependencies, like test or model.
+ * Create mappings from your classpath. For example if you want to add additional dependencies, like test or model.
*
- * @example Add all test artifacts to a separated test folder
- * {{{
+ * @example
+ * Add all test artifacts to a separated test folder
+ * {{{
* mappings in Universal ++= fromClasspath((managedClasspath in Test).value, target = "test")
- * }}}
+ * }}}
*
* @param entries
* @param target
- * @return a list of mappings
+ * @return
+ * a list of mappings
*/
def fromClasspath(entries: Seq[Attributed[File]], target: String): Seq[(File, String)] =
fromClasspath(entries, target, _ => true)
/**
- * Create mappings from your classpath. For example if you want to add additional
- * dependencies, like test or model. You can also filter the artifacts that should
- * be mapped to mappings.
+ * Create mappings from your classpath. For example if you want to add additional dependencies, like test or model.
+ * You can also filter the artifacts that should be mapped to mappings.
*
- * @example Filter all osgi bundles
- * {{{
+ * @example
+ * Filter all osgi bundles
+ * {{{
* mappings in Universal ++= fromClasspath(
* (managedClasspath in Runtime).value,
* "osgi",
* artifact => artifact.`type` == "bundle"
* )
- * }}}
+ * }}}
*
- * @param entries from where mappings should be created from
- * @param target folder, e.g. `model`. Must not end with a slash
- * @param includeArtifact function to determine if an artifact should result in a mapping
- * @param includeOnNoArtifact default is false. When there's no Artifact meta data remove it
+ * @param entries
+ * from where mappings should be created from
+ * @param target
+ * folder, e.g. `model`. Must not end with a slash
+ * @param includeArtifact
+ * function to determine if an artifact should result in a mapping
+ * @param includeOnNoArtifact
+ * default is false. When there's no Artifact meta data remove it
*/
def fromClasspath(
entries: Seq[Attributed[File]],
diff --git a/src/main/scala-sbt-1.0/com/typesafe/sbt/packager/SettingsHelper.scala b/src/main/scala-sbt-1.0/com/typesafe/sbt/packager/SettingsHelper.scala
index 370c5b3a2..41ca18ecc 100644
--- a/src/main/scala-sbt-1.0/com/typesafe/sbt/packager/SettingsHelper.scala
+++ b/src/main/scala-sbt-1.0/com/typesafe/sbt/packager/SettingsHelper.scala
@@ -6,9 +6,9 @@ import sbt.librarymanagement.{IvyFileConfiguration, PublishConfiguration}
import com.typesafe.sbt.packager.Compat._
/**
- * TODO write tests for the SettingsHelper
- * TODO document methods properly
- * TODO document the sbt internal stuff that is used
+ * - TODO write tests for the SettingsHelper
+ * - TODO document methods properly
+ * - TODO document the sbt internal stuff that is used
*/
object SettingsHelper {
@@ -78,8 +78,8 @@ object SettingsHelper {
) ++ addPackage(config, packageTask, extension, classifier) ++ addResolver(config)
/**
- * SBT looks in the `otherResolvers` setting for resolvers defined in `publishTo`.
- * If a user scopes a `publishTo`, e.g.
+ * SBT looks in the `otherResolvers` setting for resolvers defined in `publishTo`. If a user scopes a `publishTo`,
+ * e.g.
*
* {{{
* // publish the rpm to the target folder
@@ -88,7 +88,8 @@ object SettingsHelper {
*
* then the resolver must also be present in the `otherResolvers`
*
- * @param config the ivy configuration to look for resolvers
+ * @param config
+ * the ivy configuration to look for resolvers
*/
private def addResolver(config: Configuration): Seq[Setting[_]] =
Seq(otherResolvers ++= (publishTo in config).value.toSeq)
diff --git a/src/main/scala/com/typesafe/sbt/PackagerPlugin.scala b/src/main/scala/com/typesafe/sbt/PackagerPlugin.scala
index 129c9351b..9465504ca 100644
--- a/src/main/scala/com/typesafe/sbt/PackagerPlugin.scala
+++ b/src/main/scala/com/typesafe/sbt/PackagerPlugin.scala
@@ -8,24 +8,20 @@ import sbt._
import sbt.Keys.{name, normalizedName, packageBin, streams}
/**
- * == SBT Native Packager Plugin ==
+ * ==SBT Native Packager Plugin==
*
- * This is the top level plugin for the sbt native packager.
- * You don't have to enable this by yourself, instead we recommend
- * using an archetype for this.
+ * This is the top level plugin for the sbt native packager. You don't have to enable this by yourself, instead we
+ * recommend using an archetype for this.
*
* Currently you can choose between
*
- *
- * - JavaAppPackaging
- * - JavaServerPackaging
- * - AkkaAppPackging
- *
+ * - JavaAppPackaging
+ * - JavaServerPackaging
+ * - AkkaAppPackging
*
- * == Configuration ==
+ * ==Configuration==
*
- * The are a few settings you should set if you want to build package
- * no matter what format.
+ * The are a few settings you should set if you want to build package no matter what format.
*
* {{{
* maintainer := "Your name "
@@ -34,10 +30,11 @@ import sbt.Keys.{name, normalizedName, packageBin, streams}
*
* For all other general settings take a look at [[com.typesafe.sbt.packager.NativePackagerKeys]]
*
- * @example Enable the plugin in the `build.sbt`
- * {{{
+ * @example
+ * Enable the plugin in the `build.sbt`
+ * {{{
* enablePlugins(SbtNativePackager)
- * }}}
+ * }}}
*/
object SbtNativePackager extends AutoPlugin {
@@ -56,16 +53,16 @@ object SbtNativePackager extends AutoPlugin {
/**
* imports all [[com.typesafe.sbt.packager.NativePackagerKeys]] and two objects:
*
- * === NativePackagerKeys ===
+ * ===NativePackagerKeys===
*
- * This inclues ''all'' available keys provided by the sbt-native-packager.
- * Used it if a setting/task key is not in scope.
+ * This inclues ''all'' available keys provided by the sbt-native-packager. Used it if a setting/task key is not in
+ * scope.
*
* {{{
* NativePackagerKeys.notAutomaticallyImported := "cool!"
* }}}
*
- * === NativePackagerHelper ===
+ * ===NativePackagerHelper===
*
* This object contains a set of helper methods for working with mappings.
*/
@@ -106,7 +103,7 @@ object SbtNativePackager extends AutoPlugin {
object packageArchetype {
/**
- * == Recommended usage ==
+ * ==Recommended usage==
*
* {{{
* enablePlugins(JavaAppPackaging)
diff --git a/src/main/scala/com/typesafe/sbt/packager/FileUtil.scala b/src/main/scala/com/typesafe/sbt/packager/FileUtil.scala
index db3b96f68..a9bb89049 100644
--- a/src/main/scala/com/typesafe/sbt/packager/FileUtil.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/FileUtil.scala
@@ -17,7 +17,8 @@ object chmod {
* Using java 7 nio API to set the permissions.
*
* @param file
- * @param perms in octal format
+ * @param perms
+ * in octal format
*/
def apply(file: File, perms: String): Unit = {
val posix = permissions(perms)
@@ -41,14 +42,15 @@ object chmod {
}
/**
- * Converts a octal unix permission representation into
- * a java `PosiFilePermissions` compatible string.
+ * Converts a octal unix permission representation into a java `PosiFilePermissions` compatible string.
*/
object permissions {
/**
- * @param perms in octal format
- * @return java 7 posix file permissions
+ * @param perms
+ * in octal format
+ * @return
+ * java 7 posix file permissions
*/
def apply(perms: String): java.util.Set[PosixFilePermission] =
PosixFilePermissions fromString convert(perms)
@@ -86,10 +88,10 @@ object permissions {
object sourceDateEpoch {
/**
- * If the SOURCE_DATE_EPOCH environment variable is defined, change the mtime of the file (and
- * all children recursively) to the epoch value. This is useful when trying to create
- * reproducible builds since some packaging tools (e.g. tar, gzip) embed last modified times
- * in the package. If the environment variable is not defined, this does nothing.
+ * If the SOURCE_DATE_EPOCH environment variable is defined, change the mtime of the file (and all children
+ * recursively) to the epoch value. This is useful when trying to create reproducible builds since some packaging
+ * tools (e.g. tar, gzip) embed last modified times in the package. If the environment variable is not defined, this
+ * does nothing.
*/
def apply(file: File): Unit =
sys.env.get("SOURCE_DATE_EPOCH").foreach { epoch =>
diff --git a/src/main/scala/com/typesafe/sbt/packager/Hashing.scala b/src/main/scala/com/typesafe/sbt/packager/Hashing.scala
index 2111e6d86..7da92c6f8 100644
--- a/src/main/scala/com/typesafe/sbt/packager/Hashing.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/Hashing.scala
@@ -28,7 +28,7 @@ object Hashing {
}
def convertToHex(data: Array[Byte]): String = {
- //TODO - use java.lang.Integer.toHexString() ?
+ // TODO - use java.lang.Integer.toHexString() ?
val buf = new StringBuffer
def byteToHex(b: Int) =
if ((0 <= b) && (b <= 9)) ('0' + b).toChar
diff --git a/src/main/scala/com/typesafe/sbt/packager/Keys.scala b/src/main/scala/com/typesafe/sbt/packager/Keys.scala
index 23e8e8a43..fa2d150be 100644
--- a/src/main/scala/com/typesafe/sbt/packager/Keys.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/Keys.scala
@@ -23,12 +23,10 @@ trait NativePackagerKeys {
/**
* This Keys object can be used for
- *
- * - non autoplugin builds
- * - import single keys, which are not inside the autoImport
- *
+ * - non autoplugin builds
+ * - import single keys, which are not inside the autoImport
*
- * == Non autoplugin builds ==
+ * ==Non autoplugin builds==
*
* {{{
* import com.typesafe.sbt.packager.Keys._
@@ -36,7 +34,7 @@ trait NativePackagerKeys {
* packageName := ""
* }}}
*
- * == autoplugin builds ==
+ * ==autoplugin builds==
*
* {{{
* NativePackagerKeys.packageName := ""
diff --git a/src/main/scala/com/typesafe/sbt/packager/Stager.scala b/src/main/scala/com/typesafe/sbt/packager/Stager.scala
index 854437c24..525bda5a2 100644
--- a/src/main/scala/com/typesafe/sbt/packager/Stager.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/Stager.scala
@@ -11,19 +11,19 @@ object Stager {
/**
* create a cache and sync files if needed
*
- * @param config - create a configuration specific cache directory
- * @param cacheDirectory - e.g. streams.value.cacheDirectory
- * @param stageDirectory - staging directory
- * @param mappings - staging content
- *
- * @example {{{
- *
- * }}}
+ * @param config
+ * create a configuration specific cache directory
+ * @param cacheDirectory
+ * e.g. streams.value.cacheDirectory
+ * @param stageDirectory
+ * staging directory
+ * @param mappings
+ * staging content
*/
def stageFiles(config: String)(cacheDirectory: File, stageDirectory: File, mappings: Seq[(File, String)]): File = {
val cache = cacheDirectory / ("packager-mappings-" + config)
- val copies = mappings map {
- case (file, path) => file -> (stageDirectory / path)
+ val copies = mappings map { case (file, path) =>
+ file -> (stageDirectory / path)
}
Sync(cache, FileInfo.hash, FileInfo.exists)(copies)
// Now set scripts to executable using Java's lack of understanding of permissions.
@@ -38,7 +38,8 @@ object Stager {
}
/**
- * @see stageFiles
+ * @see
+ * stageFiles
*/
def stage(config: String)(streams: TaskStreams, stageDirectory: File, mappings: Seq[(File, String)]): File =
stageFiles(config)(streams.cacheDirectory, stageDirectory, mappings)
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaAppKeys.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaAppKeys.scala
index f07eab978..22cd57a18 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaAppKeys.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaAppKeys.scala
@@ -3,8 +3,8 @@ package com.typesafe.sbt.packager.archetypes
import sbt._
/**
- * Available settings/tasks for the [[com.typesafe.sbt.packager.archetypes.JavaAppPackaging]]
- * and all depending archetypes.
+ * Available settings/tasks for the [[com.typesafe.sbt.packager.archetypes.JavaAppPackaging]] and all depending
+ * archetypes.
*/
trait JavaAppKeys {
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaAppPackaging.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaAppPackaging.scala
index f512fcde6..0dcb13aea 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaAppPackaging.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaAppPackaging.scala
@@ -10,18 +10,19 @@ import com.typesafe.sbt.packager.linux.LinuxPlugin.autoImport.{defaultLinuxInsta
import com.typesafe.sbt.packager.Compat._
/**
- * == Java Application ==
+ * ==Java Application==
*
- * This class contains the default settings for creating and deploying an archetypical Java application.
- * A Java application archetype is defined as a project that has a main method and is run by placing
- * all of its JAR files on the classpath and calling that main method.
+ * This class contains the default settings for creating and deploying an archetypical Java application. A Java
+ * application archetype is defined as a project that has a main method and is run by placing all of its JAR files on
+ * the classpath and calling that main method.
*
- * == Configuration ==
+ * ==Configuration==
*
- * This plugin adds new settings to configure your packaged application.
- * The keys are defined in [[com.typesafe.sbt.packager.archetypes.JavaAppKeys]]
+ * This plugin adds new settings to configure your packaged application. The keys are defined in
+ * [[com.typesafe.sbt.packager.archetypes.JavaAppKeys]]
*
- * @example Enable this plugin in your `build.sbt` with
+ * @example
+ * Enable this plugin in your `build.sbt` with
*
* {{{
* enablePlugins(JavaAppPackaging)
@@ -166,7 +167,7 @@ object JavaAppPackaging extends AutoPlugin {
else
projectArts.find { art =>
// TODO - Why is the module not showing up for project deps?
- //(art.get(sbt.Keys.moduleID.key) == dep.get(sbt.Keys.moduleID.key)) &&
+ // (art.get(sbt.Keys.moduleID.key) == dep.get(sbt.Keys.moduleID.key)) &&
(art.get(sbt.Keys.artifact.key), dep.get(sbt.Keys.artifact.key)) match {
case (Some(l), Some(r)) =>
// TODO - extra attributes and stuff for comparison?
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaServerApplication.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaServerApplication.scala
index 05411a884..976d3b39d 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaServerApplication.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaServerApplication.scala
@@ -12,11 +12,12 @@ import com.typesafe.sbt.packager.rpm.RpmPlugin.autoImport.RpmConstants
import com.typesafe.sbt.packager.archetypes.systemloader.ServerLoader
/**
- * == Java Server App Packaging ==
+ * ==Java Server App Packaging==
*
* Provides configuration for running an application on a server.
*
- * @see [[http://sbt-native-packager.readthedocs.io/en/latest/archetypes/java_server/index.html]]
+ * @see
+ * [[http://sbt-native-packager.readthedocs.io/en/latest/archetypes/java_server/index.html]]
*/
object JavaServerAppPackaging extends AutoPlugin {
import ServerLoader._
@@ -43,9 +44,9 @@ object JavaServerAppPackaging extends AutoPlugin {
/**
* general settings which apply to all linux server archetypes
*
- * - script replacements
- * - logging directory
- * - config directory
+ * - script replacements
+ * - logging directory
+ * - config directory
*/
def linuxSettings: Seq[Setting[_]] =
Seq(
@@ -107,12 +108,12 @@ object JavaServerAppPackaging extends AutoPlugin {
}
)
) ++ Seq(
- // === Daemon User and Group ===
- daemonUser in Debian := (daemonUser in Linux).value,
- daemonUserUid in Debian := (daemonUserUid in Linux).value,
- daemonGroup in Debian := (daemonGroup in Linux).value,
- daemonGroupGid in Debian := (daemonGroupGid in Linux).value
- )
+ // === Daemon User and Group ===
+ daemonUser in Debian := (daemonUser in Linux).value,
+ daemonUserUid in Debian := (daemonUserUid in Linux).value,
+ daemonGroup in Debian := (daemonGroup in Linux).value,
+ daemonGroupGid in Debian := (daemonGroupGid in Linux).value
+ )
}
def rpmSettings: Seq[Setting[_]] =
@@ -131,18 +132,18 @@ object JavaServerAppPackaging extends AutoPlugin {
}
)
) ++ Seq(
- // === Daemon User and Group ===
- daemonUser in Rpm := (daemonUser in Linux).value,
- daemonUserUid in Rpm := (daemonUserUid in Linux).value,
- daemonGroup in Rpm := (daemonGroup in Linux).value,
- daemonGroupGid in Rpm := (daemonGroupGid in Linux).value,
- // == Maintainer scripts ===
- maintainerScripts in Rpm := rpmScriptletContents(
- rpmScriptsDirectory.value,
- (maintainerScripts in Rpm).value,
- (linuxScriptReplacements in Rpm).value
+ // === Daemon User and Group ===
+ daemonUser in Rpm := (daemonUser in Linux).value,
+ daemonUserUid in Rpm := (daemonUserUid in Linux).value,
+ daemonGroup in Rpm := (daemonGroup in Linux).value,
+ daemonGroupGid in Rpm := (daemonGroupGid in Linux).value,
+ // == Maintainer scripts ===
+ maintainerScripts in Rpm := rpmScriptletContents(
+ rpmScriptsDirectory.value,
+ (maintainerScripts in Rpm).value,
+ (linuxScriptReplacements in Rpm).value
+ )
)
- )
/* ========================================== */
/* ============ Helper Methods ============== */
@@ -188,10 +189,14 @@ object JavaServerAppPackaging extends AutoPlugin {
/**
* Loads an available script from the native-packager source if available.
*
- * @param config for which plugin (Debian, Rpm)
- * @param replacements for the placeholders
- * @param scriptName that should be loaded
- * @return script lines
+ * @param config
+ * for which plugin (Debian, Rpm)
+ * @param replacements
+ * for the placeholders
+ * @param scriptName
+ * that should be loaded
+ * @return
+ * script lines
*/
private[this] def getScriptContent(config: Configuration, replacements: Seq[(String, String)])(
scriptName: String
@@ -199,15 +204,19 @@ object JavaServerAppPackaging extends AutoPlugin {
JavaServerBashScript(scriptName, ARCHETYPE, config, replacements).toSeq
/**
- * Creates the etc-default file, which will contain the basic configuration
- * for an app.
+ * Creates the etc-default file, which will contain the basic configuration for an app.
*
- * @param name of the etc-default config file
- * @param tmpDir to store the resulting file in (e.g. target in Universal)
- * @param source of etc-default script
- * @param replacements for placeholders in etc-default script
+ * @param name
+ * of the etc-default config file
+ * @param tmpDir
+ * to store the resulting file in (e.g. target in Universal)
+ * @param source
+ * of etc-default script
+ * @param replacements
+ * for placeholders in etc-default script
*
- * @return Some(file: File)
+ * @return
+ * Some(file: File)
*/
protected def makeEtcDefaultScript(
name: String,
@@ -233,18 +242,17 @@ object JavaServerAppPackaging extends AutoPlugin {
): Map[String, Seq[String]] = {
import RpmConstants._
val predefined = List(Pre, Post, Preun, Postun)
- val predefinedScripts = predefined.foldLeft(scripts) {
- case (scripts, script) =>
- val userDefined = Option(scriptDirectory / script) collect {
- case file if file.exists && file.isFile => file.toURI.toURL
- }
- // generate content
- val content = JavaServerBashScript(script, ARCHETYPE, Rpm, replacements, userDefined).map { script =>
- TemplateWriter generateScriptFromString (script, replacements)
- }.toSeq
- // add new content
- val newContent = scripts.getOrElse(script, Nil) ++ content.toSeq
- scripts + (script -> newContent)
+ val predefinedScripts = predefined.foldLeft(scripts) { case (scripts, script) =>
+ val userDefined = Option(scriptDirectory / script) collect {
+ case file if file.exists && file.isFile => file.toURI.toURL
+ }
+ // generate content
+ val content = JavaServerBashScript(script, ARCHETYPE, Rpm, replacements, userDefined).map { script =>
+ TemplateWriter generateScriptFromString (script, replacements)
+ }.toSeq
+ // add new content
+ val newContent = scripts.getOrElse(script, Nil) ++ content.toSeq
+ scripts + (script -> newContent)
}
// used to override template
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaServerBashScript.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaServerBashScript.scala
index 9889714ac..e0a9d8126 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaServerBashScript.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaServerBashScript.scala
@@ -5,13 +5,11 @@ import com.typesafe.sbt.packager.archetypes.systemloader.ServerLoader._
/**
* Loads scripts from the resource path that are associated with
- *
- * - an archetype
- * - a sbt.Configuration
- *
+ * - an archetype
+ * - a sbt.Configuration
*
* @example
- * {{{
+ * {{{
* val scriptName: String = "postrm"
* val archetype: String = "java_server"
* val config: Configuration = SbtNativePackager.Debian
@@ -22,17 +20,23 @@ import com.typesafe.sbt.packager.archetypes.systemloader.ServerLoader._
* sys.error(s"Couldn't load [scriptName] for config [{config.name}] in archetype [archetype]")
* }
* IO.write(scriptFile, scriptContent)
- * }}}
- * @see [[com.typesafe.sbt.packager.archetypes.JavaServerAppPackaging]]
+ * }}}
+ * @see
+ * [[com.typesafe.sbt.packager.archetypes.JavaServerAppPackaging]]
*/
object JavaServerBashScript {
/**
- * @param script - script name
- * @param templateName - DebianPlugin.Names for maintainer scripts and "start"
- * @param loader - which startup system
- * @param replacements - default replacements
- * @param template - if specified, it will override the default one
+ * @param script
+ * script name
+ * @param templateName
+ * DebianPlugin.Names for maintainer scripts and "start"
+ * @param loader
+ * which startup system
+ * @param replacements
+ * default replacements
+ * @param template
+ * if specified, it will override the default one
*/
def apply(
script: String,
@@ -70,9 +74,12 @@ object JavaServerLoaderScript {
*
* The functions script resides in "[archetype]/[loader]/functions"
*
- * @param loader - Upstart, SystemV, SystemD
- * @param script - default is "functions"
- * @return functions - addService/stopService with resolved variables
+ * @param loader
+ * Upstart, SystemV, SystemD
+ * @param script
+ * default is "functions"
+ * @return
+ * functions - addService/stopService with resolved variables
*/
def loaderFunctionsReplacement(
loader: ServerLoader,
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/MaintainerScriptHelper.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/MaintainerScriptHelper.scala
index 6319422b9..63d11580f 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/MaintainerScriptHelper.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/MaintainerScriptHelper.scala
@@ -4,26 +4,28 @@ import sbt._
import com.typesafe.sbt.SbtNativePackager.autoImport.maintainerScripts
/**
- * == Maintainer Script Helper ==
+ * ==Maintainer Script Helper==
*
* Provides utility methods to configure package maintainerScripts.
*/
trait MaintainerScriptHelper {
/**
- * Use this method to override preexisting configurations with custom file
- * definitions.
+ * Use this method to override preexisting configurations with custom file definitions.
*
- * @example {{{
+ * @example
+ * {{{
* import DebianConstants._
* maintainerScripts in Debian := maintainerScriptsFromDirectory(
- * sourceDirectory.value / DebianSource / DebianMaintainerScripts,
- * Seq(Preinst, Postinst, Prerm, Postrm)
+ * sourceDirectory.value / DebianSource / DebianMaintainerScripts, Seq(Preinst, Postinst, Prerm, Postrm)
* )
- * }}}
- * @param dir from where to load files
- * @param scripts - a list of script names that should be used
- * @return filename to content mapping
+ * }}}
+ * @param dir
+ * from where to load files
+ * @param scripts
+ * a list of script names that should be used
+ * @return
+ * filename to content mapping
*/
def maintainerScriptsFromDirectory(dir: File, scripts: Seq[String]): Map[String, Seq[String]] =
scripts
@@ -37,17 +39,19 @@ trait MaintainerScriptHelper {
/**
* Use this method to append additional script content to specific maintainer scripts.
*
- * @example Adding content from a string
- * {{{
+ * @example
+ * Adding content from a string
+ * {{{
* import RpmConstants._
* maintainerScripts in Rpm := maintainerScriptsAppend((maintainerScripts in Rpm).value)(
* Pretrans -> "echo 'hello, world'",
* Post -> "echo 'installing " + (packageName in Rpm).value + "'"
* )
- * }}}
+ * }}}
*
- * @example Adding content from a string and use script replacements
- * {{{
+ * @example
+ * Adding content from a string and use script replacements
+ * {{{
* import DebianConstants._
* maintainerScripts in Rpm := maintainerScriptsAppend(
* (maintainerScripts in Debian).value,
@@ -56,41 +60,50 @@ trait MaintainerScriptHelper {
* Preinst -> "echo 'hello, world'",
* Postinst -> s"echo 'installing ${(packageName in Debian).value}'"
* )
- * }}}
+ * }}}
*
- * @param current maintainer scripts
- * @param replacements (e.g. (linuxScriptReplacements in Debian).value)
- * @param scripts scriptName -> scriptContent pairs
- * @return maintainerScripts with appended `scripts`
- * @see [[maintainerScriptsAppendFromFile]]
+ * @param current
+ * maintainer scripts
+ * @param replacements
+ * (e.g. (linuxScriptReplacements in Debian).value)
+ * @param scripts
+ * scriptName -> scriptContent pairs
+ * @return
+ * maintainerScripts with appended `scripts`
+ * @see
+ * [[maintainerScriptsAppendFromFile]]
*/
def maintainerScriptsAppend(current: Map[String, Seq[String]] = Map.empty, replacements: Seq[(String, String)] = Nil)(
scripts: (String, String)*
): Map[String, Seq[String]] = {
- val appended = scripts.map {
- case (key, script) =>
- key -> TemplateWriter.generateScriptFromLines((current.getOrElse(key, Seq.empty) :+ script), replacements)
+ val appended = scripts.map { case (key, script) =>
+ key -> TemplateWriter.generateScriptFromLines((current.getOrElse(key, Seq.empty) :+ script), replacements)
}.toMap
current ++ appended
}
/**
- * Use this method to append additional script content to specific maintainer scripts.
- * Note that you won't have any scriptReplacements available.
+ * Use this method to append additional script content to specific maintainer scripts. Note that you won't have any
+ * scriptReplacements available.
*
- * @example Adding content from a string
- * {{{
+ * @example
+ * Adding content from a string
+ * {{{
* import RpmConstants._
* maintainerScripts in Rpm := maintainerScriptsAppendFromFile((maintainerScripts in Rpm).value)(
* Pretrans -> (sourceDirectory.value / "rpm" / "pretrans"),
* Post -> (sourceDirectory.value / "rpm" / "posttrans")
* )
- * }}}
+ * }}}
*
- * @param current maintainer scripts
- * @param scripts scriptName -> scriptFile pairs
- * @return maintainerScripts with appended `scripts`
- * @see [[maintainerScriptsAppend]] for pure strings where you can insert arbitrary settings and tasks values
+ * @param current
+ * maintainer scripts
+ * @param scripts
+ * scriptName -> scriptFile pairs
+ * @return
+ * maintainerScripts with appended `scripts`
+ * @see
+ * [[maintainerScriptsAppend]] for pure strings where you can insert arbitrary settings and tasks values
*/
def maintainerScriptsAppendFromFile(
current: Map[String, Seq[String]] = Map.empty
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/TemplateWriter.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/TemplateWriter.scala
index 2a5540612..6a05541af 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/TemplateWriter.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/TemplateWriter.scala
@@ -3,24 +3,24 @@ package com.typesafe.sbt.packager.archetypes
/**
* This object provides methods to generate scripts from templates. This involves
*
- *
- * - procesing - replacing a placeholders with actual values
- * - TODO: validating - check the script if there are no remaining placeholders
- *
+ * 1. procesing - replacing a placeholders with actual values
+ * 1. TODO: validating - check the script if there are no remaining placeholders
*
- * @example a bash script can be generated like this
- * {{{
+ * @example
+ * a bash script can be generated like this
+ * {{{
* val template = getClass getResource "template-your-bashscript"
* val replacements = Seq("name" -> "your-app", "custom" -> "1")
* TemplateWriter.generateScript(template, replacements)
- * }}}
+ * }}}
*
- * @example a bat script can be generated like this
- * {{{
+ * @example
+ * a bat script can be generated like this
+ * {{{
* val template = getClass getResource "template-your-batscript"
* val replacements = Seq("name" -> "your-app", "custom" -> "1")
* TemplateWriter.generateScript(template, replacements, "\r\n", TemplateWriter.batFriendlyKeySurround)
- * }}}
+ * }}}
*
* TODO move out of archetypes package
*/
@@ -34,9 +34,8 @@ object TemplateWriter {
"@@" + key + "@@"
private def replace(line: String, replacements: Seq[(String, String)], keySurround: String => String): String =
- replacements.foldLeft(line) {
- case (line, (key, value)) =>
- keySurround(key).r.replaceAllIn(line, java.util.regex.Matcher.quoteReplacement(value))
+ replacements.foldLeft(line) { case (line, (key, value)) =>
+ keySurround(key).r.replaceAllIn(line, java.util.regex.Matcher.quoteReplacement(value))
}
private def replaceValues(
@@ -83,8 +82,10 @@ object TemplateWriter {
/**
* @param lines
* @param replacements
- * @param keySurround defaults to bashFriendlyKeySurround
- * @param charset defaults to UTF-8
+ * @param keySurround
+ * defaults to bashFriendlyKeySurround
+ * @param charset
+ * defaults to UTF-8
*/
def generateScriptFromLines(
lines: Seq[String],
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/jlink/JlinkPlugin.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/jlink/JlinkPlugin.scala
index 9ec5837a2..5efedd9ae 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/jlink/JlinkPlugin.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/jlink/JlinkPlugin.scala
@@ -14,16 +14,17 @@ import com.typesafe.sbt.packager.universal.UniversalPlugin
import java.io.File
/**
- * == Jlink Application ==
+ * ==Jlink Application==
*
- * This class contains the default settings for creating and deploying an
- * application as a runtime image using the standard `jlink` utility.
+ * This class contains the default settings for creating and deploying an application as a runtime image using the
+ * standard `jlink` utility.
*
- * == Configuration ==
+ * ==Configuration==
*
* This plugin adds new settings to configure your packaged application.
*
- * @example Enable this plugin in your `build.sbt` with
+ * @example
+ * Enable this plugin in your `build.sbt` with
*
* {{{
* enablePlugins(JlinkPlugin)
@@ -67,8 +68,8 @@ object JlinkPlugin extends AutoPlugin {
val releaseFile = javaHome0 / "release"
val javaVersion = IO
.readLines(releaseFile)
- .collectFirst {
- case javaVersionPattern(feature) => feature
+ .collectFirst { case javaVersionPattern(feature) =>
+ feature
}
.getOrElse(sys.error("JAVA_VERSION not found in ${releaseFile.getAbsolutePath}"))
@@ -96,9 +97,8 @@ object JlinkPlugin extends AutoPlugin {
log.error(
"Dependee packages not found in classpath. You can use jlinkIgnoreMissingDependency to silence these."
)
- missingDeps.foreach {
- case (a, b) =>
- log.error(s" $a -> $b")
+ missingDeps.foreach { case (a, b) =>
+ log.error(s" $a -> $b")
}
sys.error("Missing package dependencies")
}
@@ -168,8 +168,8 @@ object JlinkPlugin extends AutoPlugin {
// make sure the prefix has a terminating slash
val prefix0 = if (prefix.isEmpty) prefix else prefix + "/"
- findFiles(jlinkBuildImage.value).map {
- case (file, string) => (file, prefix0 + string)
+ findFiles(jlinkBuildImage.value).map { case (file, string) =>
+ (file, prefix0 + string)
}
},
Universal / mappings ++= (jlinkBuildImage / mappings).value
@@ -338,16 +338,14 @@ object JlinkPlugin extends AutoPlugin {
val everything: ((String, String)) => Boolean = Function.const(true)
def only(dependencies: (String, String)*): ((String, String)) => Boolean = dependencies.toSet.contains
- /** This matches pairs by their respective ''package'' prefixes. This means that `"foo.bar"`
- * matches `"foo.bar"`, `"foo.bar.baz"`, but not `"foo.barqux"`. Empty
- * string matches anything.
+ /**
+ * This matches pairs by their respective ''package'' prefixes. This means that `"foo.bar"` matches `"foo.bar"`,
+ * `"foo.bar.baz"`, but not `"foo.barqux"`. Empty string matches anything.
*/
- def byPackagePrefix(prefixPairs: (String, String)*): ((String, String)) => Boolean = {
- case (a, b) =>
- prefixPairs.exists {
- case (prefixA, prefixB) =>
- packagePrefixMatches(prefixA, a) && packagePrefixMatches(prefixB, b)
- }
+ def byPackagePrefix(prefixPairs: (String, String)*): ((String, String)) => Boolean = { case (a, b) =>
+ prefixPairs.exists { case (prefixA, prefixB) =>
+ packagePrefixMatches(prefixA, a) && packagePrefixMatches(prefixB, b)
+ }
}
private def packagePrefixMatches(prefix: String, s: String): Boolean =
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/ApplicationIniGenerator.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/ApplicationIniGenerator.scala
index 8bb7f1a44..04b57d8f3 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/ApplicationIniGenerator.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/ApplicationIniGenerator.scala
@@ -7,8 +7,8 @@ import sbt._
trait ApplicationIniGenerator {
/**
- * @return the existing mappings plus a generated application.ini
- * if custom javaOptions are specified
+ * @return
+ * the existing mappings plus a generated application.ini if custom javaOptions are specified
*/
def generateApplicationIni(
universalMappings: Seq[(File, String)],
@@ -22,7 +22,7 @@ trait ApplicationIniGenerator {
case location if javaOptions.nonEmpty =>
val configFile = tmpDir / "tmp" / "conf" / "application.ini"
val pathMapping = cleanApplicationIniPath(location)
- //Do not use writeLines here because of issue #637
+ // Do not use writeLines here because of issue #637
IO.write(configFile, ("# options from build" +: javaOptions).mkString("\n"))
val filteredMappings = universalMappings.filter {
case (`configFile`, `pathMapping`) =>
@@ -48,8 +48,10 @@ trait ApplicationIniGenerator {
.getOrElse(universalMappings)
/**
- * @param path that could be relative to app_home
- * @return path relative to app_home
+ * @param path
+ * that could be relative to app_home
+ * @return
+ * path relative to app_home
*/
protected def cleanApplicationIniPath(path: String): String
}
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/AshScriptPlugin.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/AshScriptPlugin.scala
index 72577af25..209bcfac0 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/AshScriptPlugin.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/AshScriptPlugin.scala
@@ -7,18 +7,18 @@ import com.typesafe.sbt.packager.archetypes.JavaAppPackaging
import sbt.Keys.sourceDirectory
import sbt._
+// format: off
/**
- * == Java Application ==
+ * ==Java Application==
*
- * This class is an alternate to JavaAppPackaging designed to support the ash shell. JavaAppPackaging
- * generates bash-specific code that is not compatible with ash, a very stripped-down, lightweight shell
- * used by popular micro base Docker images like BusyBox. The AshScriptPlugin will generate simple
- * ash-compatible output.
+ * This class is an alternate to JavaAppPackaging designed to support the ash shell. JavaAppPackaging generates
+ * bash-specific code that is not compatible with ash, a very stripped-down, lightweight shell used by popular micro
+ * base Docker images like BusyBox. The AshScriptPlugin will generate simple ash-compatible output.
*
- * Just like with JavaAppPackaging you can override the bash-template file by creating a src/templates
- * directory and adding your own bash-template file. Actually this isn't a bad idea as the default
- * bash-template file inherited from JavaAppPackaging has a lot of stuff you probably don't want/need
- * in a highly-constrained environment like ash+BusyBox. Something much simpler will do, for example:
+ * Just like with JavaAppPackaging you can override the bash-template file by creating a src/templates directory and
+ * adding your own bash-template file. Actually this isn't a bad idea as the default bash-template file inherited from
+ * JavaAppPackaging has a lot of stuff you probably don't want/need in a highly-constrained environment like
+ * ash+BusyBox. Something much simpler will do, for example:
*
* #!/usr/bin/env sh
*
@@ -57,17 +57,19 @@ import sbt._
*
* java -classpath $app_classpath $app_mainclass $@
*
- * == Configuration ==
+ * ==Configuration==
*
- * This plugin adds new settings to configure your packaged application.
- * The keys are defined in [[com.typesafe.sbt.packager.archetypes.JavaAppKeys]]
+ * This plugin adds new settings to configure your packaged application. The keys are defined in
+ * [[com.typesafe.sbt.packager.archetypes.JavaAppKeys]]
*
- * @example Enable this plugin in your `build.sbt` with
+ * @example
+ * Enable this plugin in your `build.sbt` with
*
* {{{
* enablePlugins(AshScriptPlugin)
* }}}
*/
+// format: on
object AshScriptPlugin extends AutoPlugin {
override def requires = JavaAppPackaging && BashStartScriptPlugin
@@ -97,9 +99,10 @@ object AshScriptPlugin extends AutoPlugin {
/**
* Creates the block of defines for a script.
*
- * @param appClasspath A sequence of relative-locations (to the lib/ folder) of jars
- * to include on the classpath.
- * @param configFile An (optional) filename from which the script will read arguments.
+ * @param appClasspath
+ * A sequence of relative-locations (to the lib/ folder) of jars to include on the classpath.
+ * @param configFile
+ * An (optional) filename from which the script will read arguments.
*/
def apply(appClasspath: Seq[String], configFile: Option[String], bundledJvm: Option[String]): Seq[String] =
(configFile map configFileDefine).toSeq ++
@@ -107,10 +110,9 @@ object AshScriptPlugin extends AutoPlugin {
(bundledJvm map bundledJvmDefine).toSeq
private[this] def makeClasspathDefine(cp: Seq[String]): String = {
- val fullString = cp map (
- n =>
- if (n.startsWith("/")) n
- else "$lib_dir/" + n
+ val fullString = cp map (n =>
+ if (n.startsWith("/")) n
+ else "$lib_dir/" + n
) mkString ":"
"app_classpath=\"" + fullString + "\"\n"
}
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BashStartScriptKeys.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BashStartScriptKeys.scala
index e4b86620f..7f80c28f7 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BashStartScriptKeys.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BashStartScriptKeys.scala
@@ -5,7 +5,8 @@ import sbt._
/**
* Keys related to the [[BashStartScriptPlugin]]
*
- * @see [[BashStartScriptPlugin]]
+ * @see
+ * [[BashStartScriptPlugin]]
*/
trait BashStartScriptKeys {
val makeBashScripts = TaskKey[Seq[(File, String)]]("makeBashScripts", "Creates start scripts for this project.")
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BashStartScriptPlugin.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BashStartScriptPlugin.scala
index b54c8eb29..20cb093b9 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BashStartScriptPlugin.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BashStartScriptPlugin.scala
@@ -9,7 +9,7 @@ import sbt.Keys._
import sbt._
/**
- * == Bash StartScript Plugin ==
+ * ==Bash StartScript Plugin==
*
* This plugins creates a start bash script to run an application built with the
* [[com.typesafe.sbt.packager.archetypes.JavaAppPackaging]].
@@ -95,8 +95,10 @@ object BashStartScriptPlugin extends AutoPlugin with ApplicationIniGenerator wit
}
/**
- * @param path that could be relative to app_home
- * @return path relative to app_home
+ * @param path
+ * that could be relative to app_home
+ * @return
+ * path relative to app_home
*/
protected def cleanApplicationIniPath(path: String): String = path.stripPrefix("${app_home}/../")
@@ -112,9 +114,10 @@ object BashStartScriptPlugin extends AutoPlugin with ApplicationIniGenerator wit
/**
* Creates the block of defines for a script.
*
- * @param appClasspath A sequence of relative-locations (to the lib/ folder) of jars
- * to include on the classpath.
- * @param configFile An (optional) filename from which the script will read arguments.
+ * @param appClasspath
+ * A sequence of relative-locations (to the lib/ folder) of jars to include on the classpath.
+ * @param configFile
+ * An (optional) filename from which the script will read arguments.
*/
def apply(appClasspath: Seq[String], configFile: Option[String], bundledJvm: Option[String]): Seq[String] =
(configFile map configFileDefine).toSeq ++
@@ -122,10 +125,9 @@ object BashStartScriptPlugin extends AutoPlugin with ApplicationIniGenerator wit
(bundledJvm map bundledJvmDefine).toSeq
private[this] def makeClasspathDefine(cp: Seq[String]): String = {
- val fullString = cp map (
- n =>
- if (n.startsWith("/")) n
- else "$lib_dir/" + n
+ val fullString = cp map (n =>
+ if (n.startsWith("/")) n
+ else "$lib_dir/" + n
) mkString ":"
"declare -r app_classpath=\"" + fullString + "\"\n"
}
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BatStartScriptKeys.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BatStartScriptKeys.scala
index 8e88c4bde..267b7cd1f 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BatStartScriptKeys.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BatStartScriptKeys.scala
@@ -5,7 +5,8 @@ import sbt._
/**
* Keys related to the [[BatStartScriptPlugin]]
*
- * @see [[BatStartScriptPlugin]]
+ * @see
+ * [[BatStartScriptPlugin]]
*/
trait BatStartScriptKeys {
val makeBatScripts = TaskKey[Seq[(File, String)]]("makeBatScripts", "Creates start scripts for this project.")
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BatStartScriptPlugin.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BatStartScriptPlugin.scala
index 7414cc7e9..a76bc5946 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BatStartScriptPlugin.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/BatStartScriptPlugin.scala
@@ -10,7 +10,7 @@ import sbt.Keys._
import sbt._
/**
- * == Bat StartScript Plugin ==
+ * ==Bat StartScript Plugin==
*
* This plugins creates a start bat script to run an application built with the
* [[com.typesafe.sbt.packager.archetypes.JavaAppPackaging]].
@@ -147,8 +147,10 @@ object BatStartScriptPlugin extends AutoPlugin with ApplicationIniGenerator with
)
/**
- * @param path that could be relative to APP_HOME
- * @return path relative to APP_HOME
+ * @param path
+ * that could be relative to APP_HOME
+ * @return
+ * path relative to APP_HOME
*/
protected def cleanApplicationIniPath(path: String): String =
path.stripPrefix("%APP_HOME%\\").stripPrefix("/").replace('\\', '/')
@@ -202,8 +204,8 @@ object BatStartScriptPlugin extends AutoPlugin with ApplicationIniGenerator with
// TODO - use more of the template writer for this...
private[this] def replace(line: String, replacements: Seq[(String, String)]): String =
- replacements.foldLeft(line) {
- case (in, (key, value)) => in.replaceAll("@@" + key + "@@", java.util.regex.Matcher.quoteReplacement(value))
+ replacements.foldLeft(line) { case (in, (key, value)) =>
+ in.replaceAll("@@" + key + "@@", java.util.regex.Matcher.quoteReplacement(value))
}
}
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/CommonStartScriptGenerator.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/CommonStartScriptGenerator.scala
index a62106d41..bb4fb569d 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/CommonStartScriptGenerator.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/CommonStartScriptGenerator.scala
@@ -35,7 +35,8 @@ trait CommonStartScriptGenerator {
/**
* Set executable bit of the generated scripts to this value
- * @todo Does it work when building archives on hosts that do not support such permission?
+ * @todo
+ * Does it work when building archives on hosts that do not support such permission?
*/
protected[this] val executableBitValue: Boolean
@@ -55,9 +56,8 @@ trait CommonStartScriptGenerator {
}
/**
- * The type of specialized ScriptConfig.
- * This enables callback methods of the concrete plugin implementations
- * to use fields of config that only exist in their ScriptConfig specialization.
+ * The type of specialized ScriptConfig. This enables callback methods of the concrete plugin implementations to use
+ * fields of config that only exist in their ScriptConfig specialization.
*/
protected[this] type SpecializedScriptConfig <: ScriptConfig
@@ -91,17 +91,16 @@ trait CommonStartScriptGenerator {
ScriptUtils.warnOnScriptNameCollision(classAndScriptNames, log)
classAndScriptNames
- .find {
- case (_, script) => script == config.executableScriptName
+ .find { case (_, script) =>
+ script == config.executableScriptName
}
.map(_ => classAndScriptNames)
.getOrElse(
classAndScriptNames ++ Seq("" -> config.executableScriptName)
) // empty string to enforce the custom class in scripts
- .map {
- case (qualifiedClassName, scriptName) =>
- val newConfig = config.withScriptName(scriptName)
- createMainScript(qualifiedClassName, newConfig, targetDir, discoveredMainClasses)
+ .map { case (qualifiedClassName, scriptName) =>
+ val newConfig = config.withScriptName(scriptName)
+ createMainScript(qualifiedClassName, newConfig, targetDir, discoveredMainClasses)
}
}
@@ -109,10 +108,14 @@ trait CommonStartScriptGenerator {
config.executableScriptName + scriptSuffix
/**
- * @param mainClass - Main class added to the java command
- * @param config - Config data for this script
- * @param targetDir - Target directory for this script
- * @return File pointing to the created main script
+ * @param mainClass
+ * Main class added to the java command
+ * @param config
+ * Config data for this script
+ * @param targetDir
+ * Target directory for this script
+ * @return
+ * File pointing to the created main script
*/
private[this] def createMainScript(
mainClass: String,
@@ -147,17 +150,16 @@ trait CommonStartScriptGenerator {
val forwarderTemplate = getClass.getResource(forwarderTemplateName)
val classAndScriptNames = ScriptUtils.createScriptNames(discoveredMainClasses)
ScriptUtils.warnOnScriptNameCollision(classAndScriptNames :+ ("" -> mainScriptName(config)), log)
- classAndScriptNames.map {
- case (qualifiedClassName, scriptNameWithoutSuffix) =>
- val scriptName = scriptNameWithoutSuffix + scriptSuffix
- val file = tmp / scriptName
+ classAndScriptNames.map { case (qualifiedClassName, scriptNameWithoutSuffix) =>
+ val scriptName = scriptNameWithoutSuffix + scriptSuffix
+ val file = tmp / scriptName
- val replacements = Seq("startScript" -> executableScriptName, "qualifiedClassName" -> qualifiedClassName)
- val scriptContent = TemplateWriter.generateScript(forwarderTemplate, replacements, eol, keySurround)
+ val replacements = Seq("startScript" -> executableScriptName, "qualifiedClassName" -> qualifiedClassName)
+ val scriptContent = TemplateWriter.generateScript(forwarderTemplate, replacements, eol, keySurround)
- IO.write(file, scriptContent)
- file.setExecutable(executableBitValue)
- file -> s"$scriptTargetFolder/$scriptName"
+ IO.write(file, scriptContent)
+ file.setExecutable(executableBitValue)
+ file -> s"$scriptTargetFolder/$scriptName"
}
}
}
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/ScriptUtils.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/ScriptUtils.scala
index f55f3316d..a137f34e0 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/ScriptUtils.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/ScriptUtils.scala
@@ -12,9 +12,12 @@ object ScriptUtils {
/**
* Generates launcher script names for the specified main class names.
- * @param discoveredMainClasses discovered qualified main class names
- * @return sequence of tuples: (passed in class name) -> (generated script name)
- * @note may introduce name collisions in some corner cases
+ * @param discoveredMainClasses
+ * discovered qualified main class names
+ * @return
+ * sequence of tuples: (passed in class name) -> (generated script name)
+ * @note
+ * may introduce name collisions in some corner cases
*/
def createScriptNames(discoveredMainClasses: Seq[String]): Seq[(String, String)] = {
val mainClasses = discoveredMainClasses.map { fullyQualifiedClassName =>
@@ -22,37 +25,36 @@ object ScriptUtils {
}
val (duplicates, uniques) = mainClasses
.groupBy(_.simpleName)
- .partition {
- case (_, classes) => classes.length > 1
+ .partition { case (_, classes) =>
+ classes.length > 1
}
- val resultsForUniques = uniques.toSeq.map {
- case (_, seqOfOneClass) => seqOfOneClass.head.asSimpleTuple
+ val resultsForUniques = uniques.toSeq.map { case (_, seqOfOneClass) =>
+ seqOfOneClass.head.asSimpleTuple
}
- val resultsForDuplicates = duplicates.toSeq.flatMap {
- case (_, classes) => classes.map(_.asQualifiedTuple)
+ val resultsForDuplicates = duplicates.toSeq.flatMap { case (_, classes) =>
+ classes.map(_.asQualifiedTuple)
}
resultsForUniques ++ resultsForDuplicates
}
def describeDuplicates(classesAndScripts: Seq[(String, String)]): Seq[String] =
classesAndScripts
- .groupBy {
- case (_, scriptName) => scriptName
+ .groupBy { case (_, scriptName) =>
+ scriptName
}
.toSeq
- .filter {
- case (_, classesWithTheSameScriptName) => classesWithTheSameScriptName.length > 1
+ .filter { case (_, classesWithTheSameScriptName) =>
+ classesWithTheSameScriptName.length > 1
}
- .map {
- case (scriptName, duplicates) =>
- val temp = duplicates
- .map {
- case (qualifiedClassName, _) => qualifiedClassName
- }
- .sorted
- .mkString(", ")
- s"$scriptName ($temp)"
+ .map { case (scriptName, duplicates) =>
+ val temp = duplicates
+ .map { case (qualifiedClassName, _) =>
+ qualifiedClassName
+ }
+ .sorted
+ .mkString(", ")
+ s"$scriptName ($temp)"
}
def warnOnScriptNameCollision(classesAndScripts: Seq[(String, String)], log: sbt.Logger): Unit = {
@@ -64,12 +66,14 @@ object ScriptUtils {
}
/**
- * Converts class name to lower case, applying some heuristics
- * to guess the word splitting.
- * @param qualifiedClassName a class name
- * @return lower cased name with '-' between words. Dots ('.') are left as is.
- * @note This function can still introduce name collisions sometimes: for example,
- * both Test1Class and Test1class (note the capitalization) will end up test-1-class.
+ * Converts class name to lower case, applying some heuristics to guess the word splitting.
+ * @param qualifiedClassName
+ * a class name
+ * @return
+ * lower cased name with '-' between words. Dots ('.') are left as is.
+ * @note
+ * This function can still introduce name collisions sometimes: for example, both Test1Class and Test1class (note
+ * the capitalization) will end up test-1-class.
*/
def toLowerCase(qualifiedClassName: String): String = {
// suppose list is not very huge, so no need in tail recursion
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/StartScriptMainClassConfig.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/StartScriptMainClassConfig.scala
index f8cf50202..c09dec9f8 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/StartScriptMainClassConfig.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/scripts/StartScriptMainClassConfig.scala
@@ -13,31 +13,38 @@ case object NoMain extends StartScriptMainClassConfig
/**
* The project has a single defined main class.
*
- * @param mainClass project main entrypoint
+ * @param mainClass
+ * project main entrypoint
*/
case class SingleMain(mainClass: String) extends StartScriptMainClassConfig
/**
* The project has multiple main classes, but no explicit configured main entrypoint.
*
- * @param mainClasses A non-empty list of main classes
+ * @param mainClasses
+ * A non-empty list of main classes
*/
case class MultipleMains(mainClasses: Seq[String]) extends StartScriptMainClassConfig
/**
* The project has multiple main classes and a defined main entrypoint.
*
- * @param mainClass Explicitly defined main class
- * @param additional Other discovered main classes without the explicit main class
+ * @param mainClass
+ * Explicitly defined main class
+ * @param additional
+ * Other discovered main classes without the explicit main class
*/
case class ExplicitMainWithAdditional(mainClass: String, additional: Seq[String]) extends StartScriptMainClassConfig
object StartScriptMainClassConfig {
/**
- * @param mainClass optional main class, e.g. from (mainClass in Compile).value
- * @param discoveredMainClasses all discovered main classes, e.g. from (discoveredMainClasses in Compile).value
- * @return A start script configuration
+ * @param mainClass
+ * optional main class, e.g. from (mainClass in Compile).value
+ * @param discoveredMainClasses
+ * all discovered main classes, e.g. from (discoveredMainClasses in Compile).value
+ * @return
+ * A start script configuration
*/
def from(mainClass: Option[String], discoveredMainClasses: Seq[String]): StartScriptMainClassConfig = {
val additionalMainClasses = discoveredMainClasses.filterNot(mainClass == Some(_))
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/systemloader/ServerLoader.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/systemloader/ServerLoader.scala
index 81b88dbb0..fefba4868 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/systemloader/ServerLoader.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/systemloader/ServerLoader.scala
@@ -3,7 +3,8 @@ package com.typesafe.sbt.packager.archetypes.systemloader
/**
* Stores the available types of server loaders.
*
- * @note not all packaging systems support all server loaders
+ * @note
+ * not all packaging systems support all server loaders
*/
object ServerLoader extends Enumeration {
type ServerLoader = Value
diff --git a/src/main/scala/com/typesafe/sbt/packager/archetypes/systemloader/package.scala b/src/main/scala/com/typesafe/sbt/packager/archetypes/systemloader/package.scala
index 1d04e274e..c29b248e6 100644
--- a/src/main/scala/com/typesafe/sbt/packager/archetypes/systemloader/package.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/archetypes/systemloader/package.scala
@@ -50,10 +50,14 @@ package object systemloader {
/**
* Create the linuxPackageMapping for the systemloader start-script/conffile
- * @param scriptName - optional name from `linuxStartScriptName.value`
- * @param script - file with contents from ` linuxMakeStartScript.value`
- * @param location - target destination from `defaultLinuxStartScriptLocation.value`
- * @param isConf - if the start script should be registered as a config file
+ * @param scriptName
+ * optional name from `linuxStartScriptName.value`
+ * @param script
+ * file with contents from ` linuxMakeStartScript.value`
+ * @param location
+ * target destination from `defaultLinuxStartScriptLocation.value`
+ * @param isConf
+ * if the start script should be registered as a config file
*/
def startScriptMapping(
scriptName: Option[String],
diff --git a/src/main/scala/com/typesafe/sbt/packager/debian/DebianMetadata.scala b/src/main/scala/com/typesafe/sbt/packager/debian/DebianMetadata.scala
index ab02bffe8..00cd5708f 100644
--- a/src/main/scala/com/typesafe/sbt/packager/debian/DebianMetadata.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/debian/DebianMetadata.scala
@@ -61,14 +61,12 @@ case class PackageMetaData(
}
/**
- * This replacements are use for the debian maintainer scripts:
- * preinst, postinst, prerm, postrm
+ * This replacements are use for the debian maintainer scripts: preinst, postinst, prerm, postrm
*/
case class DebianControlScriptReplacements(author: String, descr: String, name: String, version: String) {
/**
- * Generates the replacement sequence for the debian
- * maintainer scripts
+ * Generates the replacement sequence for the debian maintainer scripts
*/
def makeReplacements(): Seq[(String, String)] =
Seq("author" -> author, "descr" -> descr, "name" -> name, "version" -> version)
diff --git a/src/main/scala/com/typesafe/sbt/packager/debian/DebianNativePackaging.scala b/src/main/scala/com/typesafe/sbt/packager/debian/DebianNativePackaging.scala
index 0c54558cd..5eb450fee 100644
--- a/src/main/scala/com/typesafe/sbt/packager/debian/DebianNativePackaging.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/debian/DebianNativePackaging.scala
@@ -8,31 +8,29 @@ import sbt.Keys._
import sbt._
/**
- * == Native Packaging ==
+ * ==Native Packaging==
*
* This provides a dpkg based implementation for debian packaging.
*
- * == Requirements ==
+ * ==Requirements==
*
* You need the debian dpkg toolchain installed. This includes
- *
- * - fakeroot
- * - dpkg-deb
- * - dpkg-genchanges
- *
+ * - fakeroot
+ * - dpkg-deb
+ * - dpkg-genchanges
*
- * @example Enable the plugin in the `build.sbt`
- * {{{
+ * @example
+ * Enable the plugin in the `build.sbt`
+ * {{{
* enablePlugins(DebianNativePackaging)
- * }}}
+ * }}}
*/
trait DebianNativePackaging extends DebianPluginLike {
import DebianPlugin.Names
/**
- * Using the native installed dpkg-build tools to build the debian
- * package.
+ * Using the native installed dpkg-build tools to build the debian package.
*/
private[debian] def debianNativeSettings: Seq[Setting[_]] =
inConfig(Debian)(
diff --git a/src/main/scala/com/typesafe/sbt/packager/debian/DebianPlugin.scala b/src/main/scala/com/typesafe/sbt/packager/debian/DebianPlugin.scala
index f3a327073..2d3d0f6db 100644
--- a/src/main/scala/com/typesafe/sbt/packager/debian/DebianPlugin.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/debian/DebianPlugin.scala
@@ -14,19 +14,20 @@ import sbt._
import scala.util.matching.Regex
/**
- * == Debian Plugin ==
+ * ==Debian Plugin==
*
* This plugin provides the ability to build ''.deb'' packages.
*
- * == Configuration ==
+ * ==Configuration==
*
* In order to configure this plugin take a look at the available [[com.typesafe.sbt.packager.debian.DebianKeys]]
*
- * @example Enable the plugin in the `build.sbt`. By default this will use
- * the native debian packaging implementation [[com.typesafe.sbt.packager.debian.DebianNativePackaging]].
- * {{{
+ * @example
+ * Enable the plugin in the `build.sbt`. By default this will use the native debian packaging implementation
+ * [[com.typesafe.sbt.packager.debian.DebianNativePackaging]].
+ * {{{
* enablePlugins(DebianPlugin)
- * }}}
+ * }}}
*/
object DebianPlugin extends AutoPlugin with DebianNativePackaging {
@@ -44,7 +45,7 @@ object DebianPlugin extends AutoPlugin with DebianNativePackaging {
val DebianSource = "debian"
val DebianMaintainerScripts = "DEBIAN"
- //maintainer script names
+ // maintainer script names
val Postinst = "postinst"
val Postrm = "postrm"
val Prerm = "prerm"
@@ -118,9 +119,8 @@ object DebianPlugin extends AutoPlugin with DebianNativePackaging {
// this is for legacy purposes to keep old behaviour
// --- legacy starts
def readContent(scriptFiles: Seq[(File, String)]): Map[String, Seq[String]] =
- scriptFiles.map {
- case (scriptFile, scriptName) =>
- scriptName -> IO.readLines(scriptFile)
+ scriptFiles.map { case (scriptFile, scriptName) =>
+ scriptName -> IO.readLines(scriptFile)
}.toMap
val userProvided = readContent(
@@ -133,9 +133,8 @@ object DebianPlugin extends AutoPlugin with DebianNativePackaging {
)
// these things get appended. Don't check for nonexisting keys as they are already in the default scripts map
- val appendedScripts = scripts.map {
- case (scriptName, content) =>
- scriptName -> (content ++ userProvided.getOrElse(scriptName, Nil))
+ val appendedScripts = scripts.map { case (scriptName, content) =>
+ scriptName -> (content ++ userProvided.getOrElse(scriptName, Nil))
}
// override and merge with the user defined scripts. Will change in the future
val controlScriptsDir = debianControlScriptsDirectory.value
@@ -166,7 +165,7 @@ object DebianPlugin extends AutoPlugin with DebianNativePackaging {
)
/**
- * == Debian scoped settings ==
+ * ==Debian scoped settings==
* Everything used inside the debian scope
*/
private def debianSettings: Seq[Setting[_]] =
@@ -268,27 +267,25 @@ object DebianPlugin extends AutoPlugin with DebianNativePackaging {
}
private[this] def stageMappings(mappings: Seq[LinuxPackageMapping], targetDir: File) =
- mappings.foreach {
- case LinuxPackageMapping(paths, perms, zipped) =>
- val (dirs, files) = paths.partition(_._1.isDirectory)
- dirs map {
- case (_, dirName) => targetDir / dirName
- } foreach { targetDir =>
- targetDir mkdirs ()
- chmod(targetDir, perms.permissions)
- }
+ mappings.foreach { case LinuxPackageMapping(paths, perms, zipped) =>
+ val (dirs, files) = paths.partition(_._1.isDirectory)
+ dirs map { case (_, dirName) =>
+ targetDir / dirName
+ } foreach { targetDir =>
+ targetDir mkdirs ()
+ chmod(targetDir, perms.permissions)
+ }
- files map {
- case (file, fileName) => (file, targetDir / fileName)
- } foreach {
- case (source, destination) =>
- copyAndFixPerms(source, destination, perms, zipped)
- }
+ files map { case (file, fileName) =>
+ (file, targetDir / fileName)
+ } foreach { case (source, destination) =>
+ copyAndFixPerms(source, destination, perms, zipped)
+ }
}
/**
- * Put the maintainer files in `dir / "DEBIAN"` named as specified.
- * Valid values for the name are preinst,postinst,prerm,postrm
+ * Put the maintainer files in `dir / "DEBIAN"` named as specified. Valid values for the name are
+ * preinst,postinst,prerm,postrm
*
* @param maintainerScripts
* @param targetDir
@@ -307,13 +304,11 @@ object DebianPlugin extends AutoPlugin with DebianNativePackaging {
}
/**
- * == Debian Helper Methods ==
+ * ==Debian Helper Methods==
*
- * This trait provides a set of helper methods for debian packaging
- * implementations.
+ * This trait provides a set of helper methods for debian packaging implementations.
*
- * Most of the methods are for java 6 file permission handling and
- * debian script adjustements.
+ * Most of the methods are for java 6 file permission handling and debian script adjustements.
*/
trait DebianPluginLike {
@@ -325,13 +320,12 @@ trait DebianPluginLike {
replacements: Seq[(String, String)],
tmpDir: File
): Seq[(File, String)] =
- scripts.map {
- case (scriptName, content) =>
- val scriptBits =
- TemplateWriter.generateScriptFromLines(content, replacements)
- val script = tmpDir / "tmp" / "debian" / scriptName
- IO.write(script, scriptBits mkString "\n")
- script -> scriptName
+ scripts.map { case (scriptName, content) =>
+ val scriptBits =
+ TemplateWriter.generateScriptFromLines(content, replacements)
+ val script = tmpDir / "tmp" / "debian" / scriptName
+ IO.write(script, scriptBits mkString "\n")
+ script -> scriptName
}.toList
private[debian] final def defaultMaintainerScript(name: String): Option[List[String]] = {
@@ -416,16 +410,17 @@ trait DebianPluginLike {
}
/**
- * Debian assumes the application chowns the necessary files and directories in the
- * control scripts (Pre/Postinst).
+ * Debian assumes the application chowns the necessary files and directories in the control scripts (Pre/Postinst).
*
- * This method generates a replacement which can be inserted in bash script to chown
- * all files which are not root. While adding the chown commands it checks if the users
- * and groups have valid names.
+ * This method generates a replacement which can be inserted in bash script to chown all files which are not root.
+ * While adding the chown commands it checks if the users and groups have valid names.
*
- * @param mappings - all mapped files
- * @param streams - logging
- * @return (CHOWN_REPLACEMENT -> ".. list of chown commands")
+ * @param mappings
+ * all mapped files
+ * @param streams
+ * logging
+ * @return
+ * (CHOWN_REPLACEMENT -> ".. list of chown commands")
*/
private[debian] def makeChownReplacements(
mappings: Seq[LinuxPackageMapping],
@@ -444,18 +439,16 @@ trait DebianPluginLike {
false
case _ => true
}
- .map {
- case LinuxPackageMapping(paths, meta, _) =>
- (meta.user, meta.group) -> paths
+ .map { case LinuxPackageMapping(paths, meta, _) =>
+ (meta.user, meta.group) -> paths
}
.groupBy(_._1)
- .map {
- case ((user, group), pathList) =>
- validateUserGroupNames(user, streams)
- validateUserGroupNames(group, streams)
- val chown = chownCmd(user, group) _
- // remove key, flatten it and then use mapping path (_.2) to create chown command
- pathList.flatMap(_._2).map(m => chown(m._2))
+ .map { case ((user, group), pathList) =>
+ validateUserGroupNames(user, streams)
+ validateUserGroupNames(group, streams)
+ val chown = chownCmd(user, group) _
+ // remove key, flatten it and then use mapping path (_.2) to create chown command
+ pathList.flatMap(_._2).map(m => chown(m._2))
}
val replacement = header :: chowns.flatten.toList mkString "\n"
DebianPlugin.CHOWN_REPLACEMENT -> replacement
diff --git a/src/main/scala/com/typesafe/sbt/packager/debian/JDebPackaging.scala b/src/main/scala/com/typesafe/sbt/packager/debian/JDebPackaging.scala
index 1bb2f9dda..abf8f9d9f 100644
--- a/src/main/scala/com/typesafe/sbt/packager/debian/JDebPackaging.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/debian/JDebPackaging.scala
@@ -16,17 +16,20 @@ import DebianPlugin.Names
import DebianPlugin.autoImport._
/**
- * == JDeb Plugin ==
- * This provides a java based debian packaging implementation based
- * on the jdeb maven-plugin. To use this, put this into your build.sbt
+ * ==JDeb Plugin==
+ * This provides a java based debian packaging implementation based on the jdeb maven-plugin. To use this, put this
+ * into your build.sbt
*
- * @example Enable the plugin in the `build.sbt`
- * {{{
+ * @example
+ * Enable the plugin in the `build.sbt`
+ * {{{
* enablePlugins(JDebPackaging)
- * }}}
+ * }}}
*
- * @author Nepomuk Seiler
- * @see [[https://github.com/tcurdt/jdeb/blob/master/src/main/java/org/vafer/jdeb/maven/DebMojo.java#L503]]
+ * @author
+ * Nepomuk Seiler
+ * @see
+ * [[https://github.com/tcurdt/jdeb/blob/master/src/main/java/org/vafer/jdeb/maven/DebMojo.java#L503]]
*/
object JDebPackaging extends AutoPlugin with DebianPluginLike {
@@ -52,8 +55,7 @@ object JDebPackaging extends AutoPlugin with DebianPluginLike {
cfile
},
/**
- * Depends on the 'debianExplodedPackage' task as this creates all the files
- * which are defined in the mappings.
+ * Depends on the 'debianExplodedPackage' task as this creates all the files which are defined in the mappings.
*/
packageBin := {
val targetDir = target.value
@@ -88,8 +90,8 @@ object JDebPackaging extends AutoPlugin with DebianPluginLike {
)
/**
- * The same as [[DebianPluginLike.copyAndFixPerms]] except chmod invocation (for windows compatibility).
- * Permissions will be handled by jDeb packager itself.
+ * The same as [[DebianPluginLike.copyAndFixPerms]] except chmod invocation (for windows compatibility). Permissions
+ * will be handled by jDeb packager itself.
*/
private def copyFiles(from: File, to: File, perms: LinuxFileMetaData, zipped: Boolean = false): Unit =
if (zipped)
@@ -116,8 +118,7 @@ object JDebPackaging extends AutoPlugin with DebianPluginLike {
}
/**
- * This provides the task for building a debian packaging with
- * the java-based implementation jdeb
+ * This provides the task for building a debian packaging with the java-based implementation jdeb
*/
class JDebConsole(log: Logger) extends org.vafer.jdeb.Console {
@@ -129,12 +130,12 @@ class JDebConsole(log: Logger) extends org.vafer.jdeb.Console {
}
/**
- * == JDeb Packaging Task ==
+ * ==JDeb Packaging Task==
*
* This private class contains all the jdeb-plugin specific implementations. It's only invoked when the jdeb plugin is
- * enabled and the `debian:packageBin` task is called. This means that all classes in `org.vafer.jdeb._` are only loaded
- * when required and allows us to put the dependency in the "provided" scope. The provided scope means that we have less
- * dependency issues in an sbt build.
+ * enabled and the `debian:packageBin` task is called. This means that all classes in `org.vafer.jdeb._` are only
+ * loaded when required and allows us to put the dependency in the "provided" scope. The provided scope means that we
+ * have less dependency issues in an sbt build.
*/
private class JDebPackagingTask {
import org.vafer.jdeb.{DataProducer, DebMaker}
@@ -165,35 +166,31 @@ private class JDebPackagingTask {
}
/**
- * Creating file and directory producers. These "produce" the
- * files for the debian packaging.
+ * Creating file and directory producers. These "produce" the files for the debian packaging.
*
- * May create duplicates together with the conffileProducers.
- * This will be an performance improvement (reducing IO)
+ * May create duplicates together with the conffileProducers. This will be an performance improvement (reducing IO)
*/
private def fileAndDirectoryProducers(mappings: Seq[LinuxPackageMapping], target: File): Seq[DataProducer] =
- mappings.flatMap {
- case LinuxPackageMapping(paths, perms, zipped) =>
- paths.map {
- // Directories need to be created so jdeb can pick them up
- case (path, name) if path.isDirectory =>
- val permMapper = new PermMapper(-1, -1, perms.user, perms.group, null, perms.permissions, -1, null)
- (target / cleanPath(name)) mkdirs ()
- new DataProducerDirectory(target, Array(cleanPath(name)), null, Array(permMapper))
-
- // Files are just referenced
- case (path, name) =>
- new DataProducerFile(path, cleanPath(name), null, null, Array(filePermissions(perms)))
- }
+ mappings.flatMap { case LinuxPackageMapping(paths, perms, zipped) =>
+ paths.map {
+ // Directories need to be created so jdeb can pick them up
+ case (path, name) if path.isDirectory =>
+ val permMapper = new PermMapper(-1, -1, perms.user, perms.group, null, perms.permissions, -1, null)
+ (target / cleanPath(name)) mkdirs ()
+ new DataProducerDirectory(target, Array(cleanPath(name)), null, Array(permMapper))
+
+ // Files are just referenced
+ case (path, name) =>
+ new DataProducerFile(path, cleanPath(name), null, null, Array(filePermissions(perms)))
+ }
}
/**
* Creating link producers for symlinks.
*/
private[debian] def linkProducers(symlinks: Seq[LinuxSymlink]): Seq[DataProducer] =
- symlinks map {
- case LinuxSymlink(link, destination) =>
- new DataProducerLink(link, destination, true, null, null, null)
+ symlinks map { case LinuxSymlink(link, destination) =>
+ new DataProducerLink(link, destination, true, null, null, null)
}
/**
diff --git a/src/main/scala/com/typesafe/sbt/packager/docker/DockerAlias.scala b/src/main/scala/com/typesafe/sbt/packager/docker/DockerAlias.scala
index ec1b76902..e35c29be7 100644
--- a/src/main/scala/com/typesafe/sbt/packager/docker/DockerAlias.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/docker/DockerAlias.scala
@@ -1,13 +1,17 @@
package com.typesafe.sbt.packager.docker
/**
- * This class represents a Docker alias.
- * It generates a string in the form of {{{[REGISTRY_HOST/][USERNAME/]NAME[:TAG]}}},
- * e.g. ''my-registry.com:1234/my-user/my-service:1.0.0'' or just ''my-service:1.0.0''.
- * @param registryHost Optional hostname of the registry (including port if applicable)
- * @param username Optional username or other qualifier
- * @param name Name of the image, e.g. the artifact name
- * @param tag Optional tag for the image, e.g. the version
+ * This class represents a Docker alias. It generates a string in the form of
+ * {{{[REGISTRY_HOST/][USERNAME/]NAME[:TAG]}}}, e.g. ''my-registry.com:1234/my-user/my-service:1.0.0'' or just
+ * ''my-service:1.0.0''.
+ * @param registryHost
+ * Optional hostname of the registry (including port if applicable)
+ * @param username
+ * Optional username or other qualifier
+ * @param name
+ * Name of the image, e.g. the artifact name
+ * @param tag
+ * Optional tag for the image, e.g. the version
*/
case class DockerAlias(registryHost: Option[String], username: Option[String], name: String, tag: Option[String]) {
diff --git a/src/main/scala/com/typesafe/sbt/packager/docker/DockerApiVersion.scala b/src/main/scala/com/typesafe/sbt/packager/docker/DockerApiVersion.scala
index fbf6b7b6d..8b93c28ec 100644
--- a/src/main/scala/com/typesafe/sbt/packager/docker/DockerApiVersion.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/docker/DockerApiVersion.scala
@@ -8,7 +8,7 @@ object DockerApiVersion {
private val DockerApiVersionPattern: Regex = """^'?([0-9]+)\.([0-9]+)'?$""".r
def parse(version: String): Option[DockerApiVersion] =
- Option(version).collect {
- case DockerApiVersionPattern(major, minor) => new DockerApiVersion(major.toInt, minor.toInt)
+ Option(version).collect { case DockerApiVersionPattern(major, minor) =>
+ new DockerApiVersion(major.toInt, minor.toInt)
}
}
diff --git a/src/main/scala/com/typesafe/sbt/packager/docker/DockerPermissionStrategy.scala b/src/main/scala/com/typesafe/sbt/packager/docker/DockerPermissionStrategy.scala
index 7313baed5..4b102081f 100644
--- a/src/main/scala/com/typesafe/sbt/packager/docker/DockerPermissionStrategy.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/docker/DockerPermissionStrategy.scala
@@ -7,38 +7,33 @@ sealed trait DockerPermissionStrategy
object DockerPermissionStrategy {
/**
- * `None` does not attempt to change the file permissions.
- * This will inherit the host machine's group bits.
+ * `None` does not attempt to change the file permissions. This will inherit the host machine's group bits.
*/
case object None extends DockerPermissionStrategy
/**
- * `Run` calls `RUN` in the `Dockerfile`.
- * This could double the size of the resulting Docker image
- * because of the extra layer it creates.
+ * `Run` calls `RUN` in the `Dockerfile`. This could double the size of the resulting Docker image because of the
+ * extra layer it creates.
*/
case object Run extends DockerPermissionStrategy
/**
- * `MultiStage` uses multi-stage Docker build to change
- * the file permissions.
+ * `MultiStage` uses multi-stage Docker build to change the file permissions.
* https://docs.docker.com/develop/develop-images/multistage-build/
*/
case object MultiStage extends DockerPermissionStrategy
/**
- * `CopyChown` calls `COPY --chown` in the `Dockerfile`.
- * This option is provided for backward compatibility.
- * This will inherit the host machine's file mode.
- * Note that this option is not compatible with OpenShift which ignores
+ * `CopyChown` calls `COPY --chown` in the `Dockerfile`. This option is provided for backward compatibility. This
+ * will inherit the host machine's file mode. Note that this option is not compatible with OpenShift which ignores
* USER command and uses an arbitrary user to run the container.
*/
case object CopyChown extends DockerPermissionStrategy
}
/**
- * This represents a type of file permission changes to run on the working directory.
- * Note that group file mode bits must be effective to be OpenShift compatible.
+ * This represents a type of file permission changes to run on the working directory. Note that group file mode bits
+ * must be effective to be OpenShift compatible.
*/
sealed trait DockerChmodType {
def argument: String
@@ -53,16 +48,15 @@ object DockerChmodType {
}
/**
- * Gives read permission to users and groups.
- * Gives execute permission to users and groups, if +x flag is on for any.
+ * Gives read permission to users and groups. Gives execute permission to users and groups, if +x flag is on for any.
*/
case object UserGroupReadExecute extends DockerChmodType {
def argument: String = "u=rX,g=rX"
}
/**
- * Gives read and write permissions to users and groups.
- * Gives execute permission to users and groups, if +x flag is on for any.
+ * Gives read and write permissions to users and groups. Gives execute permission to users and groups, if +x flag is
+ * on for any.
*/
case object UserGroupWriteExecute extends DockerChmodType {
def argument: String = "u=rwX,g=rwX"
diff --git a/src/main/scala/com/typesafe/sbt/packager/docker/DockerPlugin.scala b/src/main/scala/com/typesafe/sbt/packager/docker/DockerPlugin.scala
index c4159ca46..ed488e975 100644
--- a/src/main/scala/com/typesafe/sbt/packager/docker/DockerPlugin.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/docker/DockerPlugin.scala
@@ -18,33 +18,34 @@ import scala.sys.process.Process
import scala.util.Try
/**
- * == Docker Plugin ==
+ * ==Docker Plugin==
*
* This plugin helps you build docker containers.
*
- * == Configuration ==
+ * ==Configuration==
*
* In order to configure this plugin take a look at the available [[com.typesafe.sbt.packager.docker.DockerKeys]]
*
- * == Requirements ==
+ * ==Requirements==
*
- * You need docker to have docker installed on your system and be able to execute commands.
- * Check with a single command:
+ * You need docker to have docker installed on your system and be able to execute commands. Check with a single
+ * command:
*
* {{{
* docker version
* }}}
*
- * Future versions of the Docker Plugin may use the REST API, so you don't need docker installed
- * locally.
+ * Future versions of the Docker Plugin may use the REST API, so you don't need docker installed locally.
*
- * @note this plugin is not intended to build very customizable docker images, but turn your mappings
- * configuration in a docker image with almost no ''any'' configuration.
+ * @note
+ * this plugin is not intended to build very customizable docker images, but turn your mappings configuration in a
+ * docker image with almost no ''any'' configuration.
*
- * @example Enable the plugin in the `build.sbt`
- * {{{
+ * @example
+ * Enable the plugin in the `build.sbt`
+ * {{{
* enablePlugins(DockerPlugin)
- * }}}
+ * }}}
*/
object DockerPlugin extends AutoPlugin {
@@ -58,8 +59,8 @@ object DockerPlugin extends AutoPlugin {
import autoImport._
/**
- * The separator used by makeCopyLayerIntermediate should be always forced to UNIX separator.
- * The separator doesn't depend on the OS where Dockerfile is being built.
+ * The separator used by makeCopyLayerIntermediate should be always forced to UNIX separator. The separator doesn't
+ * depend on the OS where Dockerfile is being built.
*/
val UnixSeparatorChar = '/'
@@ -207,12 +208,11 @@ object DockerPlugin extends AutoPlugin {
makeWorkdir(dockerBaseDirectory)
) ++
layerIdsAscending.map(l => makeCopyLayerIntermediate(l, dockerBaseDirectory)) ++
- Seq(makeUser("root")) ++ layerIdsAscending.map(
- l => makeChmodRecursive(dockerChmodType.value, Seq(pathInLayer(dockerBaseDirectory, l)))
- ) ++ {
- val layerToPath = (Docker / dockerGroupLayers).value
- addPerms map {
- case (tpe, v) =>
+ Seq(makeUser("root")) ++ layerIdsAscending.map(l =>
+ makeChmodRecursive(dockerChmodType.value, Seq(pathInLayer(dockerBaseDirectory, l)))
+ ) ++ {
+ val layerToPath = (Docker / dockerGroupLayers).value
+ addPerms map { case (tpe, v) =>
// Try and find the source file for the path from the mappings
val layerId = layerMappings
.find(_.path == v)
@@ -223,8 +223,8 @@ object DockerPlugin extends AutoPlugin {
layerToPath.lift((new File("/dev/null"), v))
}
makeChmod(tpe, Seq(pathInLayer(v, layerId)))
- }
- } ++
+ }
+ } ++
Seq(DockerStageBreak)
case _ => Seq()
}
@@ -235,21 +235,21 @@ object DockerPlugin extends AutoPlugin {
case _ => Seq()
}) ++
Seq(makeWorkdir(dockerBaseDirectory)) ++ {
- (strategy match {
- case DockerPermissionStrategy.MultiStage =>
- layerIdsAscending.map { layerId =>
- makeCopyFrom(pathInLayer(dockerBaseDirectory, layerId), dockerBaseDirectory, stage0name, user, group)
- }
- case DockerPermissionStrategy.Run =>
- layerIdsAscending.map(layerId => makeCopyLayerDirect(layerId, dockerBaseDirectory)) ++
- Seq(makeChmodRecursive(dockerChmodType.value, Seq(dockerBaseDirectory))) ++
- (addPerms map { case (tpe, v) => makeChmod(tpe, Seq(v)) })
- case DockerPermissionStrategy.CopyChown =>
- layerIdsAscending.map(layerId => makeCopyChown(layerId, dockerBaseDirectory, user, group))
- case DockerPermissionStrategy.None =>
- layerIdsAscending.map(layerId => makeCopyLayerDirect(layerId, dockerBaseDirectory))
- })
- } ++
+ (strategy match {
+ case DockerPermissionStrategy.MultiStage =>
+ layerIdsAscending.map { layerId =>
+ makeCopyFrom(pathInLayer(dockerBaseDirectory, layerId), dockerBaseDirectory, stage0name, user, group)
+ }
+ case DockerPermissionStrategy.Run =>
+ layerIdsAscending.map(layerId => makeCopyLayerDirect(layerId, dockerBaseDirectory)) ++
+ Seq(makeChmodRecursive(dockerChmodType.value, Seq(dockerBaseDirectory))) ++
+ (addPerms map { case (tpe, v) => makeChmod(tpe, Seq(v)) })
+ case DockerPermissionStrategy.CopyChown =>
+ layerIdsAscending.map(layerId => makeCopyChown(layerId, dockerBaseDirectory, user, group))
+ case DockerPermissionStrategy.None =>
+ layerIdsAscending.map(layerId => makeCopyLayerDirect(layerId, dockerBaseDirectory))
+ })
+ } ++
dockerLabels.value.map(makeLabel) ++
dockerEnvVars.value.map(makeEnvVar) ++
makeExposePorts(dockerExposedPorts.value, dockerExposedUdpPorts.value) ++
@@ -328,8 +328,8 @@ object DockerPlugin extends AutoPlugin {
stage := Stager.stage(Docker.name)(
streams.value,
stagingDirectory.value,
- dockerLayerMappings.value.map {
- case LayeredMapping(layerIdx, file, path) => (file, pathInLayer(path, layerIdx))
+ dockerLayerMappings.value.map { case LayeredMapping(layerIdx, file, path) =>
+ (file, pathInLayer(path, layerIdx))
}
),
stage := (stage dependsOn dockerGenerateConfig).value,
@@ -368,8 +368,10 @@ object DockerPlugin extends AutoPlugin {
})
/**
- * @param maintainer (optional)
- * @return LABEL MAINTAINER if defined
+ * @param maintainer
+ * (optional)
+ * @return
+ * LABEL MAINTAINER if defined
*/
private final def makeMaintainer(maintainer: String): Option[CmdLike] =
if (maintainer.isEmpty) None else Some(makeLabel(Tuple2("MAINTAINER", maintainer)))
@@ -377,14 +379,16 @@ object DockerPlugin extends AutoPlugin {
/**
* @param dockerBaseImage
* @param name
- * @return FROM command
+ * @return
+ * FROM command
*/
private final def makeFromAs(dockerBaseImage: String, name: String): CmdLike =
Cmd("FROM", dockerBaseImage, "as", name)
/**
* @param label
- * @return LABEL command
+ * @return
+ * LABEL command
*/
private final def makeLabel(label: (String, String)): CmdLike = {
val (variable, value) = label
@@ -393,7 +397,8 @@ object DockerPlugin extends AutoPlugin {
/**
* @param envVar
- * @return ENV command
+ * @return
+ * ENV command
*/
private final def makeEnvVar(envVar: (String, String)): CmdLike = {
val (variable, value) = envVar
@@ -401,21 +406,24 @@ object DockerPlugin extends AutoPlugin {
}
/**
- * @param dockerBaseDirectory , the installation directory
+ * @param dockerBaseDirectory
+ * the installation directory
*/
private final def makeWorkdir(dockerBaseDirectory: String): CmdLike =
Cmd("WORKDIR", dockerBaseDirectory)
/**
- * @param dockerBaseDirectory the installation directory
- * @return COPY command copying all files inside the installation directory
+ * @param dockerBaseDirectory
+ * the installation directory
+ * @return
+ * COPY command copying all files inside the installation directory
*/
private final def makeCopyLayerDirect(layerId: Option[Int], dockerBaseDirectory: String): CmdLike = {
/**
- * This is the file path of the file in the Docker image, and does not depend on the OS where the image
- * is being built. This means that it needs to be the Unix file separator even when the image is built
- * on e.g. Windows systems.
+ * This is the file path of the file in the Docker image, and does not depend on the OS where the image is being
+ * built. This means that it needs to be the Unix file separator even when the image is built on e.g. Windows
+ * systems.
*/
val files = dockerBaseDirectory.split(UnixSeparatorChar)(1)
val path = layerId.map(i => s"$i/$files").getOrElse(s"$files")
@@ -429,11 +437,14 @@ object DockerPlugin extends AutoPlugin {
}
/**
- * @param src the installation directory
- * @param stage files are copied from the given build stage
+ * @param src
+ * the installation directory
+ * @param stage
+ * files are copied from the given build stage
* @param daemonUser
* @param daemonGroup
- * @return COPY command copying all files inside the directory from another build stage.
+ * @return
+ * COPY command copying all files inside the directory from another build stage.
*/
private final def makeCopyFrom(
src: String,
@@ -445,10 +456,12 @@ object DockerPlugin extends AutoPlugin {
Cmd("COPY", s"--from=$stage --chown=$daemonUser:$daemonGroup $src $dest")
/**
- * @param layerId the intermediate layer
+ * @param layerId
+ * the intermediate layer
* @param daemonUser
* @param daemonGroup
- * @return COPY command copying all files inside the directory from another build stage.
+ * @return
+ * COPY command copying all files inside the directory from another build stage.
*/
private final def makeCopyChown(
layerId: Option[Int],
@@ -458,9 +471,9 @@ object DockerPlugin extends AutoPlugin {
): CmdLike = {
/**
- * This is the file path of the file in the Docker image, and does not depend on the OS where the image
- * is being built. This means that it needs to be the Unix file separator even when the image is built
- * on e.g. Windows systems.
+ * This is the file path of the file in the Docker image, and does not depend on the OS where the image is being
+ * built. This means that it needs to be the Unix file separator even when the image is built on e.g. Windows
+ * systems.
*/
val files = dockerBaseDirectory.split(UnixSeparatorChar)(1)
val path = layerId.map(i => s"$i/$files").getOrElse(s"$files")
@@ -470,19 +483,22 @@ object DockerPlugin extends AutoPlugin {
/**
* @param daemonUser
* @param daemonGroup
- * @return chown command, owning the installation directory with the daemonuser
+ * @return
+ * chown command, owning the installation directory with the daemonuser
*/
private final def makeChown(daemonUser: String, daemonGroup: String, directories: Seq[String]): CmdLike =
ExecCmd("RUN", Seq("chown", "-R", s"$daemonUser:$daemonGroup") ++ directories: _*)
/**
- * @return chmod command
+ * @return
+ * chmod command
*/
private final def makeChmod(chmodType: DockerChmodType, files: Seq[String]): CmdLike =
ExecCmd("RUN", Seq("chmod", chmodType.argument) ++ files: _*)
/**
- * @return chmod command recursively
+ * @return
+ * chmod command recursively
*/
private final def makeChmodRecursive(chmodType: DockerChmodType, directories: Seq[String]): CmdLike =
ExecCmd("RUN", Seq("chmod", "-R", chmodType.argument) ++ directories: _*)
@@ -492,8 +508,9 @@ object DockerPlugin extends AutoPlugin {
* @param daemonGroup
* @param uidOpt
* @param gidOpt
- * @return useradd to create the daemon user with the given uidOpt and gidOpt after invoking groupadd to
- * create the daemon group if the given gidOpt does not exists.
+ * @return
+ * useradd to create the daemon user with the given uidOpt and gidOpt after invoking groupadd to create the daemon
+ * group if the given gidOpt does not exists.
*/
private final def makeUserAdd(
daemonUser: String,
@@ -504,12 +521,11 @@ object DockerPlugin extends AutoPlugin {
Cmd(
"RUN",
(List("id", "-u", daemonUser, "1>/dev/null", "2>&1", "||") :::
- (gidOpt.fold[List[String]](Nil)(
- gid =>
- List("((", "getent", "group", gid, "1>/dev/null", "2>&1", "||") :::
- List("(", "type", "groupadd", "1>/dev/null", "2>&1", "&&") :::
- List("groupadd", "-g", gid, daemonGroup, "||") :::
- List("addgroup", "-g", gid, "-S", daemonGroup, "))", "&&")
+ (gidOpt.fold[List[String]](Nil)(gid =>
+ List("((", "getent", "group", gid, "1>/dev/null", "2>&1", "||") :::
+ List("(", "type", "groupadd", "1>/dev/null", "2>&1", "&&") :::
+ List("groupadd", "-g", gid, daemonGroup, "||") :::
+ List("addgroup", "-g", gid, "-S", daemonGroup, "))", "&&")
)) :::
List("(", "type", "useradd", "1>/dev/null", "2>&1", "&&") :::
List("useradd", "--system", "--create-home") :::
@@ -524,14 +540,16 @@ object DockerPlugin extends AutoPlugin {
/**
* @param daemonUser
* @param daemonGroupOpt
- * @return USER docker command
+ * @return
+ * USER docker command
*/
private final def makeUser(daemonUser: String, daemonGroupOpt: Option[String] = None): CmdLike =
Cmd("USER", daemonGroupOpt.fold(daemonUser)(daemonUser + ":" + _))
/**
* @param entrypoint
- * @return ENTRYPOINT command
+ * @return
+ * ENTRYPOINT command
*/
private final def makeEntrypoint(entrypoint: Seq[String]): CmdLike =
ExecCmd("ENTRYPOINT", entrypoint: _*)
@@ -539,14 +557,16 @@ object DockerPlugin extends AutoPlugin {
/**
* Default CMD implementation as default parameters to ENTRYPOINT.
* @param args
- * @return CMD with args in exec form
+ * @return
+ * CMD with args in exec form
*/
private final def makeCmd(args: Seq[String]): CmdLike =
ExecCmd("CMD", args: _*)
/**
* @param exposedPorts
- * @return if ports are exposed the EXPOSE command
+ * @return
+ * if ports are exposed the EXPOSE command
*/
private final def makeExposePorts(exposedPorts: Seq[Int], exposedUdpPorts: Seq[Int]): Option[CmdLike] =
if (exposedPorts.isEmpty && exposedUdpPorts.isEmpty) None
@@ -556,18 +576,19 @@ object DockerPlugin extends AutoPlugin {
)
/**
- * If the exposed volume does not exist, the volume is made available
- * with root ownership. This may be too strict for some directories,
- * and we lose the feature that all directories below the install path
- * can be written to by the binary. Therefore the directories are
- * created before the ownership is changed.
+ * If the exposed volume does not exist, the volume is made available with root ownership. This may be too strict for
+ * some directories, and we lose the feature that all directories below the install path can be written to by the
+ * binary. Therefore the directories are created before the ownership is changed.
*
* All directories created afterwards are chowned.
*
* @param exposedVolumes
- * @return commands to create, chown and declare volumes
- * @see http://stackoverflow.com/questions/23544282/what-is-the-best-way-to-manage-permissions-for-docker-shared-volumes
- * @see https://docs.docker.com/userguide/dockervolumes/
+ * @return
+ * commands to create, chown and declare volumes
+ * @see
+ * http://stackoverflow.com/questions/23544282/what-is-the-best-way-to-manage-permissions-for-docker-shared-volumes
+ * @see
+ * https://docs.docker.com/userguide/dockervolumes/
*/
private final def makeVolumes(exposedVolumes: Seq[String], daemonUser: String, daemonGroup: String): Seq[CmdLike] =
if (exposedVolumes.isEmpty) Seq.empty
@@ -579,16 +600,21 @@ object DockerPlugin extends AutoPlugin {
)
/**
- * @param commands representing the Dockerfile
- * @return String representation of the Dockerfile described by commands
+ * @param commands
+ * representing the Dockerfile
+ * @return
+ * String representation of the Dockerfile described by commands
*/
private final def makeDockerContent(commands: Seq[CmdLike]): String =
Dockerfile(commands: _*).makeContent
/**
- * @param commands, docker content
- * @param target directory for Dockerfile
- * @return Dockerfile
+ * @param commands,
+ * docker content
+ * @param target
+ * directory for Dockerfile
+ * @return
+ * Dockerfile
*/
private[this] final def generateDockerConfig(commands: Seq[CmdLike], target: File): File = {
val dockerContent = makeDockerContent(commands)
@@ -599,8 +625,7 @@ object DockerPlugin extends AutoPlugin {
}
/**
- * uses the `mappings in Universal` to generate the
- * `Docker / mappings`.
+ * uses the `mappings in Universal` to generate the `Docker / mappings`.
*/
def mapGenericFilesToDocker: Seq[Setting[_]] = {
def renameDests(from: Seq[(File, String)], dest: String) =
@@ -765,7 +790,7 @@ object DockerPlugin extends AutoPlugin {
}
private[this] def validateExposedPorts(ports: Seq[Int], udpPorts: Seq[Int]): Validation.Validator =
- () => {
+ () =>
if (ports.isEmpty && udpPorts.isEmpty)
List(
ValidationWarning(
@@ -782,10 +807,9 @@ object DockerPlugin extends AutoPlugin {
)
else
List.empty
- }
private[this] def validateDockerVersion(dockerApiVersion: Option[DockerApiVersion]): Validation.Validator =
- () => {
+ () =>
dockerApiVersion match {
case Some(_) => List.empty
case None =>
@@ -815,14 +839,13 @@ object DockerPlugin extends AutoPlugin {
)
)
}
- }
private[this] def validateDockerPermissionStrategy(
strategy: DockerPermissionStrategy,
dockerVersion: Option[DockerVersion],
dockerApiVersion: Option[DockerApiVersion]
): Validation.Validator =
- () => {
+ () =>
(strategy, dockerVersion, dockerApiVersion) match {
case (DockerPermissionStrategy.MultiStage, Some(ver), Some(apiVer)) if !DockerSupport.multiStage(ver, apiVer) =>
List(
@@ -858,5 +881,4 @@ object DockerPlugin extends AutoPlugin {
)
case _ => List.empty
}
- }
}
diff --git a/src/main/scala/com/typesafe/sbt/packager/docker/DockerSpotifyClientPlugin.scala b/src/main/scala/com/typesafe/sbt/packager/docker/DockerSpotifyClientPlugin.scala
index 5a0ed54b6..12a78e7cd 100644
--- a/src/main/scala/com/typesafe/sbt/packager/docker/DockerSpotifyClientPlugin.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/docker/DockerSpotifyClientPlugin.scala
@@ -8,30 +8,31 @@ import sbt.Keys._
import sbt._
/**
- * == DockerSpotifyClientPlugin Plugin ==
+ * ==DockerSpotifyClientPlugin Plugin==
*
* This plugin helps you build docker containers using Spotify Docker Client.
*
- * == Configuration ==
+ * ==Configuration==
*
* In order to configure this plugin take a look at the available [[com.typesafe.sbt.packager.docker.DockerKeys]]
*
- * == Requirements ==
+ * ==Requirements==
*
- * You need docker to have docker installed on your system.
- * Check with a single command:
+ * You need docker to have docker installed on your system. Check with a single command:
*
* {{{
* docker version
* }}}
*
- * @note this plugin is not intended to build very customizable docker images, but turn your mappings
- * configuration in a docker image with almost no ''any'' configuration.
+ * @note
+ * this plugin is not intended to build very customizable docker images, but turn your mappings configuration in a
+ * docker image with almost no ''any'' configuration.
*
- * @example Enable the plugin in the `build.sbt`
- * {{{
+ * @example
+ * Enable the plugin in the `build.sbt`
+ * {{{
* enablePlugins(DockerSpotifyClientPlugin)
- * }}}
+ * }}}
*
* and add the dependency in your `plugins.sbt`
*
@@ -39,9 +40,8 @@ import sbt._
* libraryDependencies += "com.spotify" % "docker-client" % "3.5.13"
* }}}
*
- * The Docker-spotify client is a provided dependency so you have to add it on your own.
- * It brings a lot of dependenciesthat could slow your build times. This is the reason
- * the dependency is marked as provided.
+ * The Docker-spotify client is a provided dependency so you have to add it on your own. It brings a lot of
+ * dependenciesthat could slow your build times. This is the reason the dependency is marked as provided.
*/
object DockerSpotifyClientPlugin extends AutoPlugin {
@@ -97,10 +97,10 @@ object DockerSpotifyClientPlugin extends AutoPlugin {
}
/**
- * == Docker Client Task ==
+ * ==Docker Client Task==
*
- * This private class contains all the docker-plugin specific implementations. It's only invoked when the docker
- * plugin is enabled and the `docker:publishLocal` task is called. This means that all classes in
+ * This private class contains all the docker-plugin specific implementations. It's only invoked when the docker plugin
+ * is enabled and the `docker:publishLocal` task is called. This means that all classes in
* `com.spotify.docker.client._` are only loaded when required and allows us to put the dependency in the "provided"
* scope. The provided scope means that we have less dependency issues in an sbt build.
*/
diff --git a/src/main/scala/com/typesafe/sbt/packager/docker/DockerVersion.scala b/src/main/scala/com/typesafe/sbt/packager/docker/DockerVersion.scala
index 820ddb679..40e330748 100644
--- a/src/main/scala/com/typesafe/sbt/packager/docker/DockerVersion.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/docker/DockerVersion.scala
@@ -8,16 +8,15 @@ object DockerVersion {
private val DockerVersionPattern: Regex = """^'?([0-9]+)\.([0-9]+)(\.[0-9]+)?(\W|_)?(.+)?'?$""".r
def parse(version: String): Option[DockerVersion] =
- Option(version).collect {
- case DockerVersionPattern(major, minor, patch, _, release) =>
- new DockerVersion(
- major.toInt,
- minor.toInt,
- Option(patch) match {
- case Some(p) => p.drop(1).toInt
- case _ => 0
- },
- Option(release)
- )
+ Option(version).collect { case DockerVersionPattern(major, minor, patch, _, release) =>
+ new DockerVersion(
+ major.toInt,
+ minor.toInt,
+ Option(patch) match {
+ case Some(p) => p.drop(1).toInt
+ case _ => 0
+ },
+ Option(release)
+ )
}
}
diff --git a/src/main/scala/com/typesafe/sbt/packager/docker/LayeredMapping.scala b/src/main/scala/com/typesafe/sbt/packager/docker/LayeredMapping.scala
index 1abb51715..bf40bf9f6 100644
--- a/src/main/scala/com/typesafe/sbt/packager/docker/LayeredMapping.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/docker/LayeredMapping.scala
@@ -5,11 +5,13 @@ import java.io.File
/**
* Mapping of file to intermediate layers.
*
- * @param layerId The identifier in the layer used to increase cache hits in
- * docker caching. LayerId is present in docker:stage directory structure
- * and in intermediate image produced in the multi-stage docker build.
- * None means the layering is skipped for this file.
- * @param file The file produced by universal/stage to be moved into `Docker / stage` directory.
- * @param path The path in the final image
+ * @param layerId
+ * The identifier in the layer used to increase cache hits in docker caching. LayerId is present in docker:stage
+ * directory structure and in intermediate image produced in the multi-stage docker build. None means the layering is
+ * skipped for this file.
+ * @param file
+ * The file produced by universal/stage to be moved into `Docker / stage` directory.
+ * @param path
+ * The path in the final image
*/
case class LayeredMapping(layerId: Option[Int], file: File, path: String)
diff --git a/src/main/scala/com/typesafe/sbt/packager/docker/dockerfile.scala b/src/main/scala/com/typesafe/sbt/packager/docker/dockerfile.scala
index 14a2540f7..87021d3a3 100644
--- a/src/main/scala/com/typesafe/sbt/packager/docker/dockerfile.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/docker/dockerfile.scala
@@ -10,7 +10,8 @@ trait CmdLike {
/**
* Creates the command which can be placed inside a Dockerfile.
*
- * @return the docker command
+ * @return
+ * the docker command
*/
def makeContent: String
}
@@ -18,21 +19,17 @@ trait CmdLike {
/**
* Executable command
*
- * @example {{{
- * ExecCmd("RUN", "chown", "-R", daemonUser, ".")
- * }}}
+ * @example
+ * {{{ExecCmd("RUN", "chown", "-R", daemonUser, ".")}}}
*
- * @example {{{
- * ExecCmd("ENTRYPOINT", "bin/%s" format execScript),
- * }}}
+ * @example
+ * {{{ExecCmd("ENTRYPOINT", "bin/%s" format execScript),}}}
*
- * @example {{{
- * ExecCmd("CMD")
- * }}}
+ * @example
+ * {{{ExecCmd("CMD")}}}
*
- * @example {{{
- * ExecCmd("VOLUME", exposedVolumes: _*)
- * }}}
+ * @example
+ * {{{ExecCmd("VOLUME", exposedVolumes: _*)}}}
*/
case class ExecCmd(cmd: String, args: String*) extends CmdLike {
def makeContent: String =
@@ -43,19 +40,19 @@ case class ExecCmd(cmd: String, args: String*) extends CmdLike {
* An arbitrary command
*
* @example
- * {{{
+ * {{{
* val add = Cmd("ADD", "src/resource/LICENSE.txt", "/opt/docker/LICENSE.txt")
- * }}}
+ * }}}
*
* @example
- * {{{
+ * {{{
* val copy = Cmd("COPY", "src/resource/LICENSE.txt", "/opt/docker/LICENSE.txt")
- * }}}
+ * }}}
*
* @example
- * {{{
+ * {{{
* val env = Cmd("ENV", "APP_SECRET", "7sdfy7s9hfisdufuusud")
- * }}}
+ * }}}
*/
case class Cmd(cmd: String, args: String*) extends CmdLike {
def makeContent: String = "%s %s\n" format (cmd, args.mkString(" "))
@@ -65,14 +62,14 @@ case class Cmd(cmd: String, args: String*) extends CmdLike {
* A command that consists of a CMD string and an CmdLike object
*
* @example
- * {{{
+ * {{{
* val onBuildAdd = CombinedCmd("ONBUILD", Cmd("ADD", "src/resource/LICENSE.txt", "/opt/docker/LICENSE.txt"))
- * }}}
+ * }}}
*
* @example
- * {{{
+ * {{{
* val onBuildEnv = CombinedCmd("ONBUILD", Cmd("ENV", "APP_SECRET", "7sdfy7s9hfisdufuusud"))
- * }}}
+ * }}}
*/
case class CombinedCmd(cmd: String, arg: CmdLike) extends CmdLike {
def makeContent: String = "%s %s\n" format (cmd, arg.makeContent)
@@ -86,8 +83,7 @@ case class Comment(comment: String) extends CmdLike {
}
/**
- * A break in Dockerfile to express multi-stage build.
- * https://docs.docker.com/develop/develop-images/multistage-build/
+ * A break in Dockerfile to express multi-stage build. https://docs.docker.com/develop/develop-images/multistage-build/
*/
case object DockerStageBreak extends CmdLike {
def makeContent: String = "\n"
diff --git a/src/main/scala/com/typesafe/sbt/packager/graalvmnativeimage/GraalVMNativeImagePlugin.scala b/src/main/scala/com/typesafe/sbt/packager/graalvmnativeimage/GraalVMNativeImagePlugin.scala
index c3ba42ab3..41f196c89 100644
--- a/src/main/scala/com/typesafe/sbt/packager/graalvmnativeimage/GraalVMNativeImagePlugin.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/graalvmnativeimage/GraalVMNativeImagePlugin.scala
@@ -14,10 +14,11 @@ import com.typesafe.sbt.packager.universal.UniversalPlugin
/**
* Plugin to compile ahead-of-time native executables.
*
- * @example Enable the plugin in the `build.sbt`
- * {{{
+ * @example
+ * Enable the plugin in the `build.sbt`
+ * {{{
* enablePlugins(GraalVMNativeImagePlugin)
- * }}}
+ * }}}
*/
object GraalVMNativeImagePlugin extends AutoPlugin {
@@ -216,8 +217,8 @@ object GraalVMNativeImagePlugin extends AutoPlugin {
streams: TaskStreams
): File = {
val stageDir = targetDirectory / "stage"
- val mappings = classpathJars ++ resources.map {
- case (resource, path) => resource -> s"resources/$path"
+ val mappings = classpathJars ++ resources.map { case (resource, path) =>
+ resource -> s"resources/$path"
}
Stager.stage(GraalVMBaseImage)(streams, stageDir, mappings)
}
diff --git a/src/main/scala/com/typesafe/sbt/packager/jdkpackager/JDKPackagerAntHelper.scala b/src/main/scala/com/typesafe/sbt/packager/jdkpackager/JDKPackagerAntHelper.scala
index c19f683ec..9bdca3938 100644
--- a/src/main/scala/com/typesafe/sbt/packager/jdkpackager/JDKPackagerAntHelper.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/jdkpackager/JDKPackagerAntHelper.scala
@@ -11,7 +11,8 @@ import scala.xml.Elem
/**
* Helpers for working with Ant build definitions
*
- * @author Simeon H.K. Fitch
+ * @author
+ * Simeon H.K. Fitch
* @since 5/7/15
*/
object JDKPackagerAntHelper {
@@ -221,9 +222,11 @@ object JDKPackagerAntHelper {
/**
* Locate the generated packge.
- * TODO: replace with something significantly more intelligent.
- * @param output output directory
- * @return generated file location
+ * - TODO: replace with something significantly more intelligent.
+ * @param output
+ * output directory
+ * @return
+ * generated file location
*/
private[jdkpackager] def findResult(output: File, s: TaskStreams): Option[File] = {
// Oooof. Need to do better than this to determine what was generated.
diff --git a/src/main/scala/com/typesafe/sbt/packager/jdkpackager/JDKPackagerKeys.scala b/src/main/scala/com/typesafe/sbt/packager/jdkpackager/JDKPackagerKeys.scala
index 2b49c2cdd..bd084143f 100644
--- a/src/main/scala/com/typesafe/sbt/packager/jdkpackager/JDKPackagerKeys.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/jdkpackager/JDKPackagerKeys.scala
@@ -9,7 +9,8 @@ import scala.xml.Node
/**
* Keys specific to deployment via the `javapackger` tool.
*
- * @author Simeon H.K. Fitch
+ * @author
+ * Simeon H.K. Fitch
* @since 2/11/15
*/
trait JDKPackagerKeys {
diff --git a/src/main/scala/com/typesafe/sbt/packager/jdkpackager/JDKPackagerPlugin.scala b/src/main/scala/com/typesafe/sbt/packager/jdkpackager/JDKPackagerPlugin.scala
index b41943202..9c9b51e17 100644
--- a/src/main/scala/com/typesafe/sbt/packager/jdkpackager/JDKPackagerPlugin.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/jdkpackager/JDKPackagerPlugin.scala
@@ -13,7 +13,8 @@ import JDKPackagerAntHelper._
/**
* Package format via Oracle's packaging tool bundled with JDK 8.
*
- * @author Simeon H.K. Fitch
+ * @author
+ * Simeon H.K. Fitch
* @since 2/11/15
*/
object JDKPackagerPlugin extends AutoPlugin {
diff --git a/src/main/scala/com/typesafe/sbt/packager/linux/LinuxMappingDSL.scala b/src/main/scala/com/typesafe/sbt/packager/linux/LinuxMappingDSL.scala
index cf7f5cda2..5754dabe2 100644
--- a/src/main/scala/com/typesafe/sbt/packager/linux/LinuxMappingDSL.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/linux/LinuxMappingDSL.scala
@@ -8,7 +8,8 @@ trait LinuxMappingDSL {
def packageMapping(files: (File, String)*) = LinuxPackageMapping(files)
/**
- * @param dir - use some directory, e.g. target.value
+ * @param dir
+ * use some directory, e.g. target.value
* @param files
*/
def packageTemplateMapping(files: String*)(dir: File = new File(sys.props("java.io.tmpdir"))) =
@@ -16,8 +17,10 @@ trait LinuxMappingDSL {
// TODO can the packager.MappingsHelper be used here?
/**
- * @see #mapDirectoryAndContents
- * @param dirs - directories to map
+ * @see
+ * #mapDirectoryAndContents
+ * @param dirs
+ * directories to map
*/
def packageDirectoryAndContentsMapping(dirs: (File, String)*) =
LinuxPackageMapping(mapDirectoryAndContents(dirs: _*))
@@ -25,7 +28,8 @@ trait LinuxMappingDSL {
/**
* This method includes files and directories.
*
- * @param dirs - directories to map
+ * @param dirs
+ * directories to map
*/
def mapDirectoryAndContents(dirs: (File, String)*): Seq[(File, String)] =
for {
@@ -39,8 +43,10 @@ trait LinuxMappingDSL {
*
* See: http://www-uxsup.csx.cam.ac.uk/~jw35/docs/rpm_config.html
*
- * @param mappings list of mappings to update
- * @return updated list of mappings
+ * @param mappings
+ * list of mappings to update
+ * @return
+ * updated list of mappings
*/
def configWithNoReplace(mappings: Seq[LinuxPackageMapping]): Seq[LinuxPackageMapping] =
mappings.map {
diff --git a/src/main/scala/com/typesafe/sbt/packager/linux/LinuxPlugin.scala b/src/main/scala/com/typesafe/sbt/packager/linux/LinuxPlugin.scala
index f335fef91..3179943f9 100644
--- a/src/main/scala/com/typesafe/sbt/packager/linux/LinuxPlugin.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/linux/LinuxPlugin.scala
@@ -9,13 +9,13 @@ import com.typesafe.sbt.packager.universal.UniversalPlugin
import com.typesafe.sbt.packager.archetypes.TemplateWriter
/**
- * Plugin containing all the generic values used for
- * packaging linux software.
+ * Plugin containing all the generic values used for packaging linux software.
*
- * @example Enable the plugin in the `build.sbt`
- * {{{
+ * @example
+ * Enable the plugin in the `build.sbt`
+ * {{{
* enablePlugins(LinuxPlugin)
- * }}}
+ * }}}
*/
object LinuxPlugin extends AutoPlugin {
@@ -102,8 +102,7 @@ object LinuxPlugin extends AutoPlugin {
)
/**
- * maps the `mappings` content into `linuxPackageMappings` and
- * `linuxPackageSymlinks`.
+ * maps the `mappings` content into `linuxPackageMappings` and `linuxPackageSymlinks`.
*/
def mapGenericFilesToLinux: Seq[Setting[_]] =
Seq(
@@ -136,9 +135,8 @@ object LinuxPlugin extends AutoPlugin {
val installLocation = defaultLinuxInstallLocation.value
val configLocation = defaultLinuxConfigLocation.value
val needsConfLink =
- (mappings in Universal).value exists {
- case (file, destination) =>
- (destination startsWith "conf/") && !file.isDirectory
+ (mappings in Universal).value exists { case (file, destination) =>
+ (destination startsWith "conf/") && !file.isDirectory
}
if (needsConfLink)
Seq(
@@ -185,10 +183,10 @@ object LinuxPlugin extends AutoPlugin {
)
/**
- * Load the default controlscript functions which contain
- * addUser/removeUser/addGroup/removeGroup
+ * Load the default controlscript functions which contain addUser/removeUser/addGroup/removeGroup
*
- * @return placeholder->content
+ * @return
+ * placeholder->content
*/
def controlScriptFunctionsReplacement(template: Option[URL] = None): (String, String) = {
val url = template getOrElse LinuxPlugin.controlFunctions
@@ -210,23 +208,23 @@ object LinuxPlugin extends AutoPlugin {
/**
* Maps linux file format from the universal from the conventions:
*
- * `/src/linux` files are mapped directly into linux packages.
- * `` files are placed under `/usr/share/`
- * `/bin` files are given symlinks in `/usr/bin`
- * `/conf` directory is given a symlink to `/etc/`
- * Files in `conf/` or `etc/` directories are automatically marked as configuration.
- * `../man/...1` files are automatically compressed into .gz files.
+ * - `/src/linux` files are mapped directly into linux packages.
+ * - `` files are placed under `/usr/share/`
+ * - `/bin` files are given symlinks in `/usr/bin`
+ * - `/conf` directory is given a symlink to `/etc/`
+ * - Files in `conf/` or `etc/` directories are automatically marked as configuration.
+ * - `../man/...1` files are automatically compressed into .gz files.
*/
def mapGenericMappingsToLinux(mappings: Seq[(File, String)], user: String, group: String)(
rename: String => String
): Seq[LinuxPackageMapping] = {
val (directories, nondirectories) = mappings.partition(_._1.isDirectory)
- val (configFiles, nonConfigFiles) = nondirectories partition {
- case (_, destination) => (destination contains "etc/") || (destination contains "conf/")
+ val (configFiles, nonConfigFiles) = nondirectories partition { case (_, destination) =>
+ (destination contains "etc/") || (destination contains "conf/")
}
val (binaries, nonbinaries) = nonConfigFiles.partition(_._1.canExecute)
- val (manPages, remaining) = nonbinaries partition {
- case (_, destination) => (destination contains "man/") && (destination endsWith ".1")
+ val (manPages, remaining) = nonbinaries partition { case (_, destination) =>
+ (destination contains "man/") && (destination endsWith ".1")
}
val compressedManPages =
for ((file, name) <- manPages)
diff --git a/src/main/scala/com/typesafe/sbt/packager/rpm/Keys.scala b/src/main/scala/com/typesafe/sbt/packager/rpm/Keys.scala
index a3d15e2be..fbfd7f003 100644
--- a/src/main/scala/com/typesafe/sbt/packager/rpm/Keys.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/rpm/Keys.scala
@@ -78,8 +78,11 @@ trait RpmKeys {
"Directory where all debian control scripts reside. Default is 'src/rpm/scriptlets'"
)
- val rpmBrpJavaRepackJars = SettingKey[Boolean]("brp-java-repack-jars", """Overrides the __os_post_install scriptlet
- http://swaeku.github.io/blog/2013/08/05/how-to-disable-brp-java-repack-jars-during-rpm-build/ for details""")
+ val rpmBrpJavaRepackJars = SettingKey[Boolean](
+ "brp-java-repack-jars",
+ """Overrides the __os_post_install scriptlet
+ http://swaeku.github.io/blog/2013/08/05/how-to-disable-brp-java-repack-jars-during-rpm-build/ for details"""
+ )
// Building
val rpmLint = TaskKey[Unit]("rpm-lint", "Runs rpmlint program against the generated RPM, if available.")
diff --git a/src/main/scala/com/typesafe/sbt/packager/rpm/RpmHelper.scala b/src/main/scala/com/typesafe/sbt/packager/rpm/RpmHelper.scala
index af8076aee..00e58e599 100644
--- a/src/main/scala/com/typesafe/sbt/packager/rpm/RpmHelper.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/rpm/RpmHelper.scala
@@ -13,10 +13,14 @@ object RpmHelper {
/**
* Prepares the staging directory for the rpm build command.
*
- * @param spec The RpmSpec
- * @param workArea The target
- * @param log Logger
- * @return the `workArea`
+ * @param spec
+ * The RpmSpec
+ * @param workArea
+ * The target
+ * @param log
+ * Logger
+ * @return
+ * the `workArea`
*/
def stage(spec: RpmSpec, workArea: File, log: sbt.Logger): File = {
buildWorkArea(workArea)
@@ -33,10 +37,14 @@ object RpmHelper {
/**
* Build the rpm package
*
- * @param spec The RpmSpec
- * @param stagingArea Prepared staging area
- * @param log Logger
- * @return The rpm package
+ * @param spec
+ * The RpmSpec
+ * @param stagingArea
+ * Prepared staging area
+ * @param log
+ * Logger
+ * @return
+ * The rpm package
*/
def buildRpm(spec: RpmSpec, stagingArea: File, log: sbt.Logger): File = {
buildPackage(stagingArea, spec, log)
diff --git a/src/main/scala/com/typesafe/sbt/packager/rpm/RpmPlugin.scala b/src/main/scala/com/typesafe/sbt/packager/rpm/RpmPlugin.scala
index 1e5f1596d..d5046d7f5 100644
--- a/src/main/scala/com/typesafe/sbt/packager/rpm/RpmPlugin.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/rpm/RpmPlugin.scala
@@ -14,10 +14,11 @@ import com.typesafe.sbt.packager.validation._
/**
* Plugin containing all generic values used for packaging rpms.
*
- * @example Enable the plugin in the `build.sbt`
- * {{{
+ * @example
+ * Enable the plugin in the `build.sbt`
+ * {{{
* enablePlugins(RpmPlugin)
- * }}}
+ * }}}
*/
object RpmPlugin extends AutoPlugin {
@@ -37,7 +38,7 @@ object RpmPlugin extends AutoPlugin {
object Names {
val Scriptlets = "scriptlets"
- //maintainer script names
+ // maintainer script names
/** `pretrans` */
val Pretrans = "pretrans"
diff --git a/src/main/scala/com/typesafe/sbt/packager/universal/Archives.scala b/src/main/scala/com/typesafe/sbt/packager/universal/Archives.scala
index d5c93b0e5..521caf8c5 100644
--- a/src/main/scala/com/typesafe/sbt/packager/universal/Archives.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/universal/Archives.scala
@@ -9,11 +9,16 @@ object Archives {
/**
* Makes a zip file in the given target directory using the given name.
- * @param target folder to build package in
- * @param name of output (without extension)
- * @param mappings included in the output
- * @param top level directory
- * @return zip file
+ * @param target
+ * folder to build package in
+ * @param name
+ * of output (without extension)
+ * @param mappings
+ * included in the output
+ * @param top
+ * level directory
+ * @return
+ * zip file
*/
@deprecated(
"Use [[com.typesafe.sbt.packager.universal.Archives.makeZip(File, String, Seq[(File, String)], Option[String], Seq[String]): File]]",
@@ -25,12 +30,18 @@ object Archives {
/**
* Makes a zip file in the given target directory using the given name.
*
- * @param target folder to build package in
- * @param name of output (without extension)
- * @param mappings included in the output
- * @param top level directory
- * @param options NOT USED
- * @return zip file
+ * @param target
+ * folder to build package in
+ * @param name
+ * of output (without extension)
+ * @param mappings
+ * included in the output
+ * @param top
+ * level directory
+ * @param options
+ * NOT USED
+ * @return
+ * zip file
*/
def makeZip(
target: File,
@@ -53,11 +64,16 @@ object Archives {
/**
* Makes a zip file in the given target directory using the given name.
*
- * @param target folder to build package in
- * @param name of output (without extension)
- * @param mappings included in the output
- * @param top level directory
- * @return zip file
+ * @param target
+ * folder to build package in
+ * @param name
+ * of output (without extension)
+ * @param mappings
+ * included in the output
+ * @param top
+ * level directory
+ * @return
+ * zip file
*/
@deprecated(
"Use [[com.typesafe.sbt.packager.universal.Archives.makeNativeZip(File, String, Seq[(File, String)], Option[String], Seq[String]): File]]",
@@ -69,12 +85,18 @@ object Archives {
/**
* Makes a zip file in the given target directory using the given name.
*
- * @param target folder to build package in
- * @param name of output (without extension)
- * @param mappings included in the output
- * @param top level directory
- * @param options NOT USED
- * @return zip file
+ * @param target
+ * folder to build package in
+ * @param name
+ * of output (without extension)
+ * @param mappings
+ * included in the output
+ * @param top
+ * level directory
+ * @param options
+ * NOT USED
+ * @return
+ * zip file
*/
def makeNativeZip(
target: File,
@@ -97,13 +119,18 @@ object Archives {
/**
* Makes a dmg file in the given target directory using the given name.
*
- * Note: Only works on macOS
+ * Note: Only works on macOS
*
- * @param target folder to build package in
- * @param name of output (without extension)
- * @param mappings included in the output
- * @param top level directory : NOT USED
- * @return dmg file
+ * @param target
+ * folder to build package in
+ * @param name
+ * of output (without extension)
+ * @param mappings
+ * included in the output
+ * @param top
+ * level directory : NOT USED
+ * @return
+ * dmg file
*/
@deprecated(
"Use [[com.typesafe.sbt.packager.universal.Archives.makeDmg(target: File, name: String, mappings: Seq[(File, String)], top: Option[String], options: Seq[String]): File]]",
@@ -115,14 +142,20 @@ object Archives {
/**
* Makes a dmg file in the given target directory using the given name.
*
- * Note: Only works on macOS
+ * Note: Only works on macOS
*
- * @param target folder to build package in
- * @param name of output (without extension)
- * @param mappings included in the output
- * @param top level directory : NOT USED
- * @param options NOT USED
- * @return dmg file
+ * @param target
+ * folder to build package in
+ * @param name
+ * of output (without extension)
+ * @param mappings
+ * included in the output
+ * @param top
+ * level directory : NOT USED
+ * @param options
+ * NOT USED
+ * @return
+ * dmg file
*/
def makeDmg(
target: File,
@@ -182,8 +215,7 @@ object Archives {
}
/**
- * GZips a file. Returns the new gzipped file.
- * NOTE: This will 'consume' the input file.
+ * GZips a file. Returns the new gzipped file. NOTE: This will 'consume' the input file.
*/
def gzip(f: File): File = {
sourceDateEpoch(f)
@@ -196,8 +228,7 @@ object Archives {
}
/**
- * xz compresses a file. Returns the new xz compressed file.
- * NOTE: This will 'consume' the input file.
+ * xz compresses a file. Returns the new xz compressed file. NOTE: This will 'consume' the input file.
*/
def xz(f: File): File = {
sourceDateEpoch(f)
@@ -213,13 +244,18 @@ object Archives {
val makeTgz = makeTarballWithOptions(gzip, ".tgz") _
/**
- * Helper method used to construct tar-related compression functions with `--force-local` and `-pvcf` option specified
- * as default.
- * @param target folder to build package in
- * @param name of output (without extension)
- * @param mappings included in the output
- * @param top level directory
- * @return tar file
+ * Helper method used to construct tar-related compression functions with `--force-local` and `-pvcf` option
+ * specified as default.
+ * @param target
+ * folder to build package in
+ * @param name
+ * of output (without extension)
+ * @param mappings
+ * included in the output
+ * @param top
+ * level directory
+ * @return
+ * tar file
*/
def makeTarball(
compressor: File => File,
@@ -229,12 +265,18 @@ object Archives {
/**
* Helper method used to construct tar-related compression functions.
- * @param target folder to build package in
- * @param name of output (without extension)
- * @param mappings included in the output
- * @param topDirectory level directory
- * @param options for tar command
- * @return tar file
+ * @param target
+ * folder to build package in
+ * @param name
+ * of output (without extension)
+ * @param mappings
+ * included in the output
+ * @param topDirectory
+ * level directory
+ * @param options
+ * for tar command
+ * @return
+ * tar file
*/
def makeTarballWithOptions(compressor: File => File, ext: String)(
target: File,
diff --git a/src/main/scala/com/typesafe/sbt/packager/universal/UniversalPlugin.scala b/src/main/scala/com/typesafe/sbt/packager/universal/UniversalPlugin.scala
index 0e8c1b0c7..d8f4e41f9 100644
--- a/src/main/scala/com/typesafe/sbt/packager/universal/UniversalPlugin.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/universal/UniversalPlugin.scala
@@ -11,18 +11,19 @@ import com.typesafe.sbt.packager.{SettingsHelper, Stager}
import sbt.Keys.TaskStreams
/**
- * == Universal Plugin ==
+ * ==Universal Plugin==
*
* Defines behavior to construct a 'universal' zip for installation.
*
- * == Configuration ==
+ * ==Configuration==
*
* In order to configure this plugin take a look at the available [[com.typesafe.sbt.packager.universal.UniversalKeys]]
*
- * @example Enable the plugin in the `build.sbt`
- * {{{
+ * @example
+ * Enable the plugin in the `build.sbt`
+ * {{{
* enablePlugins(UniversalPlugin)
- * }}}
+ * }}}
*/
object UniversalPlugin extends AutoPlugin {
@@ -89,10 +90,10 @@ object UniversalPlugin extends AutoPlugin {
stage := Stager.stage(config.name)(streams.value, stagingDirectory.value, mappings.value)
)
) ++ Seq(
- sourceDirectory in config := sourceDirectory.value / config.name,
- validatePackageValidators in config := validatePackageValidators.value,
- target in config := target.value / config.name
- )
+ sourceDirectory in config := sourceDirectory.value / config.name,
+ validatePackageValidators in config := validatePackageValidators.value,
+ target in config := target.value / config.name
+ )
private[this] def defaultUniversalArchiveOptions: Seq[Setting[_]] =
Seq(
diff --git a/src/main/scala/com/typesafe/sbt/packager/universal/ZipHelper.scala b/src/main/scala/com/typesafe/sbt/packager/universal/ZipHelper.scala
index ad4486345..b2a6a3230 100644
--- a/src/main/scala/com/typesafe/sbt/packager/universal/ZipHelper.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/universal/ZipHelper.scala
@@ -15,18 +15,24 @@ import scala.collection.JavaConverters._
/**
* Module with functions associated with processing zip files.
*
- * @see http://stackoverflow.com/questions/17888365/file-permissions-are-not-being-preserved-while-after-zip
- * @see http://stackoverflow.com/questions/3450250/is-it-possible-to-create-a-script-to-save-and-restore-permissions
- * @see http://stackoverflow.com/questions/1050560/maintain-file-permissions-when-extracting-from-a-zip-file-using-jdk-5-api
- * @see http://docs.oracle.com/javase/7/docs/technotes/guides/io/fsp/zipfilesystemprovider.html
+ * @see
+ * http://stackoverflow.com/questions/17888365/file-permissions-are-not-being-preserved-while-after-zip
+ * @see
+ * http://stackoverflow.com/questions/3450250/is-it-possible-to-create-a-script-to-save-and-restore-permissions
+ * @see
+ * http://stackoverflow.com/questions/1050560/maintain-file-permissions-when-extracting-from-a-zip-file-using-jdk-5-api
+ * @see
+ * http://docs.oracle.com/javase/7/docs/technotes/guides/io/fsp/zipfilesystemprovider.html
*/
object ZipHelper {
case class FileMapping(file: File, name: String, unixMode: Option[Int] = None)
/**
* Creates a zip file attempting to give files the appropriate unix permissions using Java 6 APIs.
- * @param sources The files to include in the zip file.
- * @param outputZip The location of the output file.
+ * @param sources
+ * The files to include in the zip file.
+ * @param outputZip
+ * The location of the output file.
*/
def zipNative(sources: Traversable[(File, String)], outputZip: File): Unit =
IO.withTemporaryDirectory { dir =>
@@ -55,12 +61,13 @@ object ZipHelper {
/**
* Creates a zip file with the apache commons compressor library.
*
- * Note: This is known to have some odd issues on macOS whereby executable permissions
- * are not actually discovered, even though the Info-Zip headers exist and work on
- * many variants of linux. Yay Apple.
+ * Note: This is known to have some odd issues on macOS whereby executable permissions are not actually discovered,
+ * even though the Info-Zip headers exist and work on many variants of linux. Yay Apple.
*
- * @param sources The files to include in the zip file.
- * @param outputZip The location of the output file.
+ * @param sources
+ * The files to include in the zip file.
+ * @param outputZip
+ * The location of the output file.
*/
def zip(sources: Traversable[(File, String)], outputZip: File): Unit = {
import permissions.OctalString
@@ -78,13 +85,15 @@ object ZipHelper {
/**
* Creates a zip file attempting to give files the appropriate unix permissions using Java 7 APIs.
*
- * @param sources The files to include in the zip file.
- * @param outputZip The location of the output file.
+ * @param sources
+ * The files to include in the zip file.
+ * @param outputZip
+ * The location of the output file.
*/
def zipNIO(sources: Traversable[(File, String)], outputZip: File): Unit = {
require(!outputZip.isDirectory, "Specified output file " + outputZip + " is a directory.")
- val mappings = sources.toSeq.map {
- case (file, name) => FileMapping(file, name)
+ val mappings = sources.toSeq.map { case (file, name) =>
+ FileMapping(file, name)
}
// make sure everything is available
@@ -121,13 +130,15 @@ object ZipHelper {
mode foreach (entry.setUnixMode)
output putArchiveEntry entry
- try if (file.isFile) {
- val fis = new java.io.FileInputStream(file)
- try
- // TODO - Write file into output?
- IOUtils.copy(fis, output)
- finally fis.close()
- } finally output.closeArchiveEntry()
+ try
+ if (file.isFile) {
+ val fis = new java.io.FileInputStream(file)
+ try
+ // TODO - Write file into output?
+ IOUtils.copy(fis, output)
+ finally fis.close()
+ }
+ finally output.closeArchiveEntry()
}
}
}
@@ -147,9 +158,10 @@ object ZipHelper {
}
/**
- * Replaces windows backslash file separator with a forward slash, this ensures the zip file entry is correct for
- * any system it is extracted on.
- * @param path The path of the file in the zip file
+ * Replaces windows backslash file separator with a forward slash, this ensures the zip file entry is correct for any
+ * system it is extracted on.
+ * @param path
+ * The path of the file in the zip file
*/
private def normalizePath(path: String) = {
val sep = java.io.File.separatorChar
@@ -165,8 +177,10 @@ object ZipHelper {
* Note: This will override an existing zipFile if existent!
*
* @param zipFile
- * @param f: FileSystem => Unit, logic working in the filesystem
- * @see http://stackoverflow.com/questions/9873845/java-7-zip-file-system-provider-doesnt-seem-to-accept-spaces-in-uri
+ * @param f:
+ * FileSystem => Unit, logic working in the filesystem
+ * @see
+ * http://stackoverflow.com/questions/9873845/java-7-zip-file-system-provider-doesnt-seem-to-accept-spaces-in-uri
*/
def withZipFilesystem(zipFile: File, overwrite: Boolean = true)(f: FileSystem => Unit): Unit = {
if (overwrite) Files deleteIfExists zipFile.toPath
diff --git a/src/main/scala/com/typesafe/sbt/packager/validation/Validation.scala b/src/main/scala/com/typesafe/sbt/packager/validation/Validation.scala
index 3499423c9..af21b84a2 100644
--- a/src/main/scala/com/typesafe/sbt/packager/validation/Validation.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/validation/Validation.scala
@@ -5,8 +5,10 @@ import sbt.Logger
/**
* Validation result.
*
- * @param errors all errors that were found during the validation
- * @param warnings all warnings that were found during the validation
+ * @param errors
+ * all errors that were found during the validation
+ * @param warnings
+ * all warnings that were found during the validation
*/
final case class Validation(errors: List[ValidationError], warnings: List[ValidationWarning])
@@ -15,23 +17,26 @@ object Validation {
/**
* A validator is a function that returns a list of validation results.
*
- * @example Usually a validator is a function that captures some setting or task value, e.g.
- * {{{
+ * @example
+ * Usually a validator is a function that captures some setting or task value, e.g.
+ * {{{
* validatePackageValidators += {
* val universalMappings = (mappings in Universal).value
* () => {
* if (universalMappings.isEmpty) List(ValidationError(...)) else List.empt
* }
* }
- * }}}
+ * }}}
*
* The `validation` package object contains various standard validators.
*/
type Validator = () => List[ValidationResult]
/**
- * @param validators a list of validators that produce a `Validation` result
- * @return aggregated result of all validator function
+ * @param validators
+ * a list of validators that produce a `Validation` result
+ * @return
+ * aggregated result of all validator function
*/
def apply(validators: Seq[Validator]): Validation =
validators.flatMap(_.apply()).foldLeft(Validation(Nil, Nil)) {
@@ -40,25 +45,24 @@ object Validation {
}
/**
- * Runs a list of validators and throws an exception after printing all
- * errors and warnings with the provided logger.
+ * Runs a list of validators and throws an exception after printing all errors and warnings with the provided logger.
*
- * @param validators a list of validators that produce the validation result
- * @param log used to print errors and warnings
+ * @param validators
+ * a list of validators that produce the validation result
+ * @param log
+ * used to print errors and warnings
*/
def runAndThrow(validators: Seq[Validator], log: Logger): Unit = {
val Validation(errors, warnings) = apply(validators)
- warnings.zipWithIndex.foreach {
- case (warning, i) =>
- log.warn(s"[${i + 1}] ${warning.description}")
- log.warn(warning.howToFix)
+ warnings.zipWithIndex.foreach { case (warning, i) =>
+ log.warn(s"[${i + 1}] ${warning.description}")
+ log.warn(warning.howToFix)
}
- errors.zipWithIndex.foreach {
- case (error, i) =>
- log.error(s"[${i + 1}] ${error.description}")
- log.error(error.howToFix)
+ errors.zipWithIndex.foreach { case (error, i) =>
+ log.error(s"[${i + 1}] ${error.description}")
+ log.error(error.howToFix)
}
if (errors.nonEmpty)
diff --git a/src/main/scala/com/typesafe/sbt/packager/validation/ValidationKeys.scala b/src/main/scala/com/typesafe/sbt/packager/validation/ValidationKeys.scala
index 93e97a9ca..3edb0c63e 100644
--- a/src/main/scala/com/typesafe/sbt/packager/validation/ValidationKeys.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/validation/ValidationKeys.scala
@@ -5,13 +5,11 @@ import sbt._
trait ValidationKeys {
/**
- * A task that implements various validations for a format.
- * Example usage:
- * - `sbt universal:packageBin::validatePackage`
- * - `sbt debian:packageBin::validatePackage`
+ * A task that implements various validations for a format. Example usage:
+ * - `sbt universal:packageBin::validatePackage`
+ * - `sbt debian:packageBin::validatePackage`
*
- * Each format should implement it's own validate.
- * Implemented in #1026
+ * Each format should implement it's own validate. Implemented in #1026
*/
val validatePackage = taskKey[Unit]("validates the package configuration")
diff --git a/src/main/scala/com/typesafe/sbt/packager/validation/package.scala b/src/main/scala/com/typesafe/sbt/packager/validation/package.scala
index b6a261fdc..c770d402f 100644
--- a/src/main/scala/com/typesafe/sbt/packager/validation/package.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/validation/package.scala
@@ -3,7 +3,7 @@ package com.typesafe.sbt.packager
import sbt._
/**
- * == validation ==
+ * ==validation==
*
* This package contains stanard validators that can be used by format and archetype plugins.
*/
@@ -12,11 +12,13 @@ package object validation {
/**
* Basic validator to check if the resulting package will be empty or not.
*
- * @param mappings the mappings that should be validated
- * @return a validator that checks if the mappins are empty
+ * @param mappings
+ * the mappings that should be validated
+ * @return
+ * a validator that checks if the mappins are empty
*/
def nonEmptyMappings(mappings: Seq[(File, String)]): Validation.Validator =
- () => {
+ () =>
if (mappings.isEmpty)
List(
ValidationError(
@@ -26,31 +28,28 @@ package object validation {
)
else
List.empty
- }
/**
* @param mappings
* @return
*/
def filesExist(mappings: Seq[(File, String)]): Validation.Validator =
- () => {
+ () =>
// check that all files exist
mappings
- .filter {
- case (f, _) => !f.exists
+ .filter { case (f, _) =>
+ !f.exists
}
- .map {
- case (file, dest) =>
- ValidationError(
- description = s"Not found: ${file.getAbsolutePath} (mapped to $dest)",
- howToFix = "Generate the file in the task/setting that adds it to the mappings task"
- )
+ .map { case (file, dest) =>
+ ValidationError(
+ description = s"Not found: ${file.getAbsolutePath} (mapped to $dest)",
+ howToFix = "Generate the file in the task/setting that adds it to the mappings task"
+ )
}
.toList
- }
def checkMaintainer(maintainer: String, asWarning: Boolean): Validation.Validator =
- () => {
+ () =>
if (maintainer.isEmpty) {
val description = "The maintainer is empty"
val howToFix = """|Add this to your build.sbt
@@ -60,10 +59,9 @@ package object validation {
List(result)
} else
List.empty
- }
def epochIsNaturalNumber(epoch: Int): Validation.Validator =
- () => {
+ () =>
if (epoch < 0)
ValidationError(
description = s"The Epoch cannot be a negative number (found $epoch)",
@@ -71,6 +69,5 @@ package object validation {
) :: Nil
else
Nil
- }
}
diff --git a/src/main/scala/com/typesafe/sbt/packager/windows/WindowsPlugin.scala b/src/main/scala/com/typesafe/sbt/packager/windows/WindowsPlugin.scala
index 1d8fb5be0..04de1dd08 100644
--- a/src/main/scala/com/typesafe/sbt/packager/windows/WindowsPlugin.scala
+++ b/src/main/scala/com/typesafe/sbt/packager/windows/WindowsPlugin.scala
@@ -11,25 +11,24 @@ import com.typesafe.sbt.packager.SettingsHelper
import com.typesafe.sbt.packager.sourceDateEpoch
/**
- * == Windows Plugin ==
+ * ==Windows Plugin==
*
* This plugin generates ''msi'' packages that can be installed on windows systems.
*
- * == Configuration ==
+ * ==Configuration==
*
* In order to configure this plugin take a look at the available [[com.typesafe.sbt.packager.windows.WindowsKeys]]
*
- * == Requirements ==
+ * ==Requirements==
*
- *
- * - Windows System
- * - Wix Toolset ([[http://wixtoolset.org/]]) installed
- *
+ * - Windows System
+ * - Wix Toolset ([[http://wixtoolset.org/]]) installed
*
- * @example Enable the plugin in the `build.sbt`
- * {{{
+ * @example
+ * Enable the plugin in the `build.sbt`
+ * {{{
* enablePlugins(WindowsPlugin)
- * }}}
+ * }}}
*/
object WindowsPlugin extends AutoPlugin {
@@ -108,8 +107,8 @@ object WindowsPlugin extends AutoPlugin {
// to our target directory.
val targetFlat: Path.FileMap = Path.flat(target.value)
val wsxFiles = wsxSources.map(targetFlat(_).get)
- val wsxCopyPairs = wsxSources.zip(wsxFiles).filter {
- case (src, dest) => src.getAbsolutePath != dest.getAbsolutePath
+ val wsxCopyPairs = wsxSources.zip(wsxFiles).filter { case (src, dest) =>
+ src.getAbsolutePath != dest.getAbsolutePath
}
IO.copy(wsxCopyPairs)
IO.copy(for ((f, to) <- mappings.value) yield (f, target.value / to))
@@ -157,9 +156,12 @@ object WindowsPlugin extends AutoPlugin {
/**
* Generates the wix configuration features
*
- * @param name - title of the core package
- * @param mappings - use to generate different features
- * @return windows features
+ * @param name
+ * title of the core package
+ * @param mappings
+ * use to generate different features
+ * @return
+ * windows features
*/
def makeWindowsFeatures(name: String, mappings: Seq[(File, String)]): Seq[WindowsFeature] = {
// TODO select main script! Filter Config links!