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