Skip to content

Commit 0e7ae12

Browse files
authored
Merge pull request #244 from SethTisue/github-moved-releases
old URL for GitHub source downloads is now a redirect
2 parents 96e5ff3 + c5cedc8 commit 0e7ae12

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ language: scala
33
jdk: oraclejdk8
44
script:
55
- git clone -b 2.12.x https://github.com/scala/scala
6-
- sbt -Dfile.encoding=UTF-8 "runMain MakeReleaseNotes 2.11.8 2.12.0 2345/06/07 `pwd`/scala"
6+
- sbt -Dfile.encoding=UTF-8 "runMain MakeReleaseNotes 2.12.0 2.12.1 2345/06/07 `pwd`/scala"
77
cache:
88
directories:
99
- $HOME/.ivy2

src/main/scala/MakeDownloadPage.scala

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ class MakeDownloadPage(version: String, releaseDate: Date = new Date()) {
3838
def resourceArchive(cls: String, name: String, ext: String, desc: String): Future[String] = {
3939
val fileName = s"$name-$version.$ext"
4040
val fullUrl = s"http://downloads.lightbend.com/scala/$version/$fileName"
41-
resource(cls, fileName, desc, fullUrl)
41+
resource(cls, fileName, desc, fullUrl, fullUrl)
4242
}
4343

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

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

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

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

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

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

0 commit comments

Comments
 (0)