-
Notifications
You must be signed in to change notification settings - Fork 446
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
Adding documentation how to map directories #160
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -142,6 +142,40 @@ Besides ``mappings``, the ``name``, ``sourceDirectory`` and ``target`` configura | |
|
||
**Note: The Universal plugin will make anything in a bin/ directory executable. This is to work around issues with JVM and file system manipulations.** | ||
|
||
Mapping Examples | ||
---------------- | ||
SBT provides and IO and .. Path: http://www.scala-sbt.org/0.13.1/docs/Detailed-Topics/Paths.html API, which | ||
lets you define custom mappings easily. The files will appear in the generate universal zip, but also in your | ||
debian/rpm/msi/dmg builds as described above in the conventions. | ||
|
||
The ``packageBin in Compile`` dependency is only needed, if your files get generated | ||
during the ``packageBin`` command or before. For static files you can remove it. | ||
|
||
Mapping a complete directory. | ||
|
||
.. code-block:: scala | ||
|
||
mappings in Universal <++= (packageBin in Compile, target ) map { (_, target) => | ||
val dir = target / "scala-2.10" / "api" | ||
(dir.***) pair relativeTo(dir.getParentFile) | ||
} | ||
|
||
This maps the ``api`` folder directly to the generate universal zip. ``dir.***`` is a short way for | ||
``dir ** "*"``, which means _select all files including dir_. ``relativeTo(dir.getParentFile)`` | ||
generates a function with a ``file -> Option[String]`` mapping, which tries to generate a relative | ||
string path from ``dir.getParentFile`` to the passed in file. ``pair`` uses the ``relativeTo`` | ||
function to generate a mapping ``File -> String``, which is _your file_ to _relative destination_. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A bit terse as I read through it (which mirrors the general sbt docs right now). I wonder if we need to dig into the syntax one bit at time for folks or not.... Still this is WAY better than having nothing, and a really really good start. Great examples. |
||
|
||
Mapping the content of a directory. | ||
|
||
.. code-block:: scala | ||
|
||
mappings in Universal <++= (packageBin in Compile, target ) map { (_, target) => | ||
val dir = target / "scala-2.10" / "api" | ||
(dir.*** --- dir) pair relativeTo(dir) | ||
} | ||
|
||
The ``dir`` gets excluded and is used as root for ``relativeTo(dir)``. | ||
|
||
Commands | ||
-------- | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/and/an/
.. ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OH, .. is the link syntax noise from sphinx. Right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep ;) is markdown an option? Would be more readable on github too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not if we use sphinx. Right now all the "verison-specific" website hooks we've created are sphinx-specific, if we want to copy that out of the sbt build itself. Otherwise, Markdown would be nice :)