mirror of https://github.com/sbt/sbt.git
Format
This commit is contained in:
parent
3dcc6cfcd1
commit
6da4790671
|
|
@ -13,6 +13,7 @@ sealed abstract class VirtualAxis {
|
||||||
}
|
}
|
||||||
|
|
||||||
object VirtualAxis {
|
object VirtualAxis {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WeakAxis allows a row to depend on another row with Zero value.
|
* WeakAxis allows a row to depend on another row with Zero value.
|
||||||
* For example, Scala version can be Zero for Java project, and it's ok.
|
* For example, Scala version can be Zero for Java project, and it's ok.
|
||||||
|
|
@ -22,7 +23,6 @@ object VirtualAxis {
|
||||||
/** StrongAxis requires a row to depend on another row with the same selected value. */
|
/** StrongAxis requires a row to depend on another row with the same selected value. */
|
||||||
abstract class StrongAxis extends VirtualAxis
|
abstract class StrongAxis extends VirtualAxis
|
||||||
|
|
||||||
|
|
||||||
def isMatch(lhs: Seq[VirtualAxis], rhs: Seq[VirtualAxis]): Boolean =
|
def isMatch(lhs: Seq[VirtualAxis], rhs: Seq[VirtualAxis]): Boolean =
|
||||||
lhs.forall(isStronglyCompatible(_, rhs)) && rhs.forall(isStronglyCompatible(_, lhs))
|
lhs.forall(isStronglyCompatible(_, rhs)) && rhs.forall(isStronglyCompatible(_, lhs))
|
||||||
|
|
||||||
|
|
@ -41,8 +41,8 @@ object VirtualAxis {
|
||||||
def isSecondaryCompatible(v: VirtualAxis, stack: Seq[VirtualAxis]): Boolean =
|
def isSecondaryCompatible(v: VirtualAxis, stack: Seq[VirtualAxis]): Boolean =
|
||||||
v match {
|
v match {
|
||||||
case v: ScalaVersionAxis =>
|
case v: ScalaVersionAxis =>
|
||||||
val thatSVOpt = (stack collect {
|
val thatSVOpt = (stack collect { case x: ScalaVersionAxis =>
|
||||||
case x: ScalaVersionAxis => x
|
x
|
||||||
}).headOption
|
}).headOption
|
||||||
thatSVOpt match {
|
thatSVOpt match {
|
||||||
case Some(ScalaVersionAxis(sv, _)) =>
|
case Some(ScalaVersionAxis(sv, _)) =>
|
||||||
|
|
@ -54,7 +54,10 @@ object VirtualAxis {
|
||||||
isStronglyCompatible(v, stack)
|
isStronglyCompatible(v, stack)
|
||||||
}
|
}
|
||||||
|
|
||||||
private[sbt] def isScala2Scala3Sandwich(sbv1: Option[(Long, Long)], sbv2: Option[(Long, Long)]): Boolean = {
|
private[sbt] def isScala2Scala3Sandwich(
|
||||||
|
sbv1: Option[(Long, Long)],
|
||||||
|
sbv2: Option[(Long, Long)]
|
||||||
|
): Boolean = {
|
||||||
def str(x: Option[(Long, Long)]): String =
|
def str(x: Option[(Long, Long)]): String =
|
||||||
x match {
|
x match {
|
||||||
case Some((a, b)) => s"$a.$b"
|
case Some((a, b)) => s"$a.$b"
|
||||||
|
|
@ -97,7 +100,8 @@ object VirtualAxis {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case class PlatformAxis(value: String, idSuffix: String, directorySuffix: String) extends StrongAxis {
|
case class PlatformAxis(value: String, idSuffix: String, directorySuffix: String)
|
||||||
|
extends StrongAxis {
|
||||||
override val suffixOrder: Int = 80
|
override val suffixOrder: Int = 80
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@ import java.util.concurrent.atomic.AtomicBoolean
|
||||||
import scala.language.experimental.macros
|
import scala.language.experimental.macros
|
||||||
|
|
||||||
trait ProjectMatrixKeys {
|
trait ProjectMatrixKeys {
|
||||||
val virtualAxes = settingKey[Seq[VirtualAxis]]("Virtual axes for the project")
|
val virtualAxes = settingKey[Seq[VirtualAxis]]("Virtual axes for the project")
|
||||||
val projectMatrixBaseDirectory = settingKey[File]("Base directory of the current project matrix")
|
val projectMatrixBaseDirectory = settingKey[File]("Base directory of the current project matrix")
|
||||||
}
|
}
|
||||||
|
|
||||||
object ProjectMatrixKeys extends ProjectMatrixKeys
|
object ProjectMatrixKeys extends ProjectMatrixKeys
|
||||||
|
|
@ -19,12 +19,12 @@ object ProjectMatrixPlugin extends AutoPlugin {
|
||||||
def projectMatrix: ProjectMatrix = macro ProjectMatrix.projectMatrixMacroImpl
|
def projectMatrix: ProjectMatrix = macro ProjectMatrix.projectMatrixMacroImpl
|
||||||
|
|
||||||
implicit def matrixClasspathDependency[T](
|
implicit def matrixClasspathDependency[T](
|
||||||
m: T
|
m: T
|
||||||
)(implicit ev: T => ProjectMatrixReference): ProjectMatrix.MatrixClasspathDependency =
|
)(implicit ev: T => ProjectMatrixReference): ProjectMatrix.MatrixClasspathDependency =
|
||||||
ProjectMatrix.MatrixClasspathDependency(m, None)
|
ProjectMatrix.MatrixClasspathDependency(m, None)
|
||||||
|
|
||||||
implicit def matrixReferenceSyntax[T](
|
implicit def matrixReferenceSyntax[T](
|
||||||
m: T
|
m: T
|
||||||
)(implicit ev: T => ProjectMatrixReference): ProjectMatrix.ProjectMatrixReferenceSyntax =
|
)(implicit ev: T => ProjectMatrixReference): ProjectMatrix.ProjectMatrixReferenceSyntax =
|
||||||
new ProjectMatrix.ProjectMatrixReferenceSyntax(m)
|
new ProjectMatrix.ProjectMatrixReferenceSyntax(m)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,14 +10,19 @@ object ReflectionUtil {
|
||||||
val clazz = classLoader.loadClass(className)
|
val clazz = classLoader.loadClass(className)
|
||||||
val t = implicitly[ClassTag[A]].runtimeClass
|
val t = implicitly[ClassTag[A]].runtimeClass
|
||||||
Option(clazz.getField("MODULE$").get(null)) match {
|
Option(clazz.getField("MODULE$").get(null)) match {
|
||||||
case None => throw new ClassNotFoundException(s"Unable to find $className using classloader: $classLoader")
|
case None =>
|
||||||
case Some(c) if !t.isInstance(c) => throw new ClassCastException(s"${clazz.getName} is not a subtype of $t")
|
throw new ClassNotFoundException(
|
||||||
case Some(c: A) => c
|
s"Unable to find $className using classloader: $classLoader"
|
||||||
|
)
|
||||||
|
case Some(c) if !t.isInstance(c) =>
|
||||||
|
throw new ClassCastException(s"${clazz.getName} is not a subtype of $t")
|
||||||
|
case Some(c: A) => c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.recover {
|
.recover {
|
||||||
case i: InvocationTargetException if i.getTargetException != null => throw i.getTargetException
|
case i: InvocationTargetException if i.getTargetException != null =>
|
||||||
}
|
throw i.getTargetException
|
||||||
|
}
|
||||||
|
|
||||||
def objectExists(classLoader: ClassLoader, className: String): Boolean =
|
def objectExists(classLoader: ClassLoader, className: String): Boolean =
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue