From 4477a42b5af6273788ef9a386b93d3d967cfe4d9 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Fri, 27 Apr 2018 19:07:08 +0200 Subject: [PATCH 1/4] upgrade Scala 2.12.4 -> 2.12.6 I have no specific user-visible benefit in mind other than fewer JARs to download for people who are on current versions of things --- CONTRIBUTING.md | 2 +- main/src/main/scala/sbt/PluginCross.scala | 2 +- project/Dependencies.scala | 2 +- project/plugins.sbt | 2 +- sbt/src/sbt-test/tests/fork-async/build.sbt | 2 +- sbt/src/test/scala/sbt/RunFromSourceMain.scala | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7dc91fcdd..f7356793c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -200,7 +200,7 @@ $ sbt ### Clearing out boot and local cache -When you run a locally built sbt, the JAR artifacts will be now cached under `$HOME/.sbt/boot/scala-2.12.4/org.scala-sbt/sbt/1.$MINOR.$PATCH-SNAPSHOT` directory. To clear this out run: `reboot dev` command from sbt's session of your test application. +When you run a locally built sbt, the JAR artifacts will be now cached under `$HOME/.sbt/boot/scala-2.12.6/org.scala-sbt/sbt/1.$MINOR.$PATCH-SNAPSHOT` directory. To clear this out run: `reboot dev` command from sbt's session of your test application. One drawback of `-SNAPSHOT` version is that it's slow to resolve as it tries to hit all the resolvers. You can workaround that by using a version name like `1.$MINOR.$PATCH-LOCAL1`. A non-SNAPSHOT artifacts will now be cached under `$HOME/.ivy/cache/` directory, so you need to clear that out using [sbt-dirty-money](https://github.com/sbt/sbt-dirty-money)'s `cleanCache` task. diff --git a/main/src/main/scala/sbt/PluginCross.scala b/main/src/main/scala/sbt/PluginCross.scala index 9828b42a7..91e823bbc 100644 --- a/main/src/main/scala/sbt/PluginCross.scala +++ b/main/src/main/scala/sbt/PluginCross.scala @@ -93,7 +93,7 @@ private[sbt] object PluginCross { VersionNumber(sv) match { case VersionNumber(Seq(0, 12, _*), _, _) => "2.9.2" case VersionNumber(Seq(0, 13, _*), _, _) => "2.10.7" - case VersionNumber(Seq(1, 0, _*), _, _) => "2.12.4" + case VersionNumber(Seq(1, 0, _*), _, _) => "2.12.6" case _ => sys.error(s"Unsupported sbt binary version: $sv") } } diff --git a/project/Dependencies.scala b/project/Dependencies.scala index bcefc8b4e..b1e9fd0ab 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -4,7 +4,7 @@ import sbt.contraband.ContrabandPlugin.autoImport._ object Dependencies { // WARNING: Please Scala update versions in PluginCross.scala too - val scala212 = "2.12.5" + val scala212 = "2.12.6" val baseScalaVersion = scala212 // sbt modules diff --git a/project/plugins.sbt b/project/plugins.sbt index 68b01d14b..b13554d41 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,4 +1,4 @@ -scalaVersion := "2.12.4" +scalaVersion := "2.12.6" scalacOptions ++= Seq("-feature", "-language:postfixOps") addSbtPlugin("org.scala-sbt" % "sbt-houserules" % "0.3.6") diff --git a/sbt/src/sbt-test/tests/fork-async/build.sbt b/sbt/src/sbt-test/tests/fork-async/build.sbt index bb42b0c17..3ddfca63c 100644 --- a/sbt/src/sbt-test/tests/fork-async/build.sbt +++ b/sbt/src/sbt-test/tests/fork-async/build.sbt @@ -2,7 +2,7 @@ testFrameworks += new TestFramework("utest.runner.Framework") lazy val root = (project in file(".")). settings( - scalaVersion := "2.12.4", + scalaVersion := "2.12.6", libraryDependencies += "com.lihaoyi" %% "utest" % "0.6.4" % Test, fork in Test := true ) diff --git a/sbt/src/test/scala/sbt/RunFromSourceMain.scala b/sbt/src/test/scala/sbt/RunFromSourceMain.scala index c0bd9cfc1..a625da9a8 100644 --- a/sbt/src/test/scala/sbt/RunFromSourceMain.scala +++ b/sbt/src/test/scala/sbt/RunFromSourceMain.scala @@ -14,8 +14,8 @@ import buildinfo.TestBuildInfo import xsbti._ object RunFromSourceMain { - private val sbtVersion = "1.0.3" // "dev" - private val scalaVersion = "2.12.4" + private val sbtVersion = "1.1.0" // "dev" + private val scalaVersion = "2.12.6" def fork(workingDirectory: File): Try[Unit] = { val fo = ForkOptions() From ccd03eeba20b8479565789fda546b33257794823 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Fri, 27 Apr 2018 19:28:20 -0400 Subject: [PATCH 2/4] resolve Scala compiler using Ivy When Scala compiler is not found in the boot directory, use Ivy to resolve it. --- .../test/scala/sbt/RunFromSourceMain.scala | 48 +++++++++++++++++-- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/sbt/src/test/scala/sbt/RunFromSourceMain.scala b/sbt/src/test/scala/sbt/RunFromSourceMain.scala index a625da9a8..7212d570e 100644 --- a/sbt/src/test/scala/sbt/RunFromSourceMain.scala +++ b/sbt/src/test/scala/sbt/RunFromSourceMain.scala @@ -67,9 +67,44 @@ object RunFromSourceMain { def apply[T](lockFile: File, run: java.util.concurrent.Callable[T]) = run.call() } + private lazy val bootDirectory: File = file(sys.props("user.home")) / ".sbt" / "boot" + private lazy val scalaHome: File = { + val scalaHome0 = bootDirectory / s"scala-$scalaVersion" + if (scalaHome0.exists) scalaHome0 + else { + val target = new File("target").getAbsoluteFile + val fakeboot = target / "fakeboot" + val scalaHome1 = fakeboot / s"scala-$scalaVersion" + val scalaHome1Lib = scalaHome1 / "lib" + val scalaHome1Temp = scalaHome1 / "temp" + if (scalaHome1Lib.exists) () + else { + IO.createDirectories(List(scalaHome1Lib, scalaHome1Temp)) + val log = sbt.util.LogExchange.logger("run-from-source") + val lm = { + import sbt.librarymanagement.ivy.IvyDependencyResolution + val ivyConfig = InlineIvyConfiguration().withLog(log) + IvyDependencyResolution(ivyConfig) + } + val Name = """(.*)(\-[\d|\.]+)\.jar""".r + val module = "org.scala-lang" % "scala-compiler" % scalaVersion + lm.retrieve(module, scalaModuleInfo = None, scalaHome1Temp, log) match { + case Right(_) => + (scalaHome1Temp ** "*.jar").get foreach { x => + val Name(head, _) = x.getName + IO.copyFile(x, scalaHome1Lib / (head + ".jar")) + } + case Left(w) => sys.error(w.toString) + } + } + scalaHome1 + } + } + private def getConf(baseDir: File, args: Seq[String]): AppConfiguration = new AppConfiguration { def baseDirectory = baseDir def arguments = args.toArray + def provider = new AppProvider { appProvider => def scalaProvider = new ScalaProvider { scalaProvider => def scalaOrg = "org.scala-lang" @@ -80,7 +115,7 @@ object RunFromSourceMain { def app(id: xsbti.ApplicationID, version: String) = appProvider def topLoader = new java.net.URLClassLoader(Array(), null) def globalLock = noGlobalLock - def bootDirectory = file(sys.props("user.home")) / ".sbt" / "boot" + def bootDirectory = RunFromSourceMain.bootDirectory def ivyRepositories = Array() def appRepositories = Array() def isOverrideRepositories = false @@ -88,11 +123,14 @@ object RunFromSourceMain { def checksums = Array("sha1", "md5") } def version = scalaVersion - def libDir: File = launcher.bootDirectory / s"scala-$version" / "lib" + lazy val libDir: File = RunFromSourceMain.scalaHome / "lib" def jar(name: String): File = libDir / s"$name.jar" - def libraryJar = jar("scala-library") - def compilerJar = jar("scala-compiler") - def jars = libDir.listFiles(f => !f.isDirectory && f.getName.endsWith(".jar")) + lazy val libraryJar = jar("scala-library") + lazy val compilerJar = jar("scala-compiler") + lazy val jars = { + assert(libDir.exists) + libDir.listFiles(f => !f.isDirectory && f.getName.endsWith(".jar")) + } def loader = new java.net.URLClassLoader(jars map (_.toURI.toURL), null) def app(id: xsbti.ApplicationID) = appProvider } From c29b88ed5c5281e4061b3f4ee3224f36983cc27b Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Sun, 29 Apr 2018 13:14:54 -0700 Subject: [PATCH 3/4] Minor grammar for contributing text. --- CONTRIBUTING.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7dc91fcdd..07f014c9a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -31,9 +31,10 @@ How to contribute to sbt There are lots of ways to contribute to sbt ecosystem depending on your interests and skill level. -- Help someone at work or online help their build problem. +- Help someone at work or online fix their build problem. - Answer StackOverflow questions. -- Create plugins that extends sbt's feature. +- Ask StackOverflow questions. +- Create plugins that extend sbt's features. - Maintain and update [documentation]. - Garden the issue tracker. - Report issues. From 94a57dcf00cfe5b5ff628fc873d1b133fd4898cb Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Fri, 4 May 2018 18:08:15 -0400 Subject: [PATCH 4/4] Move fakeboot to home https://github.com/sbt/sbt/pull/4143 kept failing, and while I was debugging, I noticed that the target that it was downloading scala-compiler was in /tmp/... for the remote instance. This moves the fakeboot to a full path, which should make the build less susceptible to failure due to random network issues. --- project/build.properties | 2 +- sbt/src/test/scala/sbt/RunFromSourceMain.scala | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/project/build.properties b/project/build.properties index 05313438a..64cf32f7f 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.1.2 +sbt.version=1.1.4 diff --git a/sbt/src/test/scala/sbt/RunFromSourceMain.scala b/sbt/src/test/scala/sbt/RunFromSourceMain.scala index 7212d570e..d70f02cb0 100644 --- a/sbt/src/test/scala/sbt/RunFromSourceMain.scala +++ b/sbt/src/test/scala/sbt/RunFromSourceMain.scala @@ -69,18 +69,19 @@ object RunFromSourceMain { private lazy val bootDirectory: File = file(sys.props("user.home")) / ".sbt" / "boot" private lazy val scalaHome: File = { + val log = sbt.util.LogExchange.logger("run-from-source") val scalaHome0 = bootDirectory / s"scala-$scalaVersion" - if (scalaHome0.exists) scalaHome0 + if ((scalaHome0 / "lib").exists) scalaHome0 else { - val target = new File("target").getAbsoluteFile - val fakeboot = target / "fakeboot" + log.info(s"""scalaHome ($scalaHome0) wasn't found""") + val fakeboot = file(sys.props("user.home")) / ".sbt" / "fakeboot" val scalaHome1 = fakeboot / s"scala-$scalaVersion" val scalaHome1Lib = scalaHome1 / "lib" val scalaHome1Temp = scalaHome1 / "temp" - if (scalaHome1Lib.exists) () + if (scalaHome1Lib.exists) log.info(s"""using $scalaHome1 that was found""") else { + log.info(s"""creating $scalaHome1 by downloading scala-compiler $scalaVersion""") IO.createDirectories(List(scalaHome1Lib, scalaHome1Temp)) - val log = sbt.util.LogExchange.logger("run-from-source") val lm = { import sbt.librarymanagement.ivy.IvyDependencyResolution val ivyConfig = InlineIvyConfiguration().withLog(log)