diff --git a/src/main/scala/sbt/VirtualAxis.scala b/src/main/scala/sbt/VirtualAxis.scala index e601a14d2..a729c120a 100644 --- a/src/main/scala/sbt/VirtualAxis.scala +++ b/src/main/scala/sbt/VirtualAxis.scala @@ -13,6 +13,7 @@ sealed abstract class VirtualAxis { } object VirtualAxis { + /** * 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. @@ -22,7 +23,6 @@ object VirtualAxis { /** StrongAxis requires a row to depend on another row with the same selected value. */ abstract class StrongAxis extends VirtualAxis - def isMatch(lhs: Seq[VirtualAxis], rhs: Seq[VirtualAxis]): Boolean = lhs.forall(isStronglyCompatible(_, rhs)) && rhs.forall(isStronglyCompatible(_, lhs)) @@ -41,8 +41,8 @@ object VirtualAxis { def isSecondaryCompatible(v: VirtualAxis, stack: Seq[VirtualAxis]): Boolean = v match { case v: ScalaVersionAxis => - val thatSVOpt = (stack collect { - case x: ScalaVersionAxis => x + val thatSVOpt = (stack collect { case x: ScalaVersionAxis => + x }).headOption thatSVOpt match { case Some(ScalaVersionAxis(sv, _)) => @@ -54,7 +54,10 @@ object VirtualAxis { 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 = x match { 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 } diff --git a/src/main/scala/sbtprojectmatrix/ProjectMatrixPlugin.scala b/src/main/scala/sbtprojectmatrix/ProjectMatrixPlugin.scala index 54d883ab2..7ae4ad26f 100644 --- a/src/main/scala/sbtprojectmatrix/ProjectMatrixPlugin.scala +++ b/src/main/scala/sbtprojectmatrix/ProjectMatrixPlugin.scala @@ -6,8 +6,8 @@ import java.util.concurrent.atomic.AtomicBoolean import scala.language.experimental.macros trait ProjectMatrixKeys { - val virtualAxes = settingKey[Seq[VirtualAxis]]("Virtual axes for the project") - val projectMatrixBaseDirectory = settingKey[File]("Base directory of the current project matrix") + val virtualAxes = settingKey[Seq[VirtualAxis]]("Virtual axes for the project") + val projectMatrixBaseDirectory = settingKey[File]("Base directory of the current project matrix") } object ProjectMatrixKeys extends ProjectMatrixKeys @@ -19,12 +19,12 @@ object ProjectMatrixPlugin extends AutoPlugin { def projectMatrix: ProjectMatrix = macro ProjectMatrix.projectMatrixMacroImpl implicit def matrixClasspathDependency[T]( - m: T + m: T )(implicit ev: T => ProjectMatrixReference): ProjectMatrix.MatrixClasspathDependency = ProjectMatrix.MatrixClasspathDependency(m, None) implicit def matrixReferenceSyntax[T]( - m: T + m: T )(implicit ev: T => ProjectMatrixReference): ProjectMatrix.ProjectMatrixReferenceSyntax = new ProjectMatrix.ProjectMatrixReferenceSyntax(m) } diff --git a/src/main/scala/sbtprojectmatrix/ReflectionUtil.scala b/src/main/scala/sbtprojectmatrix/ReflectionUtil.scala index 77081ec6f..d7d5736d4 100644 --- a/src/main/scala/sbtprojectmatrix/ReflectionUtil.scala +++ b/src/main/scala/sbtprojectmatrix/ReflectionUtil.scala @@ -10,14 +10,19 @@ object ReflectionUtil { val clazz = classLoader.loadClass(className) val t = implicitly[ClassTag[A]].runtimeClass Option(clazz.getField("MODULE$").get(null)) match { - case None => throw new ClassNotFoundException(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 + case None => + throw new ClassNotFoundException( + 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 { - case i: InvocationTargetException if i.getTargetException != null => throw i.getTargetException - } + .recover { + case i: InvocationTargetException if i.getTargetException != null => + throw i.getTargetException + } def objectExists(classLoader: ClassLoader, className: String): Boolean = try {