@@ -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
@@ -40,18 +38,11 @@ object ScalaDist {
40
38
mappings in upload += uploadMapping(packageZipTarball in UniversalDocs ).value,
41
39
mappings in upload += uploadMapping(packageXzTarball in UniversalDocs ).value,
42
40
mappings in upload += uploadMapping(packageBin in Rpm ).value,
43
- // Debian needs special handling because the value sbt-native-packager
44
- // gives us for `packageBin in Debian` (coming from the archiveFilename
45
- // method) includes the debian version and arch information,
46
- // which we historically have not included. I don't see a way to
47
- // override the filename on disk, so we re-map at upload time
48
- mappings in upload += Def .task {
49
- (packageBin in Debian ).value ->
50
- s " scala/ ${version.value}/ ${(name in Debian ).value}- ${version.value}.deb "
51
- }.value
41
+ mappings in upload += uploadMapping(packageBin in Debian ).value
52
42
)
53
43
54
44
def settings : Seq [Setting [_]] =
45
+ packagerSettings ++
55
46
useNativeZip ++ // use native zip to preserve +x permission on scripts
56
47
Seq (
57
48
name := " scala" ,
@@ -65,13 +56,7 @@ object ScalaDist {
65
56
66
57
// create lib directory by resolving scala-dist's dependencies
67
58
// to populate the rest of the distribution, explode scala-dist artifact itself
68
- mappings in Universal ++= createMappingsWith(update.value.toSeq, universalMappings),
69
-
70
- // work around regression in sbt-native-packager 1.0.5 where
71
- // these tasks invoke `tar` without any flags at all
72
- universalArchiveOptions in (UniversalDocs , packageZipTarball) := Seq (" --force-local" , " -pcvf" ),
73
- universalArchiveOptions in (UniversalDocs , packageXzTarball ) := Seq (" --force-local" , " -pcvf" )
74
-
59
+ mappings in Universal ++= createMappingsWith(update.value.toSeq, universalMappings)
75
60
)
76
61
77
62
// private lazy val onWindows = System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("windows")
@@ -89,16 +74,19 @@ object ScalaDist {
89
74
case " scala-dist" =>
90
75
val tmpdir = IO .createTemporaryDirectory
91
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)
92
83
93
- // create mappings from the unzip scala-dist zip
94
- contentOf(tmpdir) filter {
95
- case (file, dest) => ! (dest.endsWith(" MANIFEST.MF" ) || dest.endsWith(" META-INF" ))
96
- } map {
97
84
// make unix scripts executable (heuristically...)
98
- case (file, dest) if (dest startsWith " bin/" ) && ! (dest endsWith " .bat" ) =>
85
+ if ((relative startsWith " bin/" ) && ! (file.getName endsWith " .bat" ))
99
86
file.setExecutable(true , true )
100
- file -> dest
101
- case mapping => mapping
87
+
88
+ if (relative startsWith " META-INF" ) Seq ()
89
+ else Seq (file -> relative)
102
90
}
103
91
104
92
// core jars: use simple name for backwards compat
0 commit comments