@@ -2,6 +2,8 @@ import sbt._
2
2
import sbt .Keys ._
3
3
4
4
import com .typesafe .sbt .SbtNativePackager ._
5
+ import com .typesafe .sbt .packager .MappingsHelper ._
6
+ import com .typesafe .sbt .packager .universal .UniversalPlugin .autoImport .useNativeZip
5
7
import com .typesafe .sbt .packager .Keys ._
6
8
7
9
import com .typesafe .sbt .S3Plugin .S3 .upload
@@ -42,7 +44,6 @@ object ScalaDist {
42
44
)
43
45
44
46
def settings : Seq [Setting [_]] =
45
- packagerSettings ++
46
47
useNativeZip ++ // use native zip to preserve +x permission on scripts
47
48
Seq (
48
49
name := " scala" ,
@@ -74,19 +75,16 @@ object ScalaDist {
74
75
case " scala-dist" =>
75
76
val tmpdir = IO .createTemporaryDirectory
76
77
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)
83
78
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 {
84
83
// 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" ) =>
86
85
file.setExecutable(true , true )
87
-
88
- if (relative startsWith " META-INF" ) Seq ()
89
- else Seq (file -> relative)
86
+ file -> dest
87
+ case mapping => mapping
90
88
}
91
89
92
90
// core jars: use simple name for backwards compat
0 commit comments