Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Remove AutoPlugin triggers from plugins. #389

Merged
merged 3 commits into from
Nov 6, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/scala/com/typesafe/sbt/PackagerPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ object SbtNativePackager extends AutoPlugin {

import SettingsHelper._

@deprecated("Use enablePlugins(xxxDeployPlugin)", "1.x")
def deploymentSettings = makeDeploymentSettings(Debian, packageBin in Debian, "deb") ++
makeDeploymentSettings(Rpm, packageBin in Rpm, "rpm") ++
makeDeploymentSettings(Windows, packageBin in Windows, "msi") ++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import SbtNativePackager.{ Universal, Linux }
object DebianPlugin extends AutoPlugin with DebianNativePackaging {

override def requires = linux.LinuxPlugin
override def trigger = allRequirements

object autoImport extends DebianKeys {
val Debian = config("debian") extend Linux
Expand Down Expand Up @@ -341,3 +340,14 @@ trait DebianPluginLike {
appName + "_" + version + "_" + arch + ".changes"
}
}

object DebianDeployPlugin extends AutoPlugin {

import DebianPlugin.autoImport._

override def requires = DebianPlugin

override def projectSettings =
SettingsHelper.makeDeploymentSettings(Debian, packageBin in Debian, "deb") ++
SettingsHelper.makeDeploymentSettings(Debian, genChanges in Debian, "changes")
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ object DockerPlugin extends AutoPlugin {

override def requires = universal.UniversalPlugin

override def trigger = allRequirements

override lazy val projectSettings = Seq(
dockerBaseImage := "dockerfile/java:latest",
name in Docker <<= name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import SbtNativePackager.Universal
object LinuxPlugin extends AutoPlugin {

override def requires = universal.UniversalPlugin
override def trigger = allRequirements
override lazy val projectSettings = linuxSettings ++ mapGenericFilesToLinux

object autoImport extends LinuxKeys with LinuxMappingDSL {
Expand Down
10 changes: 9 additions & 1 deletion src/main/scala/com/typesafe/sbt/packager/rpm/RpmPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import packager.Keys._
object RpmPlugin extends AutoPlugin {

override def requires = LinuxPlugin
override def trigger = allRequirements

object autoImport extends RpmKeys {
val Rpm = config("rpm") extend Linux
Expand Down Expand Up @@ -109,3 +108,12 @@ object RpmPlugin extends AutoPlugin {
))
}

object RpmDeployPlugin extends AutoPlugin {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably just be part of the RPM plugin (similarly for Debian/Universal/Windows etc.). The reason we didn't do this initially was because these settings were more experimental. Having used them in several projects, we can just embed them in the raw plugins now, in my opinion.


import RpmPlugin.autoImport._

override def requires = RpmPlugin

override def projectSettings =
SettingsHelper.makeDeploymentSettings(Rpm, packageBin in Rpm, "rpm")
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ object UniversalPlugin extends AutoPlugin {
import autoImport._

override def requires = SbtNativePackager
override def trigger = allRequirements

/** The basic settings for the various packaging types. */
override lazy val projectSettings = Seq[Setting[_]](
Expand Down Expand Up @@ -114,3 +113,16 @@ object UniversalPlugin extends AutoPlugin {
sourceDir.*** --- sourceDir pair relativeTo(sourceDir)

}

object UniversalDeployPlugin extends AutoPlugin {

import UniversalPlugin.autoImport._

override def requires = UniversalPlugin

override def projectSettings =
SettingsHelper.makeDeploymentSettings(Universal, packageBin in Universal, "zip") ++
SettingsHelper.addPackage(Universal, packageZipTarball in Universal, "tgz") ++
SettingsHelper.makeDeploymentSettings(UniversalDocs, packageBin in UniversalDocs, "zip") ++
SettingsHelper.addPackage(UniversalDocs, packageXzTarball in UniversalDocs, "txz")
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ object WindowsPlugin extends AutoPlugin {

override lazy val projectSettings = windowsSettings ++ mapGenericFilesToWindows
override def requires = universal.UniversalPlugin
override def trigger = allRequirements

/**
* default windows settings
Expand Down Expand Up @@ -175,4 +174,14 @@ object WindowsPlugin extends AutoPlugin {
// TODO - Add feature for shortcuts to binary scripts.
Seq(corePackage, addBinToPath, menuLinks)
}
}
}

object WindowsDeployPlugin extends AutoPlugin {

import WindowsPlugin.autoImport._

override def requires = WindowsPlugin

override def projectSettings =
SettingsHelper.makeDeploymentSettings(Windows, packageBin in Windows, "msi")
}
4 changes: 2 additions & 2 deletions src/sbt-test/debian/gen-changes/build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
enablePlugins(SbtNativePackager)
enablePlugins(DebianPlugin)

name := "debian-test"

Expand All @@ -15,4 +15,4 @@ debianPackageDependencies in Debian ++= Seq("java2-runtime", "bash (>= 2.05a-11)

debianPackageRecommends in Debian += "git"

debianChangelog in Debian := Some(file("debian/changelog"))
debianChangelog in Debian := Some(file("debian/changelog"))
2 changes: 1 addition & 1 deletion src/sbt-test/debian/test-mapping-helpers/build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import NativePackagerHelper._

enablePlugins(SbtNativePackager)
enablePlugins(DebianPlugin)

name := "debian-test"

Expand Down
2 changes: 1 addition & 1 deletion src/sbt-test/docker/staging/build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
enablePlugins(SbtNativePackager)
enablePlugins(DockerPlugin)

name := "simple-test"

Expand Down
2 changes: 1 addition & 1 deletion src/sbt-test/docker/volumes/build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
enablePlugins(SbtNativePackager)
enablePlugins(DockerPlugin)

name := "simple-test"

Expand Down
2 changes: 1 addition & 1 deletion src/sbt-test/rpm/scriptlets-rpm/build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
enablePlugins(SbtNativePackager)
enablePlugins(RpmPlugin)

name := "rpm-test"

Expand Down
2 changes: 1 addition & 1 deletion src/sbt-test/rpm/simple-rpm/build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
enablePlugins(SbtNativePackager)
enablePlugins(RpmPlugin)

name := "rpm-test"

Expand Down
2 changes: 1 addition & 1 deletion src/sbt-test/universal/clear-stage-dir/build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
enablePlugins(SbtNativePackager)
enablePlugins(UniversalPlugin)

name := "simple-test"

Expand Down
2 changes: 1 addition & 1 deletion src/sbt-test/universal/dist/build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
enablePlugins(SbtNativePackager)
enablePlugins(UniversalPlugin)

name := "simple-test"

Expand Down
6 changes: 2 additions & 4 deletions src/sbt-test/universal/publish/build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
enablePlugins(SbtNativePackager)

deploymentSettings
enablePlugins(UniversalDeployPlugin)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do like this idea of ensuring the plugins are independent in test.


name := "simple-test"

Expand All @@ -9,4 +7,4 @@ version := "0.1.0"
// Workarund for ivy configuration bug
resolvers += (publishTo in Universal).value.get

publishTo in Universal := Some(Resolver.file("test", file("test-repo"))(Patterns("[module]/[revision]/[module]-[revision].[ext]")))
publishTo in Universal := Some(Resolver.file("test", file("test-repo"))(Patterns("[module]/[revision]/[module]-[revision].[ext]")))
2 changes: 1 addition & 1 deletion src/sbt-test/universal/staging/build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
enablePlugins(SbtNativePackager)
enablePlugins(UniversalPlugin)

name := "simple-test"

Expand Down