@@ -12,10 +12,12 @@ import com.amazonaws.services.s3.model.PutObjectResult
1212object ScalaDist {
1313 val upload = TaskKey [Seq [PutObjectResult ]](" s3-upload" ," Uploads files to an S3 bucket." )
1414
15- def createMappingsWith (deps : Seq [(String , ModuleID , Artifact , File )],
15+ def createMappingsWith (deps : Seq [(sbt.librarymanagement. ConfigRef , ModuleID , Artifact , File )],
1616 distMappingGen : (ModuleID , Artifact , File ) => Seq [(File , String )]): Seq [(File , String )] =
1717 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)
1921 case _ => Seq ()
2022 }
2123
@@ -29,22 +31,22 @@ object ScalaDist {
2931 // s3-upload thus depends on the package tasks listed below
3032 def platformSettings =
3133 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)
3335 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,
4042 // 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
4244 // method) includes the debian version and arch information,
4345 // which we historically have not included. I don't see a way to
4446 // 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 "
4850 }.value
4951 )
5052
@@ -57,31 +59,32 @@ object ScalaDist {
5759 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." ,
5860 crossPaths := false ,
5961
60- ivyConfigurations += config( ScalaDistConfig ) ,
62+ ivyConfigurations += ScalaDistConfig ,
6163 libraryDependencies += scalaDistDep(version.value, " runtime" ),
6264
6365 // create lib directory by resolving scala-dist's dependencies
6466 // 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),
6668
67- // work around regression in sbt -native-packager 1.0.5 where
69+ // work around sbt / regression -native-packager 1.0.5 where
6870 // 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" )
7274
7375 )
7476
7577 // private lazy val onWindows = System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("windows")
7678 // only used for small batch files, normalize line endings in-place
7779 // private def toDosInPlace(f: File) = IO.writeLines(file, IO.readLines(file))
7880
79- private lazy val ScalaDistConfig = " scala-dist"
81+ private lazy val ScalaDistConfigName = " scala-dist"
82+ private lazy val ScalaDistConfig = config(ScalaDistConfigName )
8083 // segregate scala-dist's compile dependencies into the scala-dist config
8184 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}"
8386
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)
8588 private def universalMappings (id : ModuleID , artifact : Artifact , file : File ): Seq [(File , String )] = id.name match {
8689 // scala-dist: explode (drop META-INF/)
8790 case " scala-dist" =>
@@ -90,7 +93,7 @@ object ScalaDist {
9093
9194 // create mappings from the unzip scala-dist zip
9295 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" ))
9497 } map {
9598 // make unix scripts executable (heuristically...)
9699 case (file, dest) if (dest startsWith " bin/" ) && ! (dest endsWith " .bat" ) =>
0 commit comments