mirror of https://github.com/sbt/sbt.git
Work around Scala 2.12 init deadlock (SI-9824)
This commit is contained in:
parent
2573c0f092
commit
008f9bee2e
|
|
@ -13,7 +13,7 @@ def commonSettings: Seq[Setting[_]] = Seq(
|
|||
resolvers += Resolver.mavenLocal,
|
||||
// concurrentRestrictions in Global += Util.testExclusiveRestriction,
|
||||
testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"),
|
||||
javacOptions in compile ++= Seq("-target", "6", "-source", "6", "-Xlint", "-Xlint:-serial"),
|
||||
javacOptions in compile ++= Seq("-Xlint", "-Xlint:-serial"),
|
||||
crossScalaVersions := Seq(scala211, scala212),
|
||||
scalacOptions ++= Seq("-Ywarn-unused", "-Ywarn-unused-import"),
|
||||
scalacOptions --= // scalac 2.10 rejects some HK types under -Xfuture it seems..
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ final case class Scope(nestIndex: Int, idAtIndex: Int = 0)
|
|||
// Lots of type constructors would become binary, which as you may know requires lots of type lambdas
|
||||
// when you want a type function with only one parameter.
|
||||
// That would be a general pain.)
|
||||
object SettingsExample extends Init[Scope] {
|
||||
case class SettingsExample() extends Init[Scope] {
|
||||
// Provides a way of showing a Scope+AttributeKey[_]
|
||||
val showFullKey: Show[ScopedKey[_]] = new Show[ScopedKey[_]] {
|
||||
def apply(key: ScopedKey[_]) = s"${key.scope.nestIndex}(${key.scope.idAtIndex})/${key.key.label}"
|
||||
|
|
@ -30,8 +30,8 @@ object SettingsExample extends Init[Scope] {
|
|||
|
||||
/** Usage Example **/
|
||||
|
||||
object SettingsUsage {
|
||||
import SettingsExample._
|
||||
case class SettingsUsage(val settingsExample: SettingsExample) {
|
||||
import settingsExample._
|
||||
|
||||
// Define some keys
|
||||
val a = AttributeKey[Int]("a")
|
||||
|
|
|
|||
|
|
@ -2,10 +2,12 @@ package sbt.internal.util
|
|||
|
||||
import org.scalacheck._
|
||||
import Prop._
|
||||
import SettingsUsage._
|
||||
import SettingsExample._
|
||||
|
||||
object SettingsTest extends Properties("settings") {
|
||||
val settingsExample: SettingsExample = SettingsExample()
|
||||
import settingsExample._
|
||||
val settingsUsage = SettingsUsage(settingsExample)
|
||||
import settingsUsage._
|
||||
|
||||
import scala.reflect.Manifest
|
||||
|
||||
|
|
@ -126,7 +128,7 @@ object SettingsTest extends Properties("settings") {
|
|||
// Each project defines an initial value, but the update is defined in globalKey.
|
||||
// However, the derived Settings that come from this should be scoped in each project.
|
||||
val settings: Seq[Setting[_]] =
|
||||
derive(setting(globalDerivedKey, SettingsExample.map(globalKey)(_ + 1))) +: projectKeys.map(pk => setting(pk, value(0)))
|
||||
derive(setting(globalDerivedKey, settingsExample.map(globalKey)(_ + 1))) +: projectKeys.map(pk => setting(pk, value(0)))
|
||||
val ev = evaluate(settings)
|
||||
// Also check that the key has no value at the "global" scope
|
||||
val props = for { pk <- projectDerivedKeys } yield checkKey(pk, Some(1), ev)
|
||||
|
|
@ -184,6 +186,7 @@ object SettingsTest extends Properties("settings") {
|
|||
}
|
||||
// This setup is a workaround for module synchronization issues
|
||||
final class CCR(intermediate: Int) {
|
||||
import SettingsTest.settingsExample._
|
||||
lazy val top = iterate(value(intermediate), intermediate)
|
||||
def iterate(init: Initialize[Int], i: Int): Initialize[Int] =
|
||||
bind(init) { t =>
|
||||
|
|
|
|||
Loading…
Reference in New Issue