Docs: move contents of dormant configurations page into Library-Management

This commit is contained in:
Mark Harrah 2013-04-09 13:54:45 -04:00
parent 4dde1468ad
commit d3f8bdb837
9 changed files with 76 additions and 94 deletions

View File

@ -105,7 +105,7 @@ A similar method ``parsed`` is defined on ``Parser[T]``, ``Initialize[Parser[T]]
for(arg <- args) println(" " + arg)
}
For details, see :doc:`Extending/Input-Tasks`.
For details, see :doc:`/Extending/Input-Tasks`.
To expect a task to fail and get the failing exception, use the ``failure`` method instead of ``value``. This provides an ``Incomplete`` value, which wraps the exception. To get the result of a task whether or not it succeeds, use ``result``, which provides a ``Result[T]``.

View File

@ -81,21 +81,18 @@ Documentation
repo) but doesn't have anything to link to that explains how to use
those.
3. the :doc:`/Dormant/Configurations` page is missing a list of the built-in
configurations and the purpose of each.
4. grep the documentation's git checkout for "Wiki Maintenance Note" and work on
3. grep the documentation's git checkout for "Wiki Maintenance Note" and work on
some of those
5. API docs are much needed.
4. API docs are much needed.
6. Find useful answers or types/methods/values in the other docs, and
5. Find useful answers or types/methods/values in the other docs, and
pull references to them up into :doc:`/faq` or :doc:`/Name-Index` so people can
find the docs. In general the :doc:`/faq` should feel a bit more like a
bunch of pointers into the regular docs, rather than an alternative
to the docs.
7. A lot of the pages could probably have better names, and/or little
6. A lot of the pages could probably have better names, and/or little
2-4 word blurbs to the right of them in the sidebar.

View File

@ -99,7 +99,7 @@ or
libraryDependencies += groupID % artifactID % revision % configuration
See :doc:`/Dormant/Configurations` for details on configuration mappings. Also,
See :ref:`configurations <ivy-configurations>` for details on configuration mappings. Also,
several dependencies can be declared together:
::
@ -533,10 +533,72 @@ For example,
Publishing
~~~~~~~~~~
Finally, see :doc:`Publishing` for how to publish your project.
See :doc:`Publishing` for how to publish your project.
.. _ivy-configurations:
Configurations
~~~~~~~~~~~~~~
Ivy configurations are a useful feature for your build when you need
custom groups of dependencies, such as for a plugin. Ivy configurations
are essentially named sets of dependencies. You can read the
`Ivy documentation <http://ant.apache.org/ivy/history/2.3.0-rc1/tutorial/conf.html>`_
for details.
The built-in use of configurations in sbt is similar to scopes in Maven.
sbt adds dependencies to different classpaths by the configuration that
they are defined in. See the description of `Maven
Scopes <http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope>`_
for details.
You put a dependency in a configuration by selecting one or more of its
configurations to map to one or more of your project's configurations.
The most common case is to have one of your configurations ``A`` use a
dependency's configuration ``B``. The mapping for this looks like
``"A->B"``. To apply this mapping to a dependency, add it to the end of
your dependency definition:
::
libraryDependencies += "org.scalatest" % "scalatest" % "1.2" % "test->compile"
This says that your project's ``test`` configuration uses
``ScalaTest``'s ``compile`` configuration. See the `Ivy
documentation <http://ant.apache.org/ivy/history/2.3.0-rc1/tutorial/conf.html>`_
for more advanced mappings. Most projects published to Maven
repositories will use the ``compile`` configuration.
A useful application of configurations is to group dependencies that are
not used on normal classpaths. For example, your project might use a
``"js"`` configuration to automatically download jQuery and then include
it in your jar by modifying ``resources``. For example:
::
ivyConfigurations += config("js") hide
libraryDependencies += "jquery" % "jquery" % "1.3.2" % "js->default" from "http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"
resources ++= update.value.select( configurationFilter("js") )
The ``config`` method defines a new configuration with name ``"js"`` and
makes it private to the project so that it is not used for publishing.
See :doc:`/Detailed-Topics/Update-Report` for more information on selecting managed
artifacts.
A configuration without a mapping (no ``"->"``) is mapped to ``default``
or ``compile``. The ``->`` is only needed when mapping to a different
configuration than those. The ScalaTest dependency above can then be
shortened to:
::
libraryDependencies += "org.scala-tools.testing" % "scalatest" % "1.0" % "test"
.. _external-maven-ivy:
Maven/Ivy
---------

View File

@ -11,7 +11,7 @@ Example:
::
scalaHome := Some(file("/path/to/scala"))``
scalaHome := Some(file("/path/to/scala"))
Using a local Scala version will override the ``scalaVersion`` setting
and will not work with :doc:`cross building <Cross-Build>`.

View File

@ -26,7 +26,7 @@ declaring it as a :doc:`managed dependency <Library-Management>`:
libraryDependencies += "org.scala-tools.testing" %% "scalacheck" % "1.9" % "test"
The fourth component ``"test"`` is the :doc:`configuration </Dormant/Configurations>`
The fourth component ``"test"`` is the :ref:`configuration <gsg-ivy-configurations>`
and means that ScalaCheck will only be on the test classpath and it
isn't needed by the main sources. This is generally good practice for
libraries because your users don't typically need your test dependencies

View File

@ -1,79 +0,0 @@
==============
Configurations
==============
*Wiki Maintenance Note:* Most of what's on this page is now covered in
:doc:`/Getting-Started/Library-Dependencies`. This page should be analyzed
for any points that aren't covered on the new page, and those points
moved somewhere (maybe the :doc:`/faq` or an "advanced library deps" page).
Then this page could become a redirect with no content except a link
pointing to the new page(s).
*Wiki Maintenance Note 2:* There probably should be a page called
Configurations that's less about library dependency management and more
about listing all the configurations that exist and describing what they
are used for. This would complement the way this page is linked, for
example in :doc:`/Name-Index`.
Configurations
==============
Ivy configurations are a useful feature for your build when you use
managed dependencies. They are essentially named sets of dependencies.
You can read the `Ivy
documentation <http://ant.apache.org/ivy/history/2.3.0-rc1/tutorial/conf.html>`_
for details. Their use in sbt is described on this page.
Usage
=====
The built-in use of configurations in sbt is similar to scopes in Maven.
sbt adds dependencies to different classpaths by the configuration that
they are defined in. See the description of `Maven
Scopes <http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope>`_
for details.
You put a dependency in a configuration by selecting one or more of its
configurations to map to one or more of your project's configurations.
The most common case is to have one of your configurations ``A`` use a
dependency's configuration ``B``. The mapping for this looks like
``"A->B"``. To apply this mapping to a dependency, add it to the end of
your dependency definition:
::
libraryDependencies += "org.scalatest" % "scalatest" % "1.2" % "test->compile"
This says that your project's ``test`` configuration uses
``ScalaTest``'s ``default`` configuration. Again, see the `Ivy
documentation <http://ant.apache.org/ivy/history/2.3.0-rc1/tutorial/conf.html>`_
for more advanced mappings. Most projects published to Maven
repositories will use the ``default`` or ``compile`` configuration.
A useful application of configurations is to group dependencies that are
not used on normal classpaths. For example, your project might use a
``"js"`` configuration to automatically download jQuery and then include
it in your jar by modifying ``resources``. For example:
::
ivyConfigurations += config("js") hide
libraryDependencies += "jquery" % "jquery" % "1.3.2" % "js->default" from "http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"
resources ++= update.value.select( configurationFilter("js") )
The ``config`` method defines a new configuration with name ``"js"`` and
makes it private to the project so that it is not used for publishing.
See :doc:`/Detailed-Topics/Update-Report` for more information on selecting managed
artifacts.
A configuration without a mapping (no ``"->"``) is mapped to ``default``
or ``compile``. The ``->`` is only needed when mapping to a different
configuration than those. The ScalaTest dependency above can then be
shortened to:
::
libraryDependencies += "org.scala-tools.testing" % "scalatest" % "1.0" % "test"

View File

@ -210,6 +210,8 @@ ones added by your build definition.
Therefore, to change or remove the default resolvers, you would need to
override ``externalResolvers`` instead of ``resolvers``.
.. _gsg-ivy-configurations:
Per-configuration dependencies
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -28,8 +28,8 @@ Dependency Management
- A
`Configuration <../api/sbt/Configuration.html>`_
is a useful Ivy construct for grouping dependencies. See
:doc:`/Dormant/Configurations`. It is also used for :doc:`scoping settings </Getting-Started/Scopes>`.
- ``Compile``, ``Test``, ``Runtime``, ``Provided``, and ``Optional`` are predefined :doc:`/Dormant/Configurations`.
:ref:`ivy-configurations`. It is also used for :doc:`scoping settings </Getting-Started/Scopes>`.
- ``Compile``, ``Test``, ``Runtime``, ``Provided``, and ``Optional`` are predefined :ref:`configurations <ivy-configurations>`.
Settings and Tasks
~~~~~~~~~~~~~~~~~~

View File

@ -462,7 +462,7 @@ Tool dependencies are used to implement a task and are not needed by
project source code. These dependencies can be declared in their own
configuration and classpaths. These are the steps:
1. Define a new :doc:`configuration </Dormant/Configurations>`.
1. Define a new :ref:`configuration <ivy-configurations>`.
2. Declare the tool :doc:`dependencies </Detailed-Topics/Library-Management>` in that
configuration.
3. Define a classpath that pulls the dependencies from the :doc:`/Detailed-Topics/Update-Report` produced by ``update``.