mirror of https://github.com/sbt/sbt.git
Merge pull request #6713 from xuwei-k/scala-3-build-settings-1
Update build settings for Scala 3
This commit is contained in:
commit
d01cdd53e1
25
build.sbt
25
build.sbt
|
|
@ -102,8 +102,15 @@ def commonBaseSettings: Seq[Setting[_]] = Def.settings(
|
|||
run / fork := true,
|
||||
)
|
||||
def commonSettings: Seq[Setting[_]] =
|
||||
commonBaseSettings :+
|
||||
addCompilerPlugin(kindProjector)
|
||||
commonBaseSettings :+ {
|
||||
libraryDependencies ++= {
|
||||
if (scalaBinaryVersion.value == "3") {
|
||||
Nil
|
||||
} else {
|
||||
Seq(compilerPlugin(kindProjector))
|
||||
}
|
||||
}
|
||||
}
|
||||
def utilCommonSettings: Seq[Setting[_]] =
|
||||
baseSettings :+ (crossScalaVersions := (scala212 :: scala213 :: Nil))
|
||||
|
||||
|
|
@ -463,7 +470,7 @@ lazy val utilScripted = (project in file("internal") / "util-scripted")
|
|||
.settings(
|
||||
utilCommonSettings,
|
||||
name := "Util Scripted",
|
||||
libraryDependencies += scalaParsers,
|
||||
libraryDependencies += scalaParsers.value,
|
||||
utilMimaSettings,
|
||||
)
|
||||
.configure(addSbtIO)
|
||||
|
|
@ -477,7 +484,7 @@ lazy val testingProj = (project in file("testing"))
|
|||
baseSettings,
|
||||
name := "Testing",
|
||||
libraryDependencies ++= Seq(
|
||||
scalaXml,
|
||||
scalaXml.value,
|
||||
testInterface,
|
||||
launcherInterface,
|
||||
sjsonNewScalaJson.value
|
||||
|
|
@ -803,7 +810,13 @@ lazy val coreMacrosProj = (project in file("core-macros"))
|
|||
.settings(
|
||||
baseSettings :+ (crossScalaVersions := (scala212 :: scala213 :: Nil)),
|
||||
name := "Core Macros",
|
||||
libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value,
|
||||
libraryDependencies += {
|
||||
if (scalaBinaryVersion.value == "3") {
|
||||
"org.scala-lang" % "scala-compiler" % scala213
|
||||
} else {
|
||||
"org.scala-lang" % "scala-compiler" % scalaVersion.value
|
||||
}
|
||||
},
|
||||
SettingKey[Boolean]("exportPipelining") := false,
|
||||
mimaSettings,
|
||||
)
|
||||
|
|
@ -913,7 +926,7 @@ lazy val mainProj = (project in file("main"))
|
|||
}
|
||||
},
|
||||
libraryDependencies ++=
|
||||
(Seq(scalaXml, launcherInterface, caffeine, lmCoursierShaded) ++ log4jModules),
|
||||
(Seq(scalaXml.value, launcherInterface, caffeine, lmCoursierShaded) ++ log4jModules),
|
||||
libraryDependencies ++= (scalaVersion.value match {
|
||||
case v if v.startsWith("2.12.") => List()
|
||||
case _ => List(scalaPar)
|
||||
|
|
|
|||
|
|
@ -100,9 +100,27 @@ object Dependencies {
|
|||
val scalaVerify = "com.eed3si9n.verify" %% "verify" % "1.0.0"
|
||||
val templateResolverApi = "org.scala-sbt" % "template-resolver" % "0.1"
|
||||
|
||||
val scalaXml = "org.scala-lang.modules" %% "scala-xml" % "1.3.0"
|
||||
val scalaParsers = "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2"
|
||||
val scalaReflect = Def.setting("org.scala-lang" % "scala-reflect" % scalaVersion.value)
|
||||
val scalaXml = Def.setting(
|
||||
if (scalaBinaryVersion.value == "3") {
|
||||
"org.scala-lang.modules" %% "scala-xml" % "2.0.1"
|
||||
} else {
|
||||
"org.scala-lang.modules" %% "scala-xml" % "1.3.0"
|
||||
}
|
||||
)
|
||||
val scalaParsers = Def.setting(
|
||||
if (scalaBinaryVersion.value == "3") {
|
||||
"org.scala-lang.modules" %% "scala-parser-combinators" % "2.1.0"
|
||||
} else {
|
||||
"org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2"
|
||||
}
|
||||
)
|
||||
val scalaReflect = Def.setting(
|
||||
if (scalaBinaryVersion.value == "3") {
|
||||
"org.scala-lang" % "scala-reflect" % scala213
|
||||
} else {
|
||||
"org.scala-lang" % "scala-reflect" % scalaVersion.value
|
||||
}
|
||||
)
|
||||
val scalaPar = "org.scala-lang.modules" %% "scala-parallel-collections" % "1.0.0"
|
||||
|
||||
// specify all of log4j modules to prevent misalignment
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ object HouseRulesPlugin extends AutoPlugin {
|
|||
})
|
||||
.value
|
||||
.toList,
|
||||
scalacOptions ++= "-Ykind-projector".ifScala3.value.toList,
|
||||
scalacOptions ++= "-Yinline-warnings".ifScala211OrMinus.value.toList,
|
||||
scalacOptions ++= "-Yno-adapted-args".ifScala212OrMinus.value.toList,
|
||||
scalacOptions += "-Ywarn-dead-code",
|
||||
|
|
@ -44,5 +45,9 @@ object HouseRulesPlugin extends AutoPlugin {
|
|||
def ifScala211OrPlus = ifScalaGte(11)
|
||||
def ifScala212OrMinus = ifScalaLte(12)
|
||||
def ifScala213OrMinus = ifScalaLte(13)
|
||||
def ifScala3 = Def.setting(
|
||||
if (scalaBinaryVersion.value == "3") Seq(__x)
|
||||
else Nil
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue