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

Mark docker and jdeb as provided dependencies #719

Merged
merged 1 commit into from
Dec 28, 2015
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
5 changes: 3 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ scalacOptions in Compile ++= Seq("-deprecation", "-target:jvm-1.7")

libraryDependencies ++= Seq(
"org.apache.commons" % "commons-compress" % "1.4.1",
"com.spotify" % "docker-client" % "3.2.1",
"org.vafer" % "jdeb" % "1.3" artifacts (Artifact("jdeb", "jar", "jar")),
// these dependencies have to be explicitly added by the user
"com.spotify" % "docker-client" % "3.2.1" % "provided",
"org.vafer" % "jdeb" % "1.3" % "provided" artifacts (Artifact("jdeb", "jar", "jar")),
"org.scalatest" %% "scalatest" % "2.2.4" % "test"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ package docker
import java.nio.file.Paths

import com.spotify.docker.client.messages.ProgressMessage
import com.spotify.docker.client.{ProgressHandler, DockerClient, DefaultDockerClient}
import com.spotify.docker.client.{ ProgressHandler, DockerClient, DefaultDockerClient }
import com.spotify.docker.client.DockerClient.BuildParameter._
import sbt._
import sbt.Keys._
import packager.Keys._
import universal.UniversalPlugin.autoImport.stage


/**
* == DockerSpotifyClientPlugin Plugin ==
*
Expand All @@ -36,9 +35,19 @@ import universal.UniversalPlugin.autoImport.stage
* configuration in a docker image with almost no ''any'' configuration.
*
* @example Enable the plugin in the `build.sbt`
* {{{
* enablePlugins(DockerSpotifyClientPlugin)
* }}}
* {{{
* enablePlugins(DockerSpotifyClientPlugin)
* }}}
*
* and add the dependency in your `plugins.sbt`
*
* {{{
* libraryDependencies += "com.spotify" % "docker-client" % "3.2.1"
* }}}
*
* 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 {

Expand Down Expand Up @@ -79,5 +88,4 @@ object DockerSpotifyClientPlugin extends AutoPlugin {
}
}


}
2 changes: 2 additions & 0 deletions src/sbt-test/debian/jdeb-dependencies/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % sys.props("project.version"))

libraryDependencies += "org.vafer" % "jdeb" % "1.3" artifacts (Artifact("jdeb", "jar", "jar"))
2 changes: 2 additions & 0 deletions src/sbt-test/debian/jdeb-dir-mappings/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % sys.props("project.version"))

libraryDependencies += "org.vafer" % "jdeb" % "1.3" artifacts (Artifact("jdeb", "jar", "jar"))
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % sys.props("project.version"))

libraryDependencies += "org.vafer" % "jdeb" % "1.3" artifacts (Artifact("jdeb", "jar", "jar"))
2 changes: 2 additions & 0 deletions src/sbt-test/debian/override-start-script/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % sys.props("project.version"))

libraryDependencies += "org.vafer" % "jdeb" % "1.3" artifacts (Artifact("jdeb", "jar", "jar"))
2 changes: 2 additions & 0 deletions src/sbt-test/debian/simple-jdeb/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % sys.props("project.version"))

libraryDependencies += "org.vafer" % "jdeb" % "1.3" artifacts (Artifact("jdeb", "jar", "jar"))
7 changes: 7 additions & 0 deletions src/sbt-test/docker/spotify-client/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
enablePlugins(JavaAppPackaging, DockerSpotifyClientPlugin)

name := "docker-test"

version := "0.1.0"

maintainer := "Gary Coady <[email protected]>"
4 changes: 4 additions & 0 deletions src/sbt-test/docker/spotify-client/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % sys.props("project.version"))

// needs to be added for the docker spotify client
libraryDependencies += "com.spotify" % "docker-client" % "3.2.1"
3 changes: 3 additions & 0 deletions src/sbt-test/docker/spotify-client/src/main/scala/Main.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
object Main extends App {
println("Hello world")
}
3 changes: 3 additions & 0 deletions src/sbt-test/docker/spotify-client/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Generate the Docker image locally
> docker:publishLocal
$ exec bash -c 'docker run docker-test:0.1.0 | grep -q "Hello world"'
22 changes: 10 additions & 12 deletions src/sphinx/formats/debian.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,33 +57,31 @@ you have these settings in your build:
packageDescription := """A fun package description of our software,
with multiple lines."""

1.0 or higher
~~~~~~~~~~~~~

Enable the debian plugin to activate the native package implementation.

.. code-block:: scala

enablePlugins(DebianPlugin)

Java based packaging
~~~~~~~~~~~~~~~~~~~~

If you want to use the java based implementation, enable the following plugin.

.. code-block:: scala

enablePlugins(JDebPackaging)

0.8 or lower
~~~~~~~~~~~~

For this versions debian packaging is automatically activated.
See the :doc:`Getting Started </gettingstarted>` page for information
on how to enable sbt native packager.

If you want to enable `jdeb` packaging add the following to your `build.sbt`

and this to your ``plugins.sbt``

.. code-block:: scala

packageBin in Debian <<= debianJDebPackaging in Debian
libraryDependencies += "org.vafer" % "jdeb" % "1.3" artifacts (Artifact("jdeb", "jar", "jar"))

JDeb is a provided dependency so you have to add it on your own. It brings a lot of dependencies
that could slow your build times. This is the reason the dependency is marked as provided.



Configurations
Expand Down
27 changes: 19 additions & 8 deletions src/sphinx/formats/docker.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,30 @@ Build
Required Settings
~~~~~~~~~~~~~~~~~

1.0 or higher
~~~~~~~~~~~~~

.. code-block:: scala

enablePlugins(DockerPlugin)

Spotify java based docker client
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can also use the java-based spotify Docker client. Add this to your ``build.sbt``


.. code-block:: scala

enablePlugins(DockerSpotifyClientPlugin)


and this to your ``plugins.sbt``

.. code-block:: scala

0.8.x
~~~~~
libraryDependencies += "com.spotify" % "docker-client" % "3.2.1"

For this versions docker packaging is automatically activated.
See the :doc:`Getting Started </gettingstarted>` page for information
on how to enable sbt native packager.
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.

Configuration
-------------
Expand Down
3 changes: 1 addition & 2 deletions test-project-docker/build.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import com.typesafe.sbt.packager.docker._

enablePlugins(JavaAppPackaging)
enablePlugins(DockerSpotifyClientPlugin)
enablePlugins(JavaAppPackaging, DockerSpotifyClientPlugin)

name := "docker-test"

Expand Down
5 changes: 4 additions & 1 deletion test-project-docker/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
lazy val root = Project("plugins", file(".")).dependsOn(plugin)

lazy val plugin = file("../").getCanonicalFile.toURI
lazy val plugin = file("../").getCanonicalFile.toURI

// needs to be added for the docker spotify client
libraryDependencies += "com.spotify" % "docker-client" % "3.2.1"
2 changes: 2 additions & 0 deletions test-project-simple/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
lazy val root = Project("plugins", file(".")) dependsOn(packager)

lazy val packager = file("..").getAbsoluteFile.toURI

libraryDependencies += "org.vafer" % "jdeb" % "1.3" artifacts (Artifact("jdeb", "jar", "jar"))