Merge pull request #360 from eed3si9n/wip/2.13

Add Scala 2.13 support
This commit is contained in:
eugene yokota 2021-01-03 01:06:01 -05:00 committed by GitHub
commit 4fab9e0886
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 41 additions and 33 deletions

View File

@ -37,7 +37,7 @@ jobs:
run: |
case ${{ matrix.jobtype }} in
1)
sbt -v -Dfile.encoding=UTF8 scalafmtCheckAll whitesourceCheckPolicies test packagedArtifacts
sbt -v -Dfile.encoding=UTF8 scalafmtCheckAll whitesourceCheckPolicies +test +packagedArtifacts
;;
*)
echo unknown jobtype

View File

@ -54,7 +54,8 @@ def commonSettings: Seq[Setting[_]] = Def.settings(
case sv if sv.startsWith("2.10") =>
old diff List("-Xfuture", "-Ywarn-unused", "-Ywarn-unused-import")
case sv if sv.startsWith("2.11") => old ++ List("-Ywarn-unused", "-Ywarn-unused-import")
case _ => old ++ List("-Ywarn-unused", "-Ywarn-unused-import", "-YdisableFlatCpCaching")
case sv if sv.startsWith("2.12") => old ++ List("-Ywarn-unused", "-Ywarn-unused-import", "-YdisableFlatCpCaching")
case _ => old
}
},
inCompileAndTest(

View File

@ -59,11 +59,11 @@ object EvictionError {
}: _*)
def calculateCompatible(p: EvictionPair): (Boolean, String) = {
val winnerOpt = p.winner map { _.module }
val extraAttributes = (p.winner match {
case Some(r) => r.extraAttributes
val extraAttributes = ((p.winner match {
case Some(r) => r.extraAttributes.toMap
case _ => Map.empty
}) ++ (winnerOpt match {
case Some(w) => w.extraAttributes
}): collection.immutable.Map[String, String]) ++ (winnerOpt match {
case Some(w) => w.extraAttributes.toMap
case _ => Map.empty
})
// prioritize user-defined version scheme to allow overriding the real scheme

View File

@ -332,10 +332,10 @@ object EvictionWarning {
def guessCompatible(p: EvictionPair): Boolean =
p.evicteds forall { r =>
val winnerOpt = p.winner map { _.module }
val extraAttributes = (p.winner match {
val extraAttributes = ((p.winner match {
case Some(r) => r.extraAttributes
case _ => Map.empty
}) ++ (winnerOpt match {
}): collection.immutable.Map[String, String]) ++ (winnerOpt match {
case Some(w) => w.extraAttributes
case _ => Map.empty
})

View File

@ -63,7 +63,7 @@ private[librarymanagement] abstract class ModuleIDExtra {
/** Returns the extra attributes except for ones marked as information only (ones that typically would not be used for dependency resolution). */
def extraDependencyAttributes: Map[String, String] =
extraAttributes.filterKeys(!_.startsWith(SbtPomExtraProperties.POM_INFO_KEY_PREFIX))
extraAttributes.filterKeys(!_.startsWith(SbtPomExtraProperties.POM_INFO_KEY_PREFIX)).toMap
@deprecated(
"Use `cross(CrossVersion)`, the variant accepting a CrossVersion value constructed by a member of the CrossVersion object instead.",

View File

@ -2,9 +2,10 @@ package sbt.librarymanagement
import java.io.File
import org.scalatest._
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers
class UpdateReportSpec extends FlatSpec with Matchers {
class UpdateReportSpec extends AnyFlatSpec with Matchers {
"UpdateReport.toString" should "have a nice toString" in {
assert(updateReport.toString === s"""
|Update report:

View File

@ -2,6 +2,7 @@ package sbt
package internal
package librarymanagement
import org.scalatest._
import org.scalatest.flatspec.AnyFlatSpec
import org.scalatest.matchers.should.Matchers
abstract class UnitSpec extends FlatSpec with Matchers
abstract class UnitSpec extends AnyFlatSpec with Matchers

View File

@ -1,9 +1,10 @@
package sbt.librarymanagement
import sbt.librarymanagement.Configurations.config
import org.scalatest._
import org.scalatest.funspec.AnyFunSpec
import org.scalatest.matchers.should.Matchers
class ConfigMacroTest extends FunSpec with Matchers {
class ConfigMacroTest extends AnyFunSpec with Matchers {
describe("Configurations.config") {
it("should validate the ID in compile time") {
"""val A = config("a")""" should compile

View File

@ -1,8 +1,9 @@
package sbt.librarymanagement
import org.scalatest.{ FreeSpec, Matchers }
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers
class SemanticSelectorSpec extends FreeSpec with Matchers {
class SemanticSelectorSpec extends AnyFreeSpec with Matchers {
semsel("<=1.2.3") { sel =>
assertMatches(sel, "1.2.3")
assertMatches(sel, "1.2-beta")

View File

@ -1,9 +1,11 @@
package sbt.librarymanagement
import org.scalatest.{ FreeSpec, Inside, Matchers }
import org.scalatest.Inside
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers
// This is a specification to check VersionNumber and VersionNumberCompatibility.
class VersionNumberSpec extends FreeSpec with Matchers with Inside {
class VersionNumberSpec extends AnyFreeSpec with Matchers with Inside {
import VersionNumber.{ EarlySemVer, SemVer, PackVer }
version("1") { v =>

View File

@ -154,7 +154,7 @@ object CustomPomParser {
(propertyAttributes - ExtraAttributesKey) map { case (k, v) => ("e:" + k, v) }
private[this] def shouldBeUnqualified(m: Map[String, String]): Map[String, String] =
m.filterKeys(unqualifiedKeys)
m.filterKeys(unqualifiedKeys).toMap
private[this] def addExtra(
properties: Map[String, String],
@ -182,7 +182,7 @@ object CustomPomParser {
def filterCustomExtra(item: ExtendableItem, include: Boolean): Map[String, String] =
(qualifiedExtra(item) filterKeys { k =>
qualifiedIsExtra(k) == include
})
}).toMap
def writeDependencyExtra(s: Seq[DependencyDescriptor]): Seq[String] =
PomExtraDependencyAttributes.writeDependencyExtra(s)

View File

@ -237,7 +237,7 @@ object IvyActions {
}.toMap
def grouped[T](grouping: ModuleID => T)(mods: Seq[ModuleID]): Map[T, Set[String]] =
mods groupBy (grouping) mapValues (_.map(_.revision).toSet)
mods.groupBy(grouping).mapValues(_.map(_.revision).toSet).toMap
def addExcluded(
report: UpdateReport,

View File

@ -231,7 +231,7 @@ object IvyRetrieve {
reports(report) map configurationReport,
updateStats(report),
Map.empty
) recomputeStamps ()
).recomputeStamps()
def updateStats(report: ResolveReport): UpdateStats =
UpdateStats(report.getResolveTime, report.getDownloadTime, report.getDownloadSize, false)
def configurationReport(confReport: ConfigurationResolveReport): ConfigurationReport =

View File

@ -47,20 +47,20 @@ private[sbt] object IvyCredentialsLookup {
val map = credKeyringField.get(null).asInstanceOf[java.util.HashMap[String, Any]]
// make a clone of the set...
(map.keySet.asScala.map {
case KeySplit(realm, host) => Realm(host, realm)
case host => Host(host)
})(collection.breakOut)
case KeySplit(realm, host) => (Realm(host, realm): CredentialKey)
case host => (Host(host): CredentialKey)
}).toSet
}
/**
* A mapping of host -> realms in the ivy credentials store.
*/
def realmsForHost: Map[String, Set[String]] =
keyringKeys collect {
(keyringKeys collect {
case x: Realm => x
} groupBy { realm =>
realm.host
} mapValues { realms =>
realms map (_.realm)
}
}).toMap
}

View File

@ -80,7 +80,7 @@ object PomExtraDependencyAttributes {
def filterCustomExtra(item: ExtendableItem, include: Boolean): Map[String, String] =
(qualifiedExtra(item) filterKeys { k =>
qualifiedIsExtra(k) == include
})
}).toMap
def qualifiedIsExtra(k: String): Boolean =
k.endsWith(ScalaVersionKey) || k.endsWith(SbtVersionKey)

View File

@ -2,10 +2,10 @@ package sbt.internal.librarymanagement
import java.io.IOException
import org.scalatest.FunSuite
import org.scalatest.funsuite.AnyFunSuite
import sbt.internal.librarymanagement.IvyUtil._
class IvyUtilSpec extends FunSuite {
class IvyUtilSpec extends AnyFunSuite {
test("503 should be a TransientNetworkException") {
val statusCode503Exception =
new IOException("Server returned HTTP response code: 503 for URL:")

View File

@ -3,7 +3,8 @@ import Keys._
import sbt.contraband.ContrabandPlugin.autoImport._
object Dependencies {
val scala212 = "2.12.10"
val scala212 = "2.12.12"
val scala213 = "2.13.4"
def nightlyVersion: Option[String] =
sys.env.get("BUILD_VERSION") orElse sys.props.get("sbt.build.version")
@ -51,7 +52,7 @@ object Dependencies {
val scalaReflect = Def.setting { "org.scala-lang" % "scala-reflect" % scalaVersion.value }
val scalaCompiler = Def.setting { "org.scala-lang" % "scala-compiler" % scalaVersion.value }
val scalaXml = "org.scala-lang.modules" %% "scala-xml" % "1.2.0"
val scalaTest = "org.scalatest" %% "scalatest" % "3.0.6-SNAP5"
val scalaTest = "org.scalatest" %% "scalatest" % "3.2.0"
val scalaVerify = "com.eed3si9n.verify" %% "verify" % "0.1.0"
val scalaCheck = "org.scalacheck" %% "scalacheck" % "1.14.0"
val sjsonnew = Def.setting {