Skip to content

Commit 253c5bc

Browse files
authored
remove sbt 0.12 operators from documentation (#1350)
1 parent f4e0078 commit 253c5bc

File tree

1 file changed

+18
-23
lines changed

1 file changed

+18
-23
lines changed

src/sphinx/formats/universal.rst

+18-23
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ Here is how the values for ``name`` and ``packageName`` are used by the three co
9090
9191
name in Universal := name.value
9292
93-
name in UniversalDocs <<= name in Universal
93+
name in UniversalDocs := (name in Universal).value
9494
95-
name in UniversalSrc <<= name in Universal
95+
name in UniversalSrc := (name in Universal).value
9696
9797
packageName in Universal := packageName.value
9898
@@ -103,15 +103,15 @@ specify the desired mappings for a given configuration. For example:
103103

104104
.. code-block:: scala
105105
106-
mappings in Universal <+= packageBin in Compile map { p => p -> "lib/foo.jar" }
106+
mappings in Universal += (packageBin in Compile).value -> "lib/foo.jar"
107107
108108
However, sometimes it may be advantageous to customize the files for each archive separately. For example, perhaps
109109
the .tar.gz has an additional README plaintext file in addition to a README.html. To add this just to the .tar.gz file,
110110
use the task-scope feature of sbt:
111111

112112
.. code-block:: scala
113113
114-
mappings in Universal in package-zip-tarball += file("README") -> "README"
114+
mappings in Universal in packageZipTarball += file("README") -> "README"
115115
116116
Besides ``mappings``, the ``name``, ``sourceDirectory`` and ``target`` configurations are all respected by universal packaging.
117117

@@ -186,7 +186,8 @@ look at an example where we add the packaged jar of a project to the lib folder
186186

187187
.. code-block:: scala
188188
189-
mappings in Universal <+= (packageBin in Compile) map { jar =>
189+
mappings in Universal += {
190+
val jar = (packageBin in Compile).value
190191
jar -> ("lib/" + jar.getName)
191192
}
192193
@@ -277,11 +278,10 @@ changelog in addition to the generic packaging by first defining a changelog in
277278

278279
.. code-block:: scala
279280
280-
linuxPackageMappings in Debian <+= (name in Universal, sourceDirectory in Debian) map { (name, dir) =>
281+
linuxPackageMappings in Debian +=
281282
(packageMapping(
282-
(dir / "changelog") -> "/usr/share/doc/sbt/changelog.gz"
283+
((sourceDirectory in Debian).value / "changelog") -> "/usr/share/doc/sbt/changelog.gz"
283284
) withUser "root" withGroup "root" withPerms "0644" gzipped) asDocs()
284-
}
285285
286286
Notice how we're *only* modifying the package mappings for Debian linux packages.
287287

@@ -355,10 +355,10 @@ You get a set of methods which will help you to create mappings very easily.
355355
mappings in Universal ++= directory("src/main/resources/cache")
356356
357357
mappings in Universal ++= contentOf("src/main/resources/docs")
358+
359+
mappings in Universal ++= directory(sourceDirectory.value / "main" / "resources" / "cache")
358360
359-
mappings in Universal <++= sourceDirectory map (src => directory(src / "main" / "resources" / "cache"))
360-
361-
mappings in Universal <++= sourceDirectory map (src => contentOf(src / "main" / "resources" / "docs"))
361+
mappings in Universal ++= contentOf(sourceDirectory.value / "main" / "resources" / "docs")
362362
363363
364364
.. _MappingsHelper: http://www.scala-sbt.org/sbt-native-packager/latest/api/#com.typesafe.sbt.packager.MappingsHelper$
@@ -391,18 +391,17 @@ If you want to add everything in a directory where the path for the directory is
391391

392392
.. code-block:: scala
393393
394-
mappings in Universal := (mappings in Universal).value ++ directory(target.value / "scala-2.10" / "api")
395-
}
394+
(mappings in Universal) ~= (_ ++ directory(target.value / "scala-2.10" / "api"))
396395
397396
398397
399398
You can also use the following approach if, for example, you need more flexibility:
400399

401400
.. code-block:: scala
402401
403-
mappings in Universal <++= (packageBin in Compile, target ) map { (_, target) =>
404-
val dir = target / "scala-2.10" / "api"
405-
(dir.***) pair relativeTo(dir.getParentFile)
402+
(mappings in Universal) ++= {
403+
val dir = target.value / "scala-2.10" / "api"
404+
(dir ** AllPassFilter) pair relativeTo(dir.getParentFile)
406405
}
407406
408407
Here is what happens in this code:
@@ -453,9 +452,9 @@ Mapping the content of a directory (excluding the directory itself)
453452

454453
.. code-block:: scala
455454
456-
mappings in Universal <++= (packageBin in Compile, target ) map { (_, target) =>
457-
val dir = target / "scala-2.10" / "api"
458-
(dir.*** --- dir) pair relativeTo(dir)
455+
mappings in Universal ++= {
456+
val dir = target.value / "scala-2.10" / "api"
457+
(dir ** AllPassFilter --- dir) pair relativeTo(dir)
459458
}
460459
461460
The ``dir`` gets excluded and is used as root for ``relativeTo(dir)``.
@@ -489,10 +488,6 @@ tl;dr how to remove stuff
489488
filtered :+ (fatJar -> ("lib/" + fatJar.getName))
490489
}
491490
492-
// sbt 0.12 syntax
493-
mappings in Universal <<= (mappings in Universal, assembly in Compile) map { (universalMappings, fatJar) => /* same logic */}
494-
495-
496491
The complete ``build.sbt`` should contain these settings if you want a single assembled fat jar.
497492

498493
.. code-block:: scala

0 commit comments

Comments
 (0)