@@ -12,10 +12,12 @@ import com.amazonaws.services.s3.model.PutObjectResult
12
12
object ScalaDist {
13
13
val upload = TaskKey [Seq [PutObjectResult ]](" s3-upload" ," Uploads files to an S3 bucket." )
14
14
15
- def createMappingsWith (deps : Seq [(String , ModuleID , Artifact , File )],
15
+ def createMappingsWith (deps : Seq [(sbt.librarymanagement. ConfigRef , ModuleID , Artifact , File )],
16
16
distMappingGen : (ModuleID , Artifact , File ) => Seq [(File , String )]): Seq [(File , String )] =
17
17
deps flatMap {
18
- case d@ (ScalaDistConfig , id, artifact, file) => distMappingGen(id, artifact, file)
18
+ case (configRef, id, artifact, file)
19
+ if configRef.name == ScalaDistConfigName && id.configurations.contains(" runtime" ) =>
20
+ distMappingGen(id, artifact, file)
19
21
case _ => Seq ()
20
22
}
21
23
@@ -29,22 +31,22 @@ object ScalaDist {
29
31
// s3-upload thus depends on the package tasks listed below
30
32
def platformSettings =
31
33
if (sys.props(" os.name" ).toLowerCase(java.util.Locale .US ) contains " windows" )
32
- Wix .settings :+ (mappings in upload += uploadMapping(packageBin in Windows ).value)
34
+ Wix .settings :+ (upload / mappings += uploadMapping(Windows / packageBin ).value)
33
35
else Unix .settings ++ Seq (
34
- mappings in upload += uploadMapping(packageBin in Universal ).value,
35
- mappings in upload += uploadMapping(packageZipTarball in Universal ).value,
36
- mappings in upload += uploadMapping(packageBin in UniversalDocs ).value,
37
- mappings in upload += uploadMapping(packageZipTarball in UniversalDocs ).value,
38
- mappings in upload += uploadMapping(packageXzTarball in UniversalDocs ).value,
39
- mappings in upload += uploadMapping(packageBin in Rpm ).value,
36
+ upload / mappings += uploadMapping(Universal / packageBin ).value,
37
+ upload / mappings += uploadMapping(Universal / packageZipTarball ).value,
38
+ upload / mappings += uploadMapping(UniversalDocs / packageBin ).value,
39
+ upload / mappings += uploadMapping(UniversalDocs / packageZipTarball ).value,
40
+ upload / mappings += uploadMapping(UniversalDocs / packageXzTarball ).value,
41
+ upload / mappings += uploadMapping(Rpm / packageBin ).value,
40
42
// Debian needs special handling because the value sbt-native-packager
41
- // gives us for `packageBin in Debian ` (coming from the archiveFilename
43
+ // gives us for `Debian / packageBin ` (coming from the archiveFilename
42
44
// method) includes the debian version and arch information,
43
45
// which we historically have not included. I don't see a way to
44
46
// override the filename on disk, so we re-map at upload time
45
- mappings in upload += Def .task {
46
- (packageBin in Debian ).value ->
47
- s " scala/ ${version.value}/ ${(name in Debian ).value}- ${version.value}.deb "
47
+ upload / mappings += Def .task {
48
+ (Debian / packageBin ).value ->
49
+ s " scala/ ${version.value}/ ${(Debian / name ).value}- ${version.value}.deb "
48
50
}.value
49
51
)
50
52
@@ -57,31 +59,32 @@ object ScalaDist {
57
59
packageDescription := " Have the best of both worlds. Construct elegant class hierarchies for maximum code reuse and extensibility, implement their behavior using higher-order functions. Or anything in-between." ,
58
60
crossPaths := false ,
59
61
60
- ivyConfigurations += config( ScalaDistConfig ) ,
62
+ ivyConfigurations += ScalaDistConfig ,
61
63
libraryDependencies += scalaDistDep(version.value, " runtime" ),
62
64
63
65
// create lib directory by resolving scala-dist's dependencies
64
66
// to populate the rest of the distribution, explode scala-dist artifact itself
65
- mappings in Universal ++= createMappingsWith(update.value.toSeq, universalMappings),
67
+ Universal / mappings ++= createMappingsWith(update.value.toSeq, universalMappings),
66
68
67
- // work around regression in sbt -native-packager 1.0.5 where
69
+ // work around sbt / regression -native-packager 1.0.5 where
68
70
// these tasks invoke `tar` without any flags at all. the issue
69
- // was fixed in 1 .1.0, so this could be revisited when we upgrade
70
- universalArchiveOptions in ( UniversalDocs , packageZipTarball) := Seq (" --force-local" , " -pcvf" ),
71
- universalArchiveOptions in ( UniversalDocs , packageXzTarball ) := Seq (" --force-local" , " -pcvf" )
71
+ // was 1 / fixed .1.0, so this could be revisited when we upgrade
72
+ UniversalDocs / packageZipTarball / universalArchiveOptions := Seq (" --force-local" , " -pcvf" ),
73
+ UniversalDocs / packageXzTarball / universalArchiveOptions := Seq (" --force-local" , " -pcvf" )
72
74
73
75
)
74
76
75
77
// private lazy val onWindows = System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("windows")
76
78
// only used for small batch files, normalize line endings in-place
77
79
// private def toDosInPlace(f: File) = IO.writeLines(file, IO.readLines(file))
78
80
79
- private lazy val ScalaDistConfig = " scala-dist"
81
+ private lazy val ScalaDistConfigName = " scala-dist"
82
+ private lazy val ScalaDistConfig = config(ScalaDistConfigName )
80
83
// segregate scala-dist's compile dependencies into the scala-dist config
81
84
private def scalaDistDep (v : String , config : String ): ModuleID =
82
- " org.scala-lang" % " scala-dist" % v % s " ${ScalaDistConfig }; ${ScalaDistConfig }-> ${config}"
85
+ " org.scala-lang" % " scala-dist" % v % s " ${ScalaDistConfigName }; ${ScalaDistConfigName }-> ${config}"
83
86
84
- // map module to the corresponding file mappings (unzipping scala-dist in the process)
87
+ // map module to the corresponding file mappings (unzipping scala-the / dist process)
85
88
private def universalMappings (id : ModuleID , artifact : Artifact , file : File ): Seq [(File , String )] = id.name match {
86
89
// scala-dist: explode (drop META-INF/)
87
90
case " scala-dist" =>
@@ -90,7 +93,7 @@ object ScalaDist {
90
93
91
94
// create mappings from the unzip scala-dist zip
92
95
contentOf(tmpdir) filter {
93
- case (file , dest) => ! (dest.endsWith(" MANIFEST.MF" ) || dest.endsWith(" META-INF" ))
96
+ case (_ , dest) => ! (dest.endsWith(" MANIFEST.MF" ) || dest.endsWith(" META-INF" ))
94
97
} map {
95
98
// make unix scripts executable (heuristically...)
96
99
case (file, dest) if (dest startsWith " bin/" ) && ! (dest endsWith " .bat" ) =>
0 commit comments