-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.sbt
More file actions
61 lines (57 loc) · 1.54 KB
/
build.sbt
File metadata and controls
61 lines (57 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import scala.collection.JavaConverters._
import java.nio.file.Paths
import java.nio.file.Files
inThisBuild(
List(
scalaVersion := "2.12.15",
organization := "com.example"
)
)
lazy val a = project
.settings(
libraryDependencies += "com.lihaoyi" %% "geny" % "1.1.1",
libraryDependencies += "junit" % "junit" % "4.13.2"
)
lazy val b = project
.dependsOn(a)
.settings(
// Test to ensure the plugin works with explicitly set java home
// On Java 8 the java.home property returns JRE path, not JDK path.
// so we try and work around it hoping that JAVA_HOME is set by executing
// environment
javaHome := {
println(sys.env.get("JAVA_HOME"))
Some(
new File(
sys.env.getOrElse("JAVA_HOME", System.getProperty("java.home"))
)
)
}
)
commands += Command.command("checkLsif") { s =>
val dumpPath =
(ThisBuild / baseDirectory).value / "target" / "sbt-sourcegraph" / "index.scip"
val index =
lib.codeintel.scip.Scip.Index.parseFrom(Files.readAllBytes(dumpPath.toPath))
val packageNames = index.getDocumentsList.asScala
.flatMap(_.getOccurrencesList.asScala)
.map(_.getSymbol)
.filterNot(_.startsWith("local"))
.map(_.split(" ").toList)
.collect { case _ :: _ :: name :: _ => name }
.filterNot(_ == ".")
.distinct
.sorted
.toList
if (
packageNames != List(
"jdk",
"maven/com.lihaoyi/geny_2.12",
"maven/junit/junit",
"maven/org.scala-lang/scala-library"
)
) {
sys.error(packageNames.toString)
}
s
}