-
Notifications
You must be signed in to change notification settings - Fork 443
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #374 from sbt/wip/autoplugins
Wip/autoplugins
- Loading branch information
Showing
87 changed files
with
1,297 additions
and
949 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,8 @@ com.typesafe.sbt.SbtSite.SiteKeys.siteMappings <+= (baseDirectory) map { dir => | |
|
||
site.sphinxSupport() | ||
|
||
site.includeScaladoc() | ||
|
||
ghpages.settings | ||
|
||
git.remoteRepo := "[email protected]:sbt/sbt-native-packager.git" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
sbt.version=0.13.5 | ||
sbt.version=0.13.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,56 +2,139 @@ package com.typesafe.sbt | |
|
||
import packager._ | ||
|
||
import debian.Keys.genChanges | ||
import Keys.{ packageName, packageZipTarball, packageXzTarball } | ||
import debian.DebianPlugin.autoImport.genChanges | ||
import universal.UniversalPlugin.autoImport.{ packageZipTarball, packageXzTarball } | ||
import sbt._ | ||
import sbt.Keys.{ normalizedName, packageBin } | ||
|
||
object SbtNativePackager extends Plugin | ||
with linux.LinuxPlugin | ||
with debian.DebianPlugin | ||
with rpm.RpmPlugin | ||
with windows.WindowsPlugin | ||
with docker.DockerPlugin | ||
with universal.UniversalPlugin | ||
with GenericPackageSettings { | ||
|
||
val NativePackagerKeys = packager.Keys | ||
|
||
val NativePackagerHelper = packager.MappingsHelper | ||
|
||
def packagerSettings = linuxSettings ++ | ||
debianSettings ++ | ||
rpmSettings ++ | ||
windowsSettings ++ | ||
dockerSettings ++ | ||
universalSettings ++ | ||
Seq( // Bad defaults that let us at least not explode users who don't care about native packagers | ||
NativePackagerKeys.maintainer := "", | ||
NativePackagerKeys.packageDescription := "", | ||
NativePackagerKeys.packageSummary := "", | ||
NativePackagerKeys.packageName <<= normalizedName, | ||
NativePackagerKeys.executableScriptName <<= NativePackagerKeys.packageName | ||
) | ||
|
||
import SettingsHelper._ | ||
def deploymentSettings = makeDeploymentSettings(Debian, packageBin in Debian, "deb") ++ | ||
makeDeploymentSettings(Rpm, packageBin in Rpm, "rpm") ++ | ||
makeDeploymentSettings(Windows, packageBin in Windows, "msi") ++ | ||
makeDeploymentSettings(Universal, packageBin in Universal, "zip") ++ | ||
addPackage(Universal, packageZipTarball in Universal, "tgz") ++ | ||
makeDeploymentSettings(UniversalDocs, packageBin in UniversalDocs, "zip") ++ | ||
addPackage(UniversalDocs, packageXzTarball in UniversalDocs, "txz") ++ | ||
makeDeploymentSettings(Debian, genChanges in Debian, "changes") | ||
import sbt.Keys.{ name, normalizedName, packageBin } | ||
|
||
/** | ||
* == 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. | ||
* | ||
* Currently you can choose between | ||
* | ||
* <ul> | ||
* <li>JavaAppPackaging</li> | ||
* <li>JavaServerPackaging</li> | ||
* <li>AkkaAppPackging</li> | ||
* </ul> | ||
* | ||
* == Configuration == | ||
* | ||
* The are a few settings you should set if you want to build package | ||
* no matter what format. | ||
* | ||
* {{{ | ||
* maintainer := "Your name <[email protected]>" | ||
* packageDescription := "A short description of your application" | ||
* }}} | ||
* | ||
* For all other general settings take a look at [[com.typesafe.sbt.packager.NativePackagerKeys]] | ||
* | ||
* @example Enable the plugin in the `build.sbt` | ||
* {{{ | ||
* enablePlugins(SbtNativePackager) | ||
* }}} | ||
* | ||
*/ | ||
object SbtNativePackager extends AutoPlugin { | ||
|
||
/* === Universal Configuration === */ | ||
val Universal = universal.UniversalPlugin.autoImport.Universal | ||
val UniversalDocs = universal.UniversalPlugin.autoImport.UniversalDocs | ||
val UniversalSrc = universal.UniversalPlugin.autoImport.UniversalSrc | ||
|
||
/* === OS Configurations === */ | ||
val Linux = linux.LinuxPlugin.autoImport.Linux | ||
val Debian = debian.DebianPlugin.autoImport.Debian | ||
val Rpm = rpm.RpmPlugin.autoImport.Rpm | ||
val Windows = windows.WindowsPlugin.autoImport.Windows | ||
val Docker = docker.DockerPlugin.autoImport.Docker | ||
|
||
/** | ||
* imports all [[com.typesafe.sbt.packager.NativePackagerKeys]] and two objects: | ||
* | ||
* === NativePackagerKeys === | ||
* | ||
* 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 === | ||
* | ||
* This object contains a set of helper methods for working with mappings. | ||
* | ||
*/ | ||
object autoImport extends packager.NativePackagerKeys { | ||
|
||
val NativePackagerKeys = packager.Keys | ||
val NativePackagerHelper = packager.MappingsHelper | ||
|
||
import SettingsHelper._ | ||
|
||
def deploymentSettings = makeDeploymentSettings(Debian, packageBin in Debian, "deb") ++ | ||
makeDeploymentSettings(Rpm, packageBin in Rpm, "rpm") ++ | ||
makeDeploymentSettings(Windows, packageBin in Windows, "msi") ++ | ||
makeDeploymentSettings(Universal, packageBin in Universal, "zip") ++ | ||
addPackage(Universal, packageZipTarball in Universal, "tgz") ++ | ||
makeDeploymentSettings(UniversalDocs, packageBin in UniversalDocs, "zip") ++ | ||
addPackage(UniversalDocs, packageXzTarball in UniversalDocs, "txz") ++ | ||
makeDeploymentSettings(Debian, genChanges in Debian, "changes") | ||
} | ||
|
||
import autoImport._ | ||
|
||
override lazy val projectSettings = Seq( | ||
// Bad defaults that let us at least not explode users who don't care about native packagers | ||
maintainer := "", | ||
packageDescription := name.value, | ||
packageSummary := name.value, | ||
packageName := normalizedName.value, | ||
executableScriptName := normalizedName.value | ||
|
||
) | ||
|
||
object packageArchetype { | ||
private[this] def genericMappingSettings: Seq[Setting[_]] = packagerSettings ++ mapGenericFilesToLinux ++ mapGenericFilesToWindows | ||
|
||
/** | ||
* == Recommended usage == | ||
* | ||
* {{{ | ||
* enablePlugins(JavaAppPackaging) | ||
* }}} | ||
*/ | ||
@deprecated("Use enablePlugins(JavaAppPackaging)", "1.x") | ||
def java_application: Seq[Setting[_]] = | ||
genericMappingSettings ++ archetypes.JavaAppPackaging.settings | ||
def akka_application: Seq[Setting[_]] = | ||
genericMappingSettings ++ archetypes.AkkaApp.settings | ||
def java_server: Seq[Setting[_]] = | ||
genericMappingSettings ++ archetypes.JavaServerAppPackaging.settings | ||
projectSettings ++ | ||
universal.UniversalPlugin.projectSettings ++ | ||
linux.LinuxPlugin.projectSettings ++ | ||
debian.DebianPlugin.projectSettings ++ | ||
rpm.RpmPlugin.projectSettings ++ | ||
docker.DockerPlugin.projectSettings ++ | ||
windows.WindowsPlugin.projectSettings ++ | ||
archetypes.JavaAppPackaging.projectSettings | ||
|
||
/** | ||
* {{{ | ||
* enablePlugins(AkkaAppPackaging) | ||
* }}} | ||
*/ | ||
@deprecated("Use enablePlugins(AkkaAppPackaging)", "1.x") | ||
def akka_application: Seq[Setting[_]] = java_application ++ archetypes.AkkaAppPackaging.projectSettings | ||
|
||
/** | ||
* {{{ | ||
* enablePlugins(JavaServerAppPackaging) | ||
* }}} | ||
*/ | ||
@deprecated("Use enablePlugins(JavaServerAppPackaging)", "1.x") | ||
def java_server: Seq[Setting[_]] = java_application ++ archetypes.JavaServerAppPackaging.projectSettings | ||
} | ||
|
||
// TODO - Add a few targets that detect the current OS and build a package for that OS. | ||
|
144 changes: 0 additions & 144 deletions
144
src/main/scala/com/typesafe/sbt/packager/GenericPackageSettings.scala
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.