Skip to content

Commit 07c4270

Browse files
committed
Revert "FIX #141 Upgrading to native-packager 1.0.4 and autoplugins"
This reverts commit 1da1582 because it doesn't work on Windows; see #142 for discussion.
1 parent 6b3dd49 commit 07c4270

File tree

4 files changed

+13
-15
lines changed

4 files changed

+13
-15
lines changed

build.sbt

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

2424
ScalaDist.platformSettings
2525

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

project/ScalaDist.scala

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ 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
75
import com.typesafe.sbt.packager.Keys._
86

97
import com.typesafe.sbt.S3Plugin.S3.upload
@@ -44,6 +42,7 @@ object ScalaDist {
4442
)
4543

4644
def settings: Seq[Setting[_]] =
45+
packagerSettings ++
4746
useNativeZip ++ // use native zip to preserve +x permission on scripts
4847
Seq(
4948
name := "scala",
@@ -75,16 +74,19 @@ object ScalaDist {
7574
case "scala-dist" =>
7675
val tmpdir = IO.createTemporaryDirectory
7776
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)
7883

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 {
8384
// make unix scripts executable (heuristically...)
84-
case (file, dest) if (dest startsWith "bin/") && !(dest endsWith ".bat") =>
85+
if ((relative startsWith "bin/") && !(file.getName endsWith ".bat"))
8586
file.setExecutable(true, true)
86-
file -> dest
87-
case mapping => mapping
87+
88+
if (relative startsWith "META-INF") Seq()
89+
else Seq(file -> relative)
8890
}
8991

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

project/Unix.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ 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
87

98
/** Create debian & rpm packages.
109
*
@@ -97,6 +96,5 @@ object Unix {
9796

9897
// Hack so we use regular version, rather than debian version.
9998
target in Debian := target.value / s"${(name in Debian).value}-${version.value}"
100-
10199
)
102100
}

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" % "1.0.4")
1+
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "0.6.4")
22

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

0 commit comments

Comments
 (0)