Skip to content

Commit 0f8c7a0

Browse files
committed
FIX #141 Upgrading to native-packager 1.0.4 and autoplugins
1 parent 282f468 commit 0f8c7a0

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

build.sbt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Docs.settings
2323

2424
ScalaDist.platformSettings
2525

26+
enablePlugins(UniversalPlugin, RpmPlugin, JDebPackaging, WindowsPlugin)
27+
2628
// resolvers += "local" at "file:///e:/.m2/repository"
2729
// resolvers += Resolver.mavenLocal
28-
// to test, run e.g., stage, or windows:packageBin, show s3-upload::mappings
30+
// to test, run e.g., stage, or windows:packageBin, show s3-upload::mappings

project/ScalaDist.scala

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import sbt._
22
import sbt.Keys._
33

44
import com.typesafe.sbt.SbtNativePackager._
5+
import com.typesafe.sbt.packager.MappingsHelper._
6+
import com.typesafe.sbt.packager.universal.UniversalPlugin.autoImport.useNativeZip
57
import com.typesafe.sbt.packager.Keys._
68

79
import com.typesafe.sbt.S3Plugin.S3.upload
@@ -42,7 +44,6 @@ object ScalaDist {
4244
)
4345

4446
def settings: Seq[Setting[_]] =
45-
packagerSettings ++
4647
useNativeZip ++ // use native zip to preserve +x permission on scripts
4748
Seq(
4849
name := "scala",
@@ -74,19 +75,16 @@ object ScalaDist {
7475
case "scala-dist" =>
7576
val tmpdir = IO.createTemporaryDirectory
7677
IO.unzip(file, tmpdir)
77-
// IO.listFiles(tmpdir) does not recurse, use ** with glob "*" to find all files
78-
(PathFinder(IO.listFiles(tmpdir)) ** "*").get flatMap { file =>
79-
val relative = IO.relativize(tmpdir, file).get // .get is safe because we just unzipped under tmpdir
80-
81-
// files are stored in repository with platform-appropriate line endings
82-
// if (onWindows && (relative endsWith ".bat")) toDosInPlace(file)
8378

79+
// create mappings from the unzip scala-dist zip
80+
contentOf(tmpdir) filter {
81+
case (file, dest) => !(dest.endsWith("MANIFEST.MF") || dest.endsWith("META-INF"))
82+
} map {
8483
// make unix scripts executable (heuristically...)
85-
if ((relative startsWith "bin/") && !(file.getName endsWith ".bat"))
84+
case (file, dest) if (dest startsWith "bin/") && !(dest endsWith ".bat") =>
8685
file.setExecutable(true, true)
87-
88-
if (relative startsWith "META-INF") Seq()
89-
else Seq(file -> relative)
86+
file -> dest
87+
case mapping => mapping
9088
}
9189

9290
// core jars: use simple name for backwards compat

project/Unix.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import sbt.Keys._
44
import com.typesafe.sbt.SbtNativePackager._
55
import com.typesafe.sbt.packager.Keys._
66
import com.typesafe.sbt.packager.linux.{LinuxPackageMapping => pkgMap, LinuxSymlink}
7+
import com.typesafe.sbt.packager.linux.LinuxPlugin.autoImport.packageMapping
78

89
/** Create debian & rpm packages.
910
*
@@ -96,5 +97,6 @@ object Unix {
9697

9798
// Hack so we use regular version, rather than debian version.
9899
target in Debian := target.value / s"${(name in Debian).value}-${version.value}"
100+
99101
)
100102
}

project/plugins.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "0.6.4")
1+
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.4")
22

33
addSbtPlugin("com.typesafe.sbt" % "sbt-s3" % "0.8")
44

0 commit comments

Comments
 (0)