Skip to content

Commit cd61713

Browse files
committed
Update SBT and plugins to latest versions
1 parent 41cc2df commit cd61713

10 files changed

+75
-71
lines changed

admin/build.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ if ($env:APPVEYOR_FORCED_BUILD -eq 'true') {
4949
clearIvyCache
5050
# By default, test building the packages (but don't uplaod)
5151
# Need to redirect stderr, otherwise any error output (like jvm warning) fails the build (ErrorActionPreference)
52-
& cmd /c "sbt ""-Dproject.version=$env:version"" ""show s3Upload::mappings""" '2>&1'
52+
& cmd /c "sbt ""-Dproject.version=$env:version"" ""show s3Upload/mappings""" '2>&1'
5353
checkExit
5454
}

admin/build.sh

+2-4
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,8 @@ if [[ "$TRAVIS_EVENT_TYPE" == "api" ]]; then
104104
exit 1
105105
fi
106106
else
107-
# although this is the 2.13.x branch, we don't have any 2.13 scala-dist
108-
# artifacts to depend on yet. so for now, just keep using 2.12.4
109-
version="2.12.4"
107+
version="2.13.6"
110108
clearIvyCache
111109
# By default, test building the packages (but don't uplaod)
112-
sbt -Dproject.version=$version "show s3Upload::mappings"
110+
sbt -Dproject.version=$version "show s3Upload/mappings"
113111
fi

build.sbt

+12-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import com.typesafe.sbt.SbtGit._
21
import ScalaDist.upload
32

43
// so we don't require a native git install
@@ -16,11 +15,9 @@ Versioning.settings
1615
// are known/understood, at scala/scala-dist#171
1716
scalaVersion := version.value
1817

19-
mappings in upload := Seq()
18+
upload / mappings := Seq()
2019

2120
upload := {
22-
import com.amazonaws.{ClientConfiguration, Protocol}
23-
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain
2421
import com.amazonaws.services.s3.AmazonS3ClientBuilder
2522
import com.amazonaws.services.s3.model.PutObjectRequest
2623
import com.amazonaws.regions.Regions
@@ -29,8 +26,7 @@ upload := {
2926
val client = AmazonS3ClientBuilder.standard.withRegion(Regions.US_EAST_1).build
3027

3128
val log = streams.value.log
32-
33-
(mappings in upload).value map { case (file, key) =>
29+
(upload / mappings).value map { case (file, key) =>
3430
log.info("Uploading "+ file.getAbsolutePath() +" as "+ key)
3531
client.putObject(new PutObjectRequest("downloads.typesafe.com", key, file))
3632
}
@@ -44,6 +40,16 @@ ScalaDist.platformSettings
4440

4541
enablePlugins(UniversalPlugin, RpmPlugin, JDebPackaging, WindowsPlugin)
4642

43+
// TODO This silences a warning I don't understand.
44+
//
45+
// * scala-dist / Universal / configuration
46+
// +- /Users/jz/code/scala-dist/build.sbt:35
47+
// * scala-dist / Universal-docs / configuration
48+
// +- /Users/jz/code/scala-dist/build.sbt:35
49+
// * scala-dist / Universal-src / configuration
50+
// +- /Users/jz/code/scala-dist/build.sbt:35
51+
Global / excludeLintKeys += configuration
52+
4753
// resolvers += "local" at "file:///e:/.m2/repository"
4854
// resolvers += Resolver.mavenLocal
4955
// to test, run e.g., stage, or windows:packageBin, show s3Upload::mappings

project/Docs.scala

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ object Docs {
1616
import ScalaDist._
1717

1818
def settings: Seq[Setting[_]] = Seq(
19-
packageName in UniversalDocs := s"scala-docs-${version.value}",
19+
UniversalDocs / packageName := s"scala-docs-${version.value}",
2020
// libraryDependencies += scalaDistDep(version.value, "javadoc"), // seems not to be necessary
2121
// need updateClassifiers to get javadoc jars
22-
mappings in UniversalDocs ++= createMappingsWith(updateClassifiers.value.toSeq, universalDocsMappings)
22+
UniversalDocs / mappings ++= createMappingsWith(updateClassifiers.value.toSeq, universalDocsMappings)
2323
)
2424

2525
private def universalDocsMappings(id: ModuleID, artifact: Artifact, file: File): Seq[(File, String)] = {
2626
def includeJar = (file -> s"api/jars/${id.name}-${id.revision}-javadoc.jar")
27-
artifact match {
28-
case Artifact("scala-library" | "scala-reflect" | "scala-compiler", "doc", _, _, _, _, _) =>
27+
artifact.name match {
28+
case "scala-library" | "scala-reflect" | "scala-compiler" if artifact.`type` == "doc" =>
2929
val tmpdir = IO.createTemporaryDirectory
3030
IO.unzip(file, tmpdir)
3131
// IO.listFiles(tmpdir) does not recurse, use ** with glob "*" to find all files
@@ -35,7 +35,7 @@ object Docs {
3535
Seq(file -> s"api/${id.name}/$relative")
3636
}
3737
includeJar +: exploded
38-
case Artifact(_, "doc", _, _, _, _, _) =>
38+
case _ if artifact.`type` == "doc" =>
3939
Seq(includeJar)
4040
case _ => Seq()
4141
}

project/ScalaDist.scala

+26-23
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ import com.amazonaws.services.s3.model.PutObjectResult
1212
object 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") =>

project/Unix.scala

+12-12
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ object Unix {
2727
// symlinks for s"/usr/bin/$script" --> s"${installTargetUnix.value}/bin/$script"
2828
// TODO: reuse code from native packager
2929
linuxPackageSymlinks ++= (
30-
(mappings in Universal).value collect {
30+
(Universal / mappings).value collect {
3131
case (file, name) if (name startsWith "bin/") && !(name endsWith ".bat") =>
3232
LinuxSymlink("/usr/" + name, (installTargetUnix.value / name).getAbsolutePath)
3333
}
@@ -37,13 +37,13 @@ object Unix {
3737
def home(name: String) = (installTargetUnix.value / name).getAbsolutePath
3838
def docHome(name: String) = (installTargetUnixDocs.value / name).getAbsolutePath
3939

40-
val m = (mappings in Universal).value
40+
val m = (Universal / mappings).value
4141

4242
// some mappings need special treatment (different root, perms,...)
4343
val (special, regular) = m partition { case (file, name) =>
4444
(name startsWith "bin") || (name startsWith "doc") || (name startsWith "man")
4545
}
46-
val docs = (mappings in UniversalDocs).value
46+
val docs = (UniversalDocs / mappings).value
4747

4848
Seq(
4949
// no special treatment needed
@@ -59,38 +59,38 @@ object Unix {
5959
(pkgMap(
6060
(special collect { case (file, name) if name startsWith "doc/" => file -> docHome(name drop 4) }) ++
6161
(docs map { case (file, name) => file -> docHome(name) }) :+
62-
(((sourceDirectory in Linux).value / "copyright") -> docHome("copyright")))
62+
(((Linux / sourceDirectory).value / "copyright") -> docHome("copyright")))
6363
withPerms "0644").asDocs
6464
)
6565
},
6666

6767
// RPM Specific
68-
name in Rpm := "scala",
68+
Rpm / name := "scala",
6969
rpmVendor := "lightbend",
7070
rpmUrl := Some("http://github.com/scala/scala"),
7171
rpmLicense := Some("BSD"),
7272
rpmGroup := Some("Development/Languages"),
7373

7474
// This hack lets us ignore the RPM specific versioning junks.
75-
packageBin in Rpm := {
76-
val simplified = target.value / s"${(name in Rpm).value}-${version.value}.rpm"
75+
Rpm / packageBin := {
76+
val simplified = target.value / s"${(Rpm / name).value}-${version.value}.rpm"
7777

78-
val rpm = (packageBin in Rpm).value match {
78+
val rpm = (Rpm / packageBin).value match {
7979
case reported if reported.exists => reported
8080
case _ => // hack on top of hack because RpmHelper.buildRpm is broken on Mac -- `spec.meta.arch` doesn't necessarily match the arch `rpmbuild` decided on
81-
(PathFinder(IO.listFiles((target in Rpm).value)) ** "*.rpm").get.find(file =>
82-
file.getName contains (name in Rpm).value).get
81+
(PathFinder(IO.listFiles((Rpm / target).value)) ** "*.rpm").get.find(file =>
82+
file.getName contains (Rpm / name).value).get
8383
}
8484

8585
IO.copyFile(rpm, simplified)
8686
simplified
8787
},
8888

8989
// Debian Specific
90-
name in Debian := "scala",
90+
Debian / name := "scala",
9191
debianPackageDependencies += "java8-runtime-headless",
9292

93-
linuxPackageMappings in Debian += (packageMapping(
93+
Debian / linuxPackageMappings += (packageMapping(
9494
(sourceDirectory.value / "debian" / "changelog") -> "/usr/share/doc/scala/changelog.gz"
9595
).withUser("root").withGroup("root").withPerms("0644").gzipped).asDocs()
9696

project/Versioning.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import com.typesafe.sbt.SbtNativePackager.{Windows, Debian, Rpm}
55

66
object Versioning {
77
def settings: Seq[Setting[_]] = Seq(
8-
version in Windows := makeWindowsVersion(version.value),
9-
version in Debian := toDebianVersion((version in Windows).value),
10-
version in Rpm := toRpmVersion((version in Windows).value))
8+
Windows / version := makeWindowsVersion(version.value),
9+
Debian / version := toDebianVersion((Windows / version).value),
10+
Rpm / version := toRpmVersion((Windows / version).value))
1111

1212
private def rpmBuild(version:String): String = version split "\\." match {
1313
case Array(_,_,_, b) => b

project/Wix.scala

+7-7
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@ import WixHelper.{generateComponentsAndDirectoryXml, cleanFileName}
1111
object Wix {
1212
// Windows installer configuration
1313
def settings: Seq[Setting[_]] = Seq(
14-
mappings in Windows := (mappings in Universal).value,
15-
// distributionFiles in Windows += (packageMsi in Windows).value,
14+
Windows / mappings := (Universal / mappings).value,
15+
// Windows / distributionFiles += (Windows / packageMsi).value,
1616

1717
wixProductId := "7606e6da-e168-42b5-8345-b08bf774cb30",
1818
wixProductUpgradeId := "6061c134-67c7-4fb2-aff5-32b01a186968",
1919
// wixProductComments := "Scala Programming language for use in Windows.",
2020

21-
wixProductConfig := makeProductConfig((stagingDirectory in Universal).value, (stagingDirectory in UniversalDocs).value),
21+
wixProductConfig := makeProductConfig((Universal / stagingDirectory).value, (UniversalDocs / stagingDirectory).value),
2222
wixProductConfig := (wixProductConfig
23-
dependsOn (stage in Universal)
24-
dependsOn (stage in UniversalDocs)).value,
23+
dependsOn (Universal / stage)
24+
dependsOn (UniversalDocs / stage)).value,
2525

26-
packageBin in Windows := {
26+
Windows / packageBin := {
2727
val versioned = target.value / s"${name.value}-${version.value}.msi"
2828

29-
IO.copyFile((packageBin in Windows).value, versioned)
29+
IO.copyFile((Windows / packageBin).value, versioned)
3030
versioned
3131
}
3232
)

project/build.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=0.13.18
1+
sbt.version=1.5.4

project/plugins.sbt

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
scalacOptions ++= Seq("-deprecation", "-feature", "-Xlint")
1+
scalacOptions ++= Seq("-deprecation", "-feature", "-Xlint:_,-unused")
22

33
// jdeb and spotify docker are 'provided' in sbt-native-packager
4-
libraryDependencies += "org.vafer" % "jdeb" % "1.3" artifacts (Artifact("jdeb", "jar", "jar"))
5-
libraryDependencies += "com.spotify" % "docker-client" % "8.9.0"
6-
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.3")
4+
libraryDependencies += "org.vafer" % "jdeb" % "1.9" artifacts (Artifact("jdeb", "jar", "jar"))
5+
libraryDependencies += "com.spotify" % "docker-client" % "8.16.0"
6+
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.8.1")
77

8-
libraryDependencies += "com.amazonaws" % "aws-java-sdk-s3" % "1.11.277"
8+
libraryDependencies += "com.amazonaws" % "aws-java-sdk-s3" % "1.12.5"
99

10-
// git plugin
11-
resolvers += "jgit-repo" at "http://download.eclipse.org/jgit/maven"
12-
13-
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.6.4")
10+
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.1")
1411

0 commit comments

Comments
 (0)