Skip to content

Commit 4373c10

Browse files
committed
merged semanticdb/input/build.sbt with project/Build.scala
1 parent 4a5314d commit 4373c10

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

build.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ val `dotty-language-server` = Build.`dotty-language-server`
1313
val `dotty-bench` = Build.`dotty-bench`
1414
val `dotty-bench-bootstrapped` = Build.`dotty-bench-bootstrapped`
1515
val `dotty-semanticdb` = Build.`dotty-semanticdb`
16+
val `dotty-semanticdb-input` = Build.`dotty-semanticdb-input`
1617
val `scala-library` = Build.`scala-library`
1718
val `scala-compiler` = Build.`scala-compiler`
1819
val `scala-reflect` = Build.`scala-reflect`

project/Build.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -919,6 +919,11 @@ object Build {
919919
lazy val `dotty-bench-bootstrapped` = project.in(file("bench")).asDottyBench(Bootstrapped)
920920

921921
lazy val `dotty-semanticdb` = project.in(file("semanticdb")).asDottySemanticdb(Bootstrapped)
922+
lazy val `dotty-semanticdb-input` = project.in(file("semanticdb/input")).settings(
923+
scalaVersion := "2.12.7",
924+
scalacOptions += "-Yrangepos",
925+
addCompilerPlugin("org.scalameta" % "semanticdb-scalac" % "4.0.0" cross CrossVersion.full)
926+
)
922927

923928
// Depend on dotty-library so that sbt projects using dotty automatically
924929
// depend on the dotty-library
@@ -1317,6 +1322,7 @@ object Build {
13171322
enablePlugins(JmhPlugin)
13181323

13191324
def asDottySemanticdb(implicit mode: Mode): Project = project.withCommonSettings.
1325+
aggregate(`dotty-semanticdb-input`).
13201326
dependsOn(dottyCompiler).
13211327
settings(semanticdbSettings)
13221328

semanticdb/test/dotty/semanticdb/Semanticdbs.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import scala.collection.JavaConverters._
77
import dotty.tools.dotc.util.SourceFile
88

99
object Semanticdbs {
10-
10+
private val buildSubFolder = "semanticdb/input/"
1111
/**
1212
* Utility to load SemanticDB for Scala source files.
1313
*
@@ -17,7 +17,7 @@ object Semanticdbs {
1717
* if you only care about reading SemanticDB files from a single project.
1818
*/
1919
class Loader(sourceroot: Path, classpath: List[Path]) {
20-
private val META_INF = Paths.get("META-INF", "semanticdb")
20+
private val META_INF = Paths.get("META-INF", "semanticdb").resolve(buildSubFolder)
2121
private val classLoader = new java.net.URLClassLoader(classpath.map(_.toUri.toURL).toArray)
2222
/** Returns a SemanticDB for a single Scala source file, if any. The path must be absolute. */
2323
def resolve(scalaAbsolutePath: Path): Option[s.TextDocument] = {
@@ -43,7 +43,7 @@ object Semanticdbs {
4343
scalaRelativePath: Path,
4444
semanticdbAbsolutePath: Path
4545
): s.TextDocument = {
46-
val reluri = scalaRelativePath.iterator.asScala.mkString("/")
46+
val reluri = buildSubFolder + scalaRelativePath.iterator.asScala.mkString("/")
4747
val sdocs = parseTextDocuments(semanticdbAbsolutePath)
4848
sdocs.documents.find(_.uri == reluri) match {
4949
case None => throw new NoSuchElementException(reluri)

0 commit comments

Comments
 (0)