@@ -90,9 +90,9 @@ Here is how the values for ``name`` and ``packageName`` are used by the three co
90
90
91
91
name in Universal := name.value
92
92
93
- name in UniversalDocs <<= name in Universal
93
+ name in UniversalDocs := ( name in Universal).value
94
94
95
- name in UniversalSrc <<= name in Universal
95
+ name in UniversalSrc := ( name in Universal).value
96
96
97
97
packageName in Universal := packageName.value
98
98
@@ -103,15 +103,15 @@ specify the desired mappings for a given configuration. For example:
103
103
104
104
.. code-block :: scala
105
105
106
- mappings in Universal < += packageBin in Compile map { p => p -> "lib/foo.jar" }
106
+ mappings in Universal += ( packageBin in Compile).value -> "lib/foo.jar"
107
107
108
108
However, sometimes it may be advantageous to customize the files for each archive separately. For example, perhaps
109
109
the .tar.gz has an additional README plaintext file in addition to a README.html. To add this just to the .tar.gz file,
110
110
use the task-scope feature of sbt:
111
111
112
112
.. code-block :: scala
113
113
114
- mappings in Universal in package-zip-tarball += file("README") -> "README"
114
+ mappings in Universal in packageZipTarball += file("README") -> "README"
115
115
116
116
Besides ``mappings ``, the ``name ``, ``sourceDirectory `` and ``target `` configurations are all respected by universal packaging.
117
117
@@ -186,7 +186,8 @@ look at an example where we add the packaged jar of a project to the lib folder
186
186
187
187
.. code-block :: scala
188
188
189
- mappings in Universal <+= (packageBin in Compile) map { jar =>
189
+ mappings in Universal += {
190
+ val jar = (packageBin in Compile).value
190
191
jar -> ("lib/" + jar.getName)
191
192
}
192
193
@@ -277,11 +278,10 @@ changelog in addition to the generic packaging by first defining a changelog in
277
278
278
279
.. code-block :: scala
279
280
280
- linuxPackageMappings in Debian <+= (name in Universal, sourceDirectory in Debian) map { (name, dir) =>
281
+ linuxPackageMappings in Debian +=
281
282
(packageMapping(
282
- (dir / "changelog") -> "/usr/share/doc/sbt/changelog.gz"
283
+ ((sourceDirectory in Debian).value / "changelog") -> "/usr/share/doc/sbt/changelog.gz"
283
284
) withUser "root" withGroup "root" withPerms "0644" gzipped) asDocs()
284
- }
285
285
286
286
Notice how we're *only * modifying the package mappings for Debian linux packages.
287
287
@@ -355,10 +355,10 @@ You get a set of methods which will help you to create mappings very easily.
355
355
mappings in Universal ++= directory("src/main/resources/cache")
356
356
357
357
mappings in Universal ++= contentOf("src/main/resources/docs")
358
+
359
+ mappings in Universal ++= directory(sourceDirectory.value / "main" / "resources" / "cache")
358
360
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")
362
362
363
363
364
364
.. _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
391
391
392
392
.. code-block :: scala
393
393
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"))
396
395
397
396
398
397
399
398
You can also use the following approach if, for example, you need more flexibility:
400
399
401
400
.. code-block :: scala
402
401
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)
406
405
}
407
406
408
407
Here is what happens in this code:
@@ -453,9 +452,9 @@ Mapping the content of a directory (excluding the directory itself)
453
452
454
453
.. code-block :: scala
455
454
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)
459
458
}
460
459
461
460
The ``dir `` gets excluded and is used as root for ``relativeTo(dir) ``.
@@ -489,10 +488,6 @@ tl;dr how to remove stuff
489
488
filtered :+ (fatJar -> ("lib/" + fatJar.getName))
490
489
}
491
490
492
- // sbt 0.12 syntax
493
- mappings in Universal <<= (mappings in Universal, assembly in Compile) map { (universalMappings, fatJar) => /* same logic */}
494
-
495
-
496
491
The complete ``build.sbt `` should contain these settings if you want a single assembled fat jar.
497
492
498
493
.. code-block :: scala
0 commit comments