Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ language: scala
jdk: oraclejdk8
script:
- git clone -b 2.12.x https://github.com/scala/scala
- sbt -Dfile.encoding=UTF-8 "runMain MakeReleaseNotes 2.11.8 2.12.0 2345/06/07 `pwd`/scala"
- sbt -Dfile.encoding=UTF-8 "runMain MakeReleaseNotes 2.12.0 2.12.1 2345/06/07 `pwd`/scala"
cache:
directories:
- $HOME/.ivy2
Expand Down
15 changes: 10 additions & 5 deletions src/main/scala/MakeDownloadPage.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ class MakeDownloadPage(version: String, releaseDate: Date = new Date()) {
def resourceArchive(cls: String, name: String, ext: String, desc: String): Future[String] = {
val fileName = s"$name-$version.$ext"
val fullUrl = s"http://downloads.lightbend.com/scala/$version/$fileName"
resource(cls, fileName, desc, fullUrl)
resource(cls, fileName, desc, fullUrl, fullUrl)
}

def resource(cls: String, fileName: String, desc: String, fullUrl: String): Future[String] = {
humanSize(fullUrl) map (size => s"""[$cls, "$fileName", "$fullUrl", "$desc", "$size"]""")
def resource(cls: String, fileName: String, desc: String, fullUrl: String, urlForSize: String): Future[String] = {
humanSize(urlForSize) map (size => s"""[$cls, "$fileName", "$fullUrl", "$desc", "$size"]""")
}

def defaultClass = """"-non-main-sys""""
Expand All @@ -51,7 +51,12 @@ class MakeDownloadPage(version: String, releaseDate: Date = new Date()) {

def format(fmt: String) = new SimpleDateFormat(fmt).format(releaseDate)

def ghSourceUrl = s"https://github.com/scala/scala/archive/v$version.tar.gz"
// maybe we wouldn't need both of these if I knew the right magic `curl` invocation,
// but just adding `-L` doesn't do it, we get the redirect info but not the size
// at the redirect location. this will be prone to breakage if GitHub moves
// this stuff around again
def ghSourceUrl = s"https://github.com/scala/scala/archive/v$version.tar.gz"
def ghSourceSizeUrl = s"https://codeload.github.com/scala/scala/tar.gz/v$version"

def resources: String = Await.result(
Future.sequence(Seq(
Expand All @@ -62,7 +67,7 @@ class MakeDownloadPage(version: String, releaseDate: Date = new Date()) {
resourceArchive(defaultClass, "scala", "rpm", "RPM package" ),
resourceArchive(defaultClass, "scala-docs", "txz", "API docs" ),
resourceArchive(defaultClass, "scala-docs", "zip", "API docs" ),
resource (defaultClass, s"scala-sources-$version.tar.gz", "Sources", ghSourceUrl )
resource (defaultClass, s"scala-sources-$version.tar.gz", "Sources", ghSourceUrl, ghSourceSizeUrl)
)).map(_.mkString(",\n ")), 30.seconds)

// note: first and last lines must be exactly "---"
Expand Down