Adjust to the code changes

This commit is contained in:
Eugene Yokota 2022-09-27 01:18:24 -04:00
parent 9a2ca3c4da
commit 54c12819df
10 changed files with 78 additions and 70 deletions

View File

@ -312,9 +312,9 @@ trait Parsers {
*/
lazy val NotQuoted = (NotDQuoteSpaceClass ~ OptNotSpace) map { case (c, s) => c.toString + s }
/** Parses a non-empty String value that cannot start with a double quote, but includes double quotes.*/
lazy val NotQuotedThenQuoted = (NotQuoted ~ StringEscapable) map {
case (s1, s2) => s"""$s1\"$s2\""""
/** Parses a non-empty String value that cannot start with a double quote, but includes double quotes. */
lazy val NotQuotedThenQuoted = (NotQuoted ~ StringEscapable) map { case (s1, s2) =>
s"""$s1\"$s2\""""
}
/**

View File

@ -296,11 +296,10 @@ object Cross {
} else {
included
.groupBy(_._2)
.foreach {
case (selectedVersion, projects) =>
state.log.info(
s"Setting Scala version to $selectedVersion on ${projects.size} projects."
)
.foreach { case (selectedVersion, projects) =>
state.log.info(
s"Setting Scala version to $selectedVersion on ${projects.size} projects."
)
}
}
if (excluded.nonEmpty && !switch.verbose) {
@ -328,32 +327,31 @@ object Cross {
val projectScalaVersions =
structure.allProjectRefs.map(proj => proj -> crossVersions(extracted, proj))
if (switch.version.force) {
projectScalaVersions.map {
case (ref, options) => (ref, Some(version), options)
projectScalaVersions.map { case (ref, options) =>
(ref, Some(version), options)
} ++ structure.units.keys
.map(BuildRef.apply)
.map(proj => (proj, Some(version), crossVersions(extracted, proj)))
} else {
projectScalaVersions.map {
case (project, scalaVersions) =>
val selector = SemanticSelector(version)
scalaVersions.filter(v => selector.matches(VersionNumber(v))) match {
case Nil => (project, None, scalaVersions)
case Seq(version) => (project, Some(version), scalaVersions)
case multiple =>
sys.error(
s"Multiple crossScalaVersions matched query '$version': ${multiple.mkString(", ")}"
)
}
projectScalaVersions.map { case (project, scalaVersions) =>
val selector = SemanticSelector(version)
scalaVersions.filter(v => selector.matches(VersionNumber(v))) match {
case Nil => (project, None, scalaVersions)
case Seq(version) => (project, Some(version), scalaVersions)
case multiple =>
sys.error(
s"Multiple crossScalaVersions matched query '$version': ${multiple.mkString(", ")}"
)
}
}
}
}
val included = projects.collect {
case (project, Some(version), scalaVersions) => (project, version, scalaVersions)
val included = projects.collect { case (project, Some(version), scalaVersions) =>
(project, version, scalaVersions)
}
val excluded = projects.collect {
case (project, None, scalaVersions) => (project, scalaVersions)
val excluded = projects.collect { case (project, None, scalaVersions) =>
(project, scalaVersions)
}
if (included.isEmpty) {
@ -376,10 +374,12 @@ object Cross {
// determine whether this is a 'specific' version or a selector
// to be passed to SemanticSelector
private def isSelector(version: String): Boolean =
version.contains('*') || version.contains('x') || version.contains('X') || version.contains(' ') ||
version.contains('*') || version.contains('x') || version.contains('X') || version.contains(
' '
) ||
version.contains('<') || version.contains('>') || version.contains('|') || version.contains(
'='
)
'='
)
private def setScalaVersionsForProjects(
instance: Option[(File, ScalaInstance)],
@ -389,25 +389,24 @@ object Cross {
): State = {
import extracted._
val newSettings = projects.flatMap {
case (project, version, scalaVersions) =>
val scope = Scope(Select(project), Zero, Zero, Zero)
val newSettings = projects.flatMap { case (project, version, scalaVersions) =>
val scope = Scope(Select(project), Zero, Zero, Zero)
instance match {
case Some((home, inst)) =>
Seq(
scope / scalaVersion := version,
scope / crossScalaVersions := scalaVersions,
scope / scalaHome := Some(home),
scope / scalaInstance := inst
)
case None =>
Seq(
scope / scalaVersion := version,
scope / crossScalaVersions := scalaVersions,
scope / scalaHome := None
)
}
instance match {
case Some((home, inst)) =>
Seq(
scope / scalaVersion := version,
scope / crossScalaVersions := scalaVersions,
scope / scalaHome := Some(home),
scope / scalaInstance := inst
)
case None =>
Seq(
scope / scalaVersion := version,
scope / crossScalaVersions := scalaVersions,
scope / scalaHome := None
)
}
}
val filterKeys: Set[AttributeKey[_]] = Set(scalaVersion, scalaHome, scalaInstance).map(_.key)

View File

@ -43,11 +43,14 @@ object Opts {
import sbt.io.syntax._
@deprecated("Use sonatypeOssReleases instead", "1.7.0")
val sonatypeReleases = Resolver.sonatypeRepo("releases")
val sonatypeOssReleases = Resolver.sonatypeOssRepos("releases")
// todo: fix
// val sonatypeOssReleases = Resolver.sonatypeOssRepos("releases")
@deprecated("Use sonatypeOssSnapshots instead", "1.7.0")
val sonatypeSnapshots = Resolver.sonatypeRepo("snapshots")
val sonatypeOssSnapshots = Resolver.sonatypeOssRepos("snapshots")
// todo: fix
// val sonatypeOssSnapshots = Resolver.sonatypeOssRepos("snapshots")
val sonatypeStaging = MavenRepository(
"sonatype-staging",

View File

@ -275,8 +275,11 @@ object BuildServerProtocol {
val filter = ScopeFilter.in(workspace.scopes.values.toList)
Def.task {
val items = bspScalaTestClassesItem.result.all(filter).value
val successfulItems = anyOrThrow(items)
val result = ScalaTestClassesResult(successfulItems.toVector, None)
val successfulItems = anyOrThrow[Seq[ScalaTestClassesItem]](items).flatten
val result = ScalaTestClassesResult(
items = successfulItems.toVector,
originId = None: Option[String]
)
s.respondEvent(result)
}
})
@ -753,13 +756,14 @@ object BuildServerProtocol {
ScopeFilter
) => Def.Initialize[Task[T]]
): Def.Initialize[InputTask[T]] =
Def.inputTaskDyn {
val s = state.value
val targets = spaceDelimited().parsed.map(uri => BuildTargetIdentifier(URI.create(uri)))
val workspace: BspFullWorkspace = bspFullWorkspace.value.filter(targets)
val filter = ScopeFilter.in(workspace.scopes.values.toList)
taskImpl(s, targets, workspace, filter)
}
Def
.input((s: State) => targetIdentifierParser)
.flatMapTask { targets =>
val s = state.value
val workspace: BspFullWorkspace = bspFullWorkspace.value.filter(targets)
val filter = ScopeFilter.in(workspace.scopes.values.toList)
taskImpl(s, targets, workspace, filter)
}
private def jvmEnvironmentItem(): Initialize[Task[JvmEnvironmentItem]] = Def.task {
val target = Keys.bspTargetIdentifier.value
@ -1009,13 +1013,12 @@ object BuildServerProtocol {
val grouped = TestFramework.testMap(frameworks, definitions)
grouped.map {
case (framework, definitions) =>
ScalaTestClassesItem(
bspTargetIdentifier.value,
definitions.map(_.name).toVector,
framework.name()
)
grouped.map { case (framework, definitions) =>
ScalaTestClassesItem(
bspTargetIdentifier.value,
definitions.map(_.name).toVector,
framework.name()
)
}.toSeq
}
}

View File

@ -5,7 +5,7 @@
// DO NOT EDIT MANUALLY
package sbt.internal.bsp.codec
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
trait JvmRunEnvironmentResultFormats { self: sbt.internal.bsp.codec.JvmEnvironmentItemFormats with sjsonnew.BasicJsonProtocol =>
trait JvmRunEnvironmentResultFormats { self: sbt.internal.bsp.codec.JvmEnvironmentItemFormats with sbt.internal.bsp.codec.BuildTargetIdentifierFormats with sjsonnew.BasicJsonProtocol =>
implicit lazy val JvmRunEnvironmentResultFormat: JsonFormat[sbt.internal.bsp.JvmRunEnvironmentResult] = new JsonFormat[sbt.internal.bsp.JvmRunEnvironmentResult] {
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.JvmRunEnvironmentResult = {
__jsOpt match {

View File

@ -5,7 +5,7 @@
// DO NOT EDIT MANUALLY
package sbt.internal.bsp.codec
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
trait JvmTestEnvironmentResultFormats { self: sbt.internal.bsp.codec.JvmEnvironmentItemFormats with sjsonnew.BasicJsonProtocol =>
trait JvmTestEnvironmentResultFormats { self: sbt.internal.bsp.codec.JvmEnvironmentItemFormats with sbt.internal.bsp.codec.BuildTargetIdentifierFormats with sjsonnew.BasicJsonProtocol =>
implicit lazy val JvmTestEnvironmentResultFormat: JsonFormat[sbt.internal.bsp.JvmTestEnvironmentResult] = new JsonFormat[sbt.internal.bsp.JvmTestEnvironmentResult] {
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.JvmTestEnvironmentResult = {
__jsOpt match {

View File

@ -5,7 +5,7 @@
// DO NOT EDIT MANUALLY
package sbt.internal.bsp.codec
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
trait OutputPathsItemFormats { self: sbt.internal.bsp.codec.BuildTargetIdentifierFormats with sbt.internal.bsp.codec.OutputPathItemFormats with sjsonnew.BasicJsonProtocol =>
trait OutputPathsItemFormats { self: sbt.internal.bsp.codec.BuildTargetIdentifierFormats with sjsonnew.BasicJsonProtocol with sbt.internal.bsp.codec.OutputPathItemFormats =>
implicit lazy val OutputPathsItemFormat: JsonFormat[sbt.internal.bsp.OutputPathsItem] = new JsonFormat[sbt.internal.bsp.OutputPathsItem] {
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.OutputPathsItem = {
__jsOpt match {

View File

@ -5,7 +5,7 @@
// DO NOT EDIT MANUALLY
package sbt.internal.bsp.codec
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
trait OutputPathsResultFormats { self: sbt.internal.bsp.codec.OutputPathsItemFormats with sjsonnew.BasicJsonProtocol =>
trait OutputPathsResultFormats { self: sbt.internal.bsp.codec.OutputPathsItemFormats with sbt.internal.bsp.codec.BuildTargetIdentifierFormats with sjsonnew.BasicJsonProtocol with sbt.internal.bsp.codec.OutputPathItemFormats =>
implicit lazy val OutputPathsResultFormat: JsonFormat[sbt.internal.bsp.OutputPathsResult] = new JsonFormat[sbt.internal.bsp.OutputPathsResult] {
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.OutputPathsResult = {
__jsOpt match {

View File

@ -9,7 +9,7 @@ package sbt.internal.bsp
object OutputPathItemKind {
/** The output path item references a normal file. */
/** The output path item references a normal file. */
val File: Int = 1
/** The output path item references a directory. */

View File

@ -297,7 +297,10 @@ trait Import {
type IvyScala = sbt.librarymanagement.ScalaModuleInfo
val JCenterRepository = sbt.librarymanagement.Resolver.JCenterRepository
val JavaNet2Repository = sbt.librarymanagement.Resolver.JavaNet2Repository
val License = sbt.librarymanagement.License
// todo: fix
// val License = sbt.librarymanagement.License
type LogicalClock = sbt.librarymanagement.LogicalClock
val LogicalClock = sbt.librarymanagement.LogicalClock
type MakePomConfiguration = sbt.librarymanagement.MakePomConfiguration