Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-P:semanticdb:targetroot is not used #879

Closed
eed3si9n opened this issue Sep 21, 2018 · 3 comments · Fixed by #882
Closed

-P:semanticdb:targetroot is not used #879

eed3si9n opened this issue Sep 21, 2018 · 3 comments · Fixed by #882

Comments

@eed3si9n
Copy link
Contributor

steps

project/build.properties

sbt.version=1.2.3

project/plugins.scala

addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.8.0-RC1")

build.sbt

ThisBuild / organization := "com.example"
ThisBuild / version      := "0.1.0-SNAPSHOT"
ThisBuild / scalaVersion := "2.12.6"

// Scalafix plugin
ThisBuild / scalafixDependencies +=
  "com.eed3si9n.fix" %% "scalafix-noinfer" % "0.1.0-M1"

lazy val root = (project in file(".")).
  settings(
    name := "hello",
    addCompilerPlugin(scalafixSemanticdb),
    scalacOptions ++= List(
      "-Yrangepos",
      "-P:semanticdb:synthetics:on",
    ),
    Compile / scalacOptions += {
      val t = crossTarget.value / "meta"
      s"-P:semanticdb:targetroot:$t"
    },
  )

Main.scala

package example

case class Animal()

object Main extends App {
  List(Animal()).contains("1")
  Option(1) + "what"

}
> scalafix

problem

[error] SemanticDB not found: META-INF/semanticdb/Main.scala.semanticdb
[error] (Compile / scalafix) scalafix.sbt.ScalafixFailed: MissingSemanticdbError

expectation

I can move semanticdb out of classes directory, and still use Scalafix.

notes

https://github.com/scalacenter/scalafix/blob/v0.8.0-RC1/scalafix-core/src/main/scala/scalafix/v1/SemanticDocument.scala#L57-L58

@olafurpg
Copy link
Contributor

Thanks for reporting! I agree Scalafix should respect -P:semanticdb:targetroot if it's defined. We already know scalacOptions so this should not be difficult to fix.

@olafurpg
Copy link
Contributor

Pending fix in #882

@eed3si9n
Copy link
Contributor Author

Nice. Thanks for the quick fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants