Skip to content

Commit b00807d

Browse files
committed
Simplify ScipBuildTool now that it is a Bazel-only worker
ScipBuildTool is dispatched exclusively from IndexCommand.run() when the Bazel aspect passes --scip-config, so a lot of its surface area was dead code. Net: -501 lines. ScipBuildTool: - No longer extends BuildTool. It does not participate in detection, so the name/isHidden/usedInCurrentDirectory overrides served no purpose. generateScip() is renamed to run(). - Drop the Kotlin compilation path (~150 lines, K2JVMCompiler, message collector, MPP common-source handling). The Bazel aspect only writes *.java files to sourceFiles, so this code was unreachable. - Drop Coursier-based dependency resolution. The aspect passes the full classpath directly, never the 'dependencies' field. - Drop Coursier-based JVM resolution (JvmIndex/JvmCache/JavaHome). The aspect always sets 'javaHome'; the worker now requires it. - Drop the JDK 'kind' branch and module-info partitioning. Bazel never sets 'kind'. - Drop the strictCompilation gate and the in-class ListBuffer that used to combine Java + Kotlin compile attempts. - Slim Config from 13 to 9 fields (drop dependencies, jvm, kind, plus the Dependency case class and custom codec). IndexCommand: - Drop --strict-compilation (only consumed by the removed code path). - Drop --scip-ignored-javac-option-prefixes and --scip-ignored-annotation-processors. These were never propagated by BazelBuildTool to the per-target invocations, so they were dead. Dependencies.scala: - Drop kotlinMPPCommon (sole caller was the removed Kotlin compile path). build.sbt: - Drop the cli project's runtime dependency on kotlin-compiler-embeddable and the four kotlin-scripting-* artifacts; nothing in the cli references them anymore. GradleJavaToolchains.scala: - Drop the @language("Groovy") IDE hint; its provider class was only available transitively via the kotlin-compiler-embeddable artifact we just removed.
1 parent cce9533 commit b00807d

5 files changed

Lines changed: 135 additions & 636 deletions

File tree

build.sbt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -235,14 +235,7 @@ lazy val cli = project
235235
"io.get-coursier" %% "coursier-jvm" % V.coursier,
236236
"org.scala-lang.modules" %% "scala-xml" % V.scalaXml,
237237
"com.lihaoyi" %% "requests" % V.requests,
238-
"org.scalameta" %% "moped" % V.moped,
239-
"org.jetbrains.kotlin" % "kotlin-compiler-embeddable" % V.kotlinVersion,
240-
"org.jetbrains.kotlin" % "kotlin-scripting-common" % V.kotlinVersion,
241-
"org.jetbrains.kotlin" % "kotlin-scripting-jvm" % V.kotlinVersion,
242-
"org.jetbrains.kotlin" % "kotlin-scripting-dependencies" %
243-
V.kotlinVersion,
244-
"org.jetbrains.kotlin" % "kotlin-scripting-dependencies-maven" %
245-
V.kotlinVersion
238+
"org.scalameta" %% "moped" % V.moped
246239
),
247240
(Compile / resourceGenerators) +=
248241
Def

scip-java/src/main/scala/com/sourcegraph/scip_java/Dependencies.scala

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@ import java.io.File
44
import java.nio.file.Path
55

66
import scala.concurrent.duration.Duration
7-
import scala.util.Try
87
import scala.xml.XML
98

109
import coursier.Fetch
1110
import coursier.Repositories
1211
import coursier.Resolve
13-
import coursier.cache.Cache
1412
import coursier.cache.CachePolicy
1513
import coursier.cache.FileCache
1614
import coursier.core._
@@ -43,39 +41,6 @@ object Dependencies {
4341
Repositories.centralGcs
4442
)
4543

46-
/**
47-
* Attempts to find the "common definitions" JAR for a potentially
48-
* MultiPlatform Project. We only support JVM for now, native and JS are not
49-
* supported. If it ends with '-jvm', we search for a JAR with the classifier
50-
* truncated. If it does not end with -jvm, we search for a JAR with the
51-
* -common classifier. This is non-exhaustive, and the classifiers are
52-
* completely arbitrary.
53-
*/
54-
def kotlinMPPCommon(
55-
group: String,
56-
artifact: String,
57-
version: String
58-
): Option[Path] =
59-
Try {
60-
val task = Fetch[Task](Cache.default)
61-
.withClassifiers(Set(Classifier.sources))
62-
.addRepositories(defaultExtraRepositories: _*)
63-
64-
if (artifact.endsWith("-jvm")) {
65-
val dependency = Dependencies.parseDependency(
66-
s"$group:${artifact.stripSuffix("-jvm")}:$version"
67-
)
68-
val result = task.addDependencies(dependency).runResult()
69-
return Some(result.files.head.toPath)
70-
}
71-
72-
val dependency = Dependencies.parseDependency(
73-
s"$group:$artifact-common:$version"
74-
)
75-
val result = task.addDependencies(dependency).runResult()
76-
result.files.head.toPath
77-
}.toOption
78-
7944
def resolveDependencies(
8045
dependencies: List[String],
8146
transitive: Boolean = true

scip-java/src/main/scala/com/sourcegraph/scip_java/buildtools/GradleJavaToolchains.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import scala.jdk.CollectionConverters._
99

1010
import com.sourcegraph.scip_java.Embedded
1111
import com.sourcegraph.scip_java.commands.IndexCommand
12-
import org.intellij.lang.annotations.Language
1312

1413
case class GradleJavaToolchains(
1514
toolchains: List[GradleJavaCompiler],
@@ -86,7 +85,6 @@ object GradleJavaToolchains {
8685
)
8786
val gradleVersionPath = tmp.resolve("gradle-version.txt")
8887
val taskName = "scipDetectJavaToolchains"
89-
@Language("Groovy")
9088
val script =
9189
s"""|
9290
|try {

0 commit comments

Comments
 (0)