Merge pull request #5202 from regadas/fix/5110

Fix #5110: allow semanticdbVersion override
This commit is contained in:
eugene yokota 2019-10-20 00:25:39 -04:00 committed by GitHub
commit 6444172538
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 33 additions and 6 deletions

View File

@ -767,6 +767,7 @@ lazy val mainProj = (project in file("main"))
exclude[DirectMissingMethodProblem]("sbt.plugins.SbtPlugin.requires"),
exclude[DirectMissingMethodProblem]("sbt.ResolvedClasspathDependency.apply"),
exclude[DirectMissingMethodProblem]("sbt.ClasspathDependency.apply"),
exclude[IncompatibleSignatureProblem]("sbt.plugins.SemanticdbPlugin.globalSettings"),
// File -> Source
exclude[DirectMissingMethodProblem]("sbt.Defaults.cleanFilesTask"),

View File

@ -17,18 +17,18 @@ object SemanticdbPlugin extends AutoPlugin {
override def requires = JvmPlugin
override def trigger = allRequirements
override lazy val globalSettings = Seq(
override lazy val globalSettings: Seq[Def.Setting[_]] = Seq(
semanticdbEnabled := false,
semanticdbIncludeInJar := false,
semanticdbOptions := List("-Yrangepos"),
semanticdbVersion := "4.1.0",
semanticdbVersion := "4.2.3"
)
override lazy val projectSettings: Seq[Def.Setting[_]] = Seq(
semanticdbCompilerPlugin := {
val v = semanticdbVersion.value
("org.scalameta" % "semanticdb-scalac" % v).cross(CrossVersion.full)
}
)
override lazy val projectSettings = Seq(
},
allDependencies ++= {
val sdb = semanticdbEnabled.value
val m = semanticdbCompilerPlugin.value

View File

@ -0,0 +1,18 @@
ThisBuild / scalaVersion := "2.12.8"
ThisBuild / semanticdbEnabled := true
ThisBuild / semanticdbVersion := "4.2.3"
ThisBuild / semanticdbIncludeInJar := false
lazy val root = (project in file("."))
lazy val check = taskKey[Unit]("Checks the configured semanticdbVersion")
check := {
val expected = Some("4.2.3")
val actual = allDependencies
.value
.find(_.name == "semanticdb-scalac")
.map(_.revision)
assert(actual == expected, s"Expected version to be $expected, was $actual")
}

View File

@ -0,0 +1,7 @@
package foo
object Test {
def main(args: Array[String]): Unit = {
println("hello world")
}
}

View File

@ -0,0 +1 @@
> check