mirror of https://github.com/sbt/sbt.git
Scala 3 support
This commit is contained in:
parent
58912ff8f6
commit
cf98ce2ee0
44
build.sbt
44
build.sbt
|
|
@ -17,12 +17,33 @@ inThisBuild(List(
|
|||
),
|
||||
semanticdbEnabled := true,
|
||||
semanticdbVersion := "4.5.9",
|
||||
scalafixDependencies += "net.hamnaberg" %% "dataclass-scalafix" % dataclassScalafixV
|
||||
scalafixDependencies += "net.hamnaberg" %% "dataclass-scalafix" % dataclassScalafixV,
|
||||
scalafixScalaBinaryVersion := {
|
||||
(ThisBuild / scalaBinaryVersion).value match {
|
||||
case "3" => "2.13"
|
||||
case v => v
|
||||
}
|
||||
},
|
||||
))
|
||||
|
||||
val coursierVersion0 = "2.1.0-M5"
|
||||
val lmVersion = "1.3.4"
|
||||
val lm2_13Version = "1.5.0-M3"
|
||||
val lm3Version = "2.0.0-SNAPSHOT"
|
||||
|
||||
lazy val scalafixGen = Def.taskDyn {
|
||||
val root = (ThisBuild / baseDirectory).value.toURI.toString
|
||||
val from = (Compile / sourceDirectory).value
|
||||
val to = (Compile / sourceManaged).value
|
||||
val outFrom = from.toURI.toString.stripSuffix("/").stripPrefix(root)
|
||||
val outTo = to.toURI.toString.stripSuffix("/").stripPrefix(root)
|
||||
Def.task {
|
||||
(Compile / scalafix)
|
||||
.toTask(s" https://raw.githubusercontent.com/hamnis/dataclass-scalafix/9d1bc56b0b53c537293f1218d5600a2e987ee82a/rules/src/main/scala/fix/GenerateDataClass.scala --out-from=$outFrom --out-to=$outTo")
|
||||
.value
|
||||
(to ** "*.scala").get
|
||||
}
|
||||
}
|
||||
|
||||
def dataclassGen(data: Reference) = Def.taskDyn {
|
||||
val root = (ThisBuild / baseDirectory).value.toURI.toString
|
||||
|
|
@ -41,8 +62,11 @@ def dataclassGen(data: Reference) = Def.taskDyn {
|
|||
|
||||
def lmIvy = Def.setting {
|
||||
"org.scala-sbt" %% "librarymanagement-ivy" % {
|
||||
if (scalaBinaryVersion.value == "2.12") lmVersion
|
||||
else lm2_13Version
|
||||
scalaBinaryVersion.value match {
|
||||
case "2.12" => lmVersion
|
||||
case "2.13" => lm2_13Version
|
||||
case _ => lm3Version
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -52,7 +76,7 @@ lazy val definitions = project
|
|||
.settings(
|
||||
crossScalaVersions := Seq(scala212, scala213),
|
||||
libraryDependencies ++= Seq(
|
||||
"io.get-coursier" %% "coursier" % coursierVersion0,
|
||||
("io.get-coursier" %% "coursier" % coursierVersion0).cross(CrossVersion.for3Use2_13),
|
||||
"net.hamnaberg" %% "dataclass-annotation" % dataclassScalafixV % Provided,
|
||||
lmIvy.value,
|
||||
),
|
||||
|
|
@ -67,7 +91,7 @@ lazy val `lm-coursier` = project
|
|||
Mima.settings,
|
||||
Mima.lmCoursierFilters,
|
||||
libraryDependencies ++= Seq(
|
||||
"io.get-coursier" %% "coursier" % coursierVersion0,
|
||||
("io.get-coursier" %% "coursier" % coursierVersion0).cross(CrossVersion.for3Use2_13),
|
||||
"net.hamnaberg" %% "dataclass-annotation" % dataclassScalafixV % Provided,
|
||||
|
||||
// We depend on librarymanagement-ivy rather than just
|
||||
|
|
@ -76,7 +100,7 @@ lazy val `lm-coursier` = project
|
|||
// IvySbt#Module (seems DependencyResolutionInterface.moduleDescriptor
|
||||
// is ignored).
|
||||
lmIvy.value,
|
||||
"org.scalatest" %% "scalatest" % "3.2.13" % Test
|
||||
("org.scalatest" %% "scalatest" % "3.2.13" % Test).cross(CrossVersion.for3Use2_13),
|
||||
),
|
||||
Test / test := {
|
||||
(publishLocal in customProtocolForTest212).value
|
||||
|
|
@ -136,13 +160,13 @@ lazy val `lm-coursier-shaded` = project
|
|||
yield ShadingRule.moveUnder(ns, "lmcoursier.internal.shaded")
|
||||
},
|
||||
libraryDependencies ++= Seq(
|
||||
"io.get-coursier" %% "coursier" % coursierVersion0,
|
||||
("io.get-coursier" %% "coursier" % coursierVersion0).cross(CrossVersion.for3Use2_13),
|
||||
"net.hamnaberg" %% "dataclass-annotation" % dataclassScalafixV % Provided,
|
||||
"org.scala-lang.modules" %% "scala-collection-compat" % "2.8.1",
|
||||
("org.scala-lang.modules" %% "scala-collection-compat" % "2.8.1").cross(CrossVersion.for3Use2_13),
|
||||
// "org.scala-lang.modules" %% "scala-xml" % "2.1.0", // depending on that one so that it doesn't get shaded
|
||||
lmIvy.value,
|
||||
"org.scalatest" %% "scalatest" % "3.2.13" % Test
|
||||
)
|
||||
("org.scalatest" %% "scalatest" % "3.2.13" % Test).cross(CrossVersion.for3Use2_13),
|
||||
),
|
||||
)
|
||||
|
||||
lazy val `sbt-coursier-shared` = project
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ class CoursierDependencyResolution(
|
|||
|
||||
val so = conf.scalaOrganization.map(Organization(_))
|
||||
.orElse(module0.scalaModuleInfo.map(m => Organization(m.scalaOrganization)))
|
||||
.getOrElse(org"org.scala-lang")
|
||||
.getOrElse(Organization("org.scala-lang"))
|
||||
val sv = conf.scalaVersion
|
||||
.orElse(module0.scalaModuleInfo.map(_.scalaFullVersion))
|
||||
// FIXME Manage to do stuff below without a scala version?
|
||||
|
|
@ -271,7 +271,7 @@ class CoursierDependencyResolution(
|
|||
)
|
||||
|
||||
val sbtBootJarOverrides = SbtBootJars(
|
||||
conf.sbtScalaOrganization.fold(org"org.scala-lang")(Organization(_)),
|
||||
conf.sbtScalaOrganization.fold(Organization("org.scala-lang"))(Organization(_)),
|
||||
conf.sbtScalaVersion.getOrElse(sv),
|
||||
conf.sbtScalaJars
|
||||
)
|
||||
|
|
|
|||
|
|
@ -81,7 +81,12 @@ final case class ResolutionParams(
|
|||
}
|
||||
|
||||
override lazy val hashCode =
|
||||
ResolutionParams.unapply(this).get.##
|
||||
this match {
|
||||
case ResolutionParams(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) =>
|
||||
(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) .##
|
||||
}
|
||||
|
||||
// ResolutionParams.unapply(this).get.##
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
sbt.version=1.4.9
|
||||
sbt.version=1.7.1
|
||||
|
|
|
|||
Loading…
Reference in New Issue