Merge pull request #4143 from eed3si9n/wip/merge-1.1.x

merge 1.1.x
This commit is contained in:
eugene yokota 2018-05-04 23:23:21 -04:00 committed by GitHub
commit 913307189e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 54 additions and 16 deletions

View File

@ -12,9 +12,10 @@ Contributing
There are lots of ways to contribute to sbt ecosystem depending on your interests and skill level. 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. - Answer StackOverflow questions.
- Create plugins that extends sbt's feature. - Ask StackOverflow questions.
- Create plugins that extend sbt's features.
- Maintain and update [documentation]. - Maintain and update [documentation].
- Garden the issue tracker. - Garden the issue tracker.
- Report issues. - Report issues.
@ -230,7 +231,7 @@ Afterwhich start sbt with a stable launcher: `sbt -sbt-jar ~/.sbt/launchers/1.1.
### Clearing out boot and local cache ### 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. 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.

View File

@ -96,7 +96,7 @@ private[sbt] object PluginCross {
VersionNumber(sv) match { VersionNumber(sv) match {
case VersionNumber(Seq(0, 12, _*), _, _) => "2.9.2" case VersionNumber(Seq(0, 12, _*), _, _) => "2.9.2"
case VersionNumber(Seq(0, 13, _*), _, _) => "2.10.7" 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") case _ => sys.error(s"Unsupported sbt binary version: $sv")
} }
} }

View File

@ -4,7 +4,7 @@ import sbt.contraband.ContrabandPlugin.autoImport._
object Dependencies { object Dependencies {
// WARNING: Please Scala update versions in PluginCross.scala too // WARNING: Please Scala update versions in PluginCross.scala too
val scala212 = "2.12.5" val scala212 = "2.12.6"
val baseScalaVersion = scala212 val baseScalaVersion = scala212
// sbt modules // sbt modules

View File

@ -1 +1 @@
sbt.version=1.1.2 sbt.version=1.1.4

View File

@ -1,4 +1,4 @@
scalaVersion := "2.12.4" scalaVersion := "2.12.6"
scalacOptions ++= Seq("-feature", "-language:postfixOps") scalacOptions ++= Seq("-feature", "-language:postfixOps")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.2.0") addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.2.0")

View File

@ -2,7 +2,7 @@ testFrameworks += new TestFramework("utest.runner.Framework")
lazy val root = (project in file(".")). lazy val root = (project in file(".")).
settings( settings(
scalaVersion := "2.12.4", scalaVersion := "2.12.6",
libraryDependencies += "com.lihaoyi" %% "utest" % "0.6.4" % Test, libraryDependencies += "com.lihaoyi" %% "utest" % "0.6.4" % Test,
fork in Test := true fork in Test := true
) )

View File

@ -15,7 +15,7 @@ import xsbti._
object RunFromSourceMain { object RunFromSourceMain {
private val sbtVersion = "1.1.4" // TestBuildInfo.version private val sbtVersion = "1.1.4" // TestBuildInfo.version
private val scalaVersion = "2.12.4" private val scalaVersion = "2.12.6"
def fork(workingDirectory: File): Try[Unit] = { def fork(workingDirectory: File): Try[Unit] = {
val fo = ForkOptions() val fo = ForkOptions()
@ -67,12 +67,46 @@ object RunFromSourceMain {
def apply[T](lockFile: File, run: java.util.concurrent.Callable[T]) = run.call() 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 log = sbt.util.LogExchange.logger("run-from-source")
val scalaHome0 = bootDirectory / s"scala-$scalaVersion"
if ((scalaHome0 / "lib").exists) scalaHome0
else {
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) 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 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 { private def getConf(baseDir: File, args: Seq[String]): AppConfiguration = new AppConfiguration {
def baseDirectory = baseDir def baseDirectory = baseDir
def arguments = args.toArray def arguments = args.toArray
def provider = new AppProvider { appProvider => def provider = new AppProvider { appProvider =>
def bootDirectory: File = file(sys.props("user.home")) / ".sbt" / "boot"
def scalaHome: File = bootDirectory / s"scala-$scalaVersion"
def scalaProvider = new ScalaProvider { scalaProvider => def scalaProvider = new ScalaProvider { scalaProvider =>
def scalaOrg = "org.scala-lang" def scalaOrg = "org.scala-lang"
def launcher = new Launcher { def launcher = new Launcher {
@ -82,7 +116,7 @@ object RunFromSourceMain {
def app(id: xsbti.ApplicationID, version: String) = appProvider def app(id: xsbti.ApplicationID, version: String) = appProvider
def topLoader = new java.net.URLClassLoader(Array(), null) def topLoader = new java.net.URLClassLoader(Array(), null)
def globalLock = noGlobalLock def globalLock = noGlobalLock
def bootDirectory = appProvider.bootDirectory def bootDirectory = RunFromSourceMain.bootDirectory
def ivyHome = file(sys.props("user.home")) / ".ivy2" def ivyHome = file(sys.props("user.home")) / ".ivy2"
final case class PredefRepo(id: Predefined) extends PredefinedRepository final case class PredefRepo(id: Predefined) extends PredefinedRepository
import Predefined._ import Predefined._
@ -92,11 +126,14 @@ object RunFromSourceMain {
def checksums = Array("sha1", "md5") def checksums = Array("sha1", "md5")
} }
def version = scalaVersion def version = scalaVersion
def libDir: File = scalaHome / "lib" lazy val libDir: File = RunFromSourceMain.scalaHome / "lib"
def jar(name: String): File = libDir / s"$name.jar" def jar(name: String): File = libDir / s"$name.jar"
def libraryJar = jar("scala-library") lazy val libraryJar = jar("scala-library")
def compilerJar = jar("scala-compiler") lazy val compilerJar = jar("scala-compiler")
def jars = libDir.listFiles(f => !f.isDirectory && f.getName.endsWith(".jar")) 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 loader = new java.net.URLClassLoader(jars map (_.toURI.toURL), null)
def app(id: xsbti.ApplicationID) = appProvider def app(id: xsbti.ApplicationID) = appProvider
} }