Skip to content

Commit e67f91c

Browse files
authored
Drop support for indexing Scala code (#883)
- Remove SbtBuildTool, MillBuildTool, ScalaCompilerClassLoader, ScalaVersion - Remove all Scala minimized fixtures and snapshot outputs (ujson, minimized-scala) - Remove sbt and mill from auto-detected build tools - Remove Scala/SBT/Mill versions and build info keys from build.sbt - Remove Scala presentation compiler code from TestCompiler - Remove Scala plugin support from semanticdb-gradle-plugin - Drop -build-tool:mill flag from semanticdb-javac - Remove Scala-specific synthetic-symbol handling from scip-semanticdb - Update docs and README to reflect Java/Kotlin-only support - Remove mill from flake.nix dev shell
1 parent 11d0692 commit e67f91c

74 files changed

Lines changed: 53 additions & 15340 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CONTRIBUTING.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,6 @@ sbt/BSP/Bloop.
8585

8686
It's best to run tests from the sbt shell, not from the IntelliJ UI.
8787

88-
## Importing the project with Metals
89-
90-
While the cross-language support won't be as rich as it is in IntelliJ,
91-
[Metals](https://scalameta.org/metals/) does offer rich language support for
92-
Scala and basic Java navigation support (thanks to scip-java!). When using
93-
Metals and your editor of choice it's recommended to use sbt as your build
94-
server. This isn't the default with Metals, so you'll want to use the `Metals:
95-
Switch build server` command and choose `sbt`.
96-
9788
## Tests are written in Scala
9889

9990
This codebases uses the Scala library [MUnit](https://scalameta.org/munit/) to

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Java, Scala, and Kotlin indexer for [SCIP](https://github.com/sourcegraph/scip) ![](https://img.shields.io/badge/status-development-green?style=flat)
1+
# Java and Kotlin indexer for [SCIP](https://github.com/sourcegraph/scip) ![](https://img.shields.io/badge/status-development-green?style=flat)
22

33
| Documentation | Link |
44
| -------------------- | ---------------------------------------------------------------------- |

build.sbt

Lines changed: 4 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,8 @@ lazy val V =
1414
val moped = "0.2.0"
1515
val gradle = "7.0"
1616
val scala213 = "2.13.13"
17-
val scala3 = "3.3.3"
18-
val metals = "1.2.2"
1917
val scalameta = "4.9.3"
2018
val requests = "0.8.0"
21-
val minimalMillVersion = "0.10.0"
22-
val millScipVersion = "0.3.6"
2319
val kotlinVersion = "2.2.0"
2420
val kotest = "4.6.3"
2521
val kctfork = "0.7.1"
@@ -117,20 +113,8 @@ lazy val gradlePlugin = project
117113
sbtVersion,
118114
scalaVersion,
119115
"javacModuleOptions" -> javacModuleOptions,
120-
"semanticdbScalacVersions" ->
121-
com
122-
.sourcegraph
123-
.sbtsourcegraph
124-
.Versions
125-
.cachedSemanticdbVersionsByScalaVersion,
126-
"sbtSourcegraphVersion" ->
127-
com.sourcegraph.sbtsourcegraph.BuildInfo.version,
128116
"semanticdbVersion" -> V.scalameta,
129-
"mtagsVersion" -> V.metals,
130-
"scala213" -> V.scala213,
131-
"scala3" -> V.scala3,
132-
"minimalMillVersion" -> V.minimalMillVersion,
133-
"millScipVersion" -> V.millScipVersion
117+
"scala213" -> V.scala213
134118
)
135119
)
136120
.enablePlugins(BuildInfoPlugin)
@@ -241,31 +225,17 @@ lazy val cli = project
241225
sbtVersion,
242226
scalaVersion,
243227
"javacModuleOptions" -> javacModuleOptions,
244-
"semanticdbScalacVersions" ->
245-
com
246-
.sourcegraph
247-
.sbtsourcegraph
248-
.Versions
249-
.cachedSemanticdbVersionsByScalaVersion,
250-
"sbtSourcegraphVersion" ->
251-
com.sourcegraph.sbtsourcegraph.BuildInfo.version,
252228
"semanticdbVersion" -> V.scalameta,
253-
"mtagsVersion" -> V.metals,
254-
"scala213" -> V.scala213,
255-
"scala3" -> V.scala3,
256-
"minimalMillVersion" -> V.minimalMillVersion,
257-
"millScipVersion" -> V.millScipVersion
229+
"scala213" -> V.scala213
258230
),
259231
buildInfoPackage := "com.sourcegraph.scip_java",
260232
libraryDependencies ++=
261233
List(
262234
"io.get-coursier" %% "coursier" % V.coursier,
263235
"io.get-coursier" %% "coursier-jvm" % V.coursier,
264-
"org.scalameta" % "mtags-interfaces" % V.metals,
265236
"org.scala-lang.modules" %% "scala-xml" % V.scalaXml,
266237
"com.lihaoyi" %% "requests" % V.requests,
267238
"org.scalameta" %% "moped" % V.moped,
268-
"org.scalameta" %% "ascii-graphs" % "0.1.2",
269239
"org.jetbrains.kotlin" % "kotlin-compiler-embeddable" % V.kotlinVersion,
270240
"org.jetbrains.kotlin" % "kotlin-scripting-common" % V.kotlinVersion,
271241
"org.jetbrains.kotlin" % "kotlin-scripting-jvm" % V.kotlinVersion,
@@ -627,15 +597,6 @@ lazy val minimized21 = project
627597
.dependsOn(agent, javacPlugin)
628598
.disablePlugins(JavaFormatterPlugin)
629599

630-
lazy val minimizedScala = project
631-
.in(file("tests/minimized-scala"))
632-
.settings(
633-
(publish / skip) := true,
634-
semanticdbOptions ++=
635-
List("-P:semanticdb:text:on", "-P:semanticdb:synthetics:on")
636-
)
637-
.dependsOn(minimized)
638-
639600
lazy val unit = project
640601
.in(file("tests/unit"))
641602
.settings(
@@ -649,11 +610,7 @@ lazy val unit = project
649610
"sourceroot" -> (ThisBuild / baseDirectory).value,
650611
"minimizedJavaSourceDirectory" -> minimizedSourceDirectory,
651612
"minimizedJavaTargetroot" ->
652-
(minimized / Compile / semanticdbTargetRoot).value,
653-
"minimizedScalaSourceDirectory" ->
654-
(minimizedScala / Compile / sourceDirectory).value / "scala",
655-
"minimizedScalaTargetroot" ->
656-
(minimizedScala / Compile / semanticdbTargetRoot).value
613+
(minimized / Compile / semanticdbTargetRoot).value
657614
),
658615
buildInfoPackage := "tests"
659616
)
@@ -694,7 +651,7 @@ lazy val snapshots = project
694651
),
695652
buildInfoPackage := "tests.snapshots"
696653
)
697-
.dependsOn(minimizedScala, unit)
654+
.dependsOn(unit)
698655
.enablePlugins(BuildInfoPlugin)
699656

700657
lazy val bench = project
@@ -730,7 +687,6 @@ val testSettings = List(
730687
libraryDependencies ++=
731688
List(
732689
"org.scalameta" %% "munit" % "0.7.29",
733-
"org.scalameta" %% "mtags" % V.metals cross CrossVersion.full,
734690
"org.scalameta" %% "moped-testkit" % V.moped,
735691
"org.scalameta" %% "scalameta" % V.scalameta,
736692
"io.get-coursier" %% "coursier" % V.coursier,

docs/design.md

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ There are several benefits to implementing scip-java as a compiler plugin:
2828
### Why SemanticDB?
2929

3030
SemanticDB is Protobuf schema for information about symbols and types in Java
31-
programs, Scala programs and other languages. There are several benefits to
32-
using SemanticDB as an intermediary representation for SCIP:
31+
programs and other languages. There are several benefits to using SemanticDB as
32+
an intermediary representation for SCIP:
3333

3434
- **Simplicity**: It's easy to translate a single Java source file into a single
3535
SemanticDB file inside a compiler plugin. It's more complicated to produce
@@ -39,14 +39,9 @@ using SemanticDB as an intermediary representation for SCIP:
3939
- **Performance**: SemanticDB is fast to write and read. Each compilation unit
4040
can be processed independently to keep memory usage low. The final conversion
4141
from SemanticDB to SCIP can be safely parallelized.
42-
- **Cross-language**: SemanticDB has a
43-
[spec](https://scalameta.org/docs/semanticdb/specification.html) for Java and
44-
Scala enabling cross-language navigation in hybrid Java/Scala codebases.
4542
- **Cross-repository**: Compiler plugins have access to both source code and the
4643
classpath (compiled bytecode of upstream dependencies). SemanticDB has been
4744
designed so that it's also possible to generate spec-compliant symbols from
4845
the classpath alone (no source code) and from the syntax tree of an individual
49-
source file (no classpath). This flexibility allows the
50-
[Metals](https://scalameta.org/metals/) language server to index codebases
51-
from a variety of different inputs, and will be helpful for scip-java in the
52-
future to unblock cross-repository navigation.
46+
source file (no classpath). This flexibility will be helpful for scip-java in
47+
the future to unblock cross-repository navigation.

docs/getting-started.md

Lines changed: 21 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ title: Getting started
55

66
By following the instructions on this page, you should be able to generate a
77
[SCIP](https://github.com/sourcegraph/scip) index of your Java codebase using
8-
Gradle, Maven, sbt, or Bazel. See
8+
Gradle, Maven, or Bazel. See
99
[Supported build tools](#supported-build-tools) for an overview of other build
1010
tools that we're planning to support in the future.
1111

@@ -136,16 +136,9 @@ If you're using Maven.
136136
</dependency>
137137
```
138138

139-
If you're using sbt.
140-
141-
```scala
142-
scalaVersion := "@SCALA_VERSION@" // Only Scala 2.13 is supported.
143-
libraryDependencies += "com.sourcegraph" %% "scip-java" % "@STABLE_VERSION@"
144-
```
145-
146139
## Run `scip-java index`
147140

148-
> The `index` command is only supported for Gradle, Maven and sbt. See
141+
> The `index` command is only supported for Gradle and Maven. See
149142
> [Supported build tools](#supported-build-tools) for more details about other
150143
> build tools.
151144
@@ -156,18 +149,16 @@ This command should automatically infer the structure of your codebase and
156149
configure your build tool to generate SCIP.
157150

158151
```sh
159-
# At the root of a Gradle, Maven or sbt codebase.
152+
# At the root of a Gradle or Maven codebase.
160153
$ scip-java index
161154
...
162155
info: /path/to/index.scip
163156
```
164157

165-
| Build tool | Default command |
166-
| ---------- | ------------------------------------------------------------------------------- |
167-
| Gradle | `clean compileTestJava compileTestScala compileTestKotlin compileTestKotlinJvm` |
168-
| Maven | `--batch-mode clean verify -DskipTests` |
169-
| sbt | `sourcegraphEnable sourcegraphScip` (via sbt-sourcegraph plugin) |
170-
| Mill | `io.kipp.mill.scip.Scip/generate` (via mill-scip plugin) |
158+
| Build tool | Default command |
159+
| ---------- | ---------------------------------------------------------- |
160+
| Gradle | `clean compileTestJava compileTestKotlin compileTestKotlinJvm` |
161+
| Maven | `--batch-mode clean verify -DskipTests` |
171162

172163
Customize the build command by passing additional arguments after
173164
`scip-java index --`.
@@ -208,11 +199,10 @@ com.sourcegraph.scip_java.ScipJava.printHelp(Console.out)
208199

209200
## Supported programming languages
210201

211-
| Programming language | Gradle | Maven | sbt | Mill | Tracking issue |
212-
| -------------------- | ------ | ----- | --- | ---- | ----------------------------------------------------------- |
213-
| Java ||||| |
214-
| Scala ||||| [#302](https://github.com/sourcegraph/scip-java/issues/302) |
215-
| Kotlin ||| n/a | n/a | |
202+
| Programming language | Gradle | Maven | Tracking issue |
203+
| -------------------- | ------ | ----- | -------------- |
204+
| Java ||| |
205+
| Kotlin ||| |
216206

217207
### Java
218208

@@ -239,26 +229,11 @@ For Java 17 and newer versions, the following JVM options are required:
239229
--add-exports jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
240230
```
241231

242-
### Scala
243-
244-
Scala version support should always match the Scala versions that are supported
245-
by [Metals](https://scalameta.org/metals), the Scala language server.
246-
247-
| Scala version | Goto definition | Find references | Hover |
248-
| ------------- | --------------- | --------------- | ----- |
249-
| Scala 2.11.x ||||
250-
| Scala 2.12.x ||||
251-
| Scala 2.13.x ||||
252-
| Scala 3.x ||||
253-
254-
> Scala.js and Scala Native have equal support as Scala on the JVM.
255-
256232
### Kotlin
257233

258-
The Kotlin support in scip-java is less mature compared to the Java and Scala
259-
support. Don't hesitate to report issues at
260-
https://github.com/sourcegraph/scip-java if you encounter issues using the
261-
Kotlin support.
234+
The Kotlin support in scip-java is less mature compared to the Java support.
235+
Don't hesitate to report issues at https://github.com/sourcegraph/scip-java if
236+
you encounter issues using the Kotlin support.
262237

263238
## Supported build tools
264239

@@ -271,15 +246,13 @@ tools may require [manual configuration](manual-configuration.md).
271246
Please open an issue if your build tool is not listed in the table below. Feel
272247
free to subscribe to the tracking issues to receive updates on your build tool.
273248

274-
| Build tool | Java | Scala | Kotlin | Tracking issue |
275-
| ---------- | ---- | ----- | ------ | -------------------------------------------------------------------------------- |
276-
| Maven |||| |
277-
| Gradle |||| |
278-
| sbt ||| n/a | |
279-
| Ant |||| [sourcegraph/scip-java#305](https://github.com/sourcegraph/scip-java/issues/305) |
280-
| Bazel |||| |
281-
| Buck |||| [sourcegraph/scip-java#99](https://github.com/sourcegraph/scip-java/issues/99) |
282-
| Mill ||||
249+
| Build tool | Java | Kotlin | Tracking issue |
250+
| ---------- | ---- | ------ | -------------------------------------------------------------------------------- |
251+
| Maven ||| |
252+
| Gradle ||| |
253+
| Ant ||| [sourcegraph/scip-java#305](https://github.com/sourcegraph/scip-java/issues/305) |
254+
| Bazel ||| |
255+
| Buck ||| [sourcegraph/scip-java#99](https://github.com/sourcegraph/scip-java/issues/99) |
283256

284257
****: automatic indexing is fully supported. Please report a bug if the
285258
`scip-java index` command does not work on your codebase.
@@ -310,7 +283,6 @@ The following Gradle integrations are not yet supported:
310283
| ----------- | --------- | -------------------------------------------------------------------------------- |
311284
| Android || [sourcegraph/scip-java#177](https://github.com/sourcegraph/scip-java/issues/177) |
312285
| Kotlin || |
313-
| Scala || |
314286

315287
### Maven
316288

@@ -322,29 +294,8 @@ The following Maven integrations are not yet supported:
322294

323295
| Integration | Supported | Tracking issue |
324296
| ------------------- | --------- | -------------------------------------------------------------------------------- |
325-
| scala-maven-plugin || [sourcegraph/scip-java#301](https://github.com/sourcegraph/scip-java/issues/301) |
326-
| scalor-maven-plugin || [sourcegraph/scip-java#301](https://github.com/sourcegraph/scip-java/issues/301) |
327297
| kotlin-maven-plugin || [sourcegraph/scip-java#304](https://github.com/sourcegraph/scip-java/issues/304) |
328298

329-
### sbt
330-
331-
The `scip-java index` build should be able to automatically index most sbt
332-
projects, with the following caveats:
333-
334-
| Integration | Supported | Recommendation |
335-
| ------------- | --------- | ----------------------- |
336-
| sbt <v0.13.17 || Upgrade to sbt v0.13.17 |
337-
338-
### Mill
339-
340-
The `scip-java index` build should be able to automatically index most Mill
341-
projects, with the following caveats:
342-
343-
| Integration | Supported | Recommendation |
344-
| ------------- | ------------------- | ------------------------------------------- |
345-
| Mill <v0.10.0 || Upgrade to Mill >= v0.10.0 |
346-
| Mill <v0.10.6 | Only supports Scala | Upgrade to Mill >= v0.10.6 for Java support |
347-
348299
### Bazel
349300

350301
There are two approaches to index Bazel/Java codebases: automatic and manual.

docs/manual-configuration.md

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,6 @@ If you're using Maven.
5454
</dependency>
5555
```
5656

57-
If you're using sbt.
58-
59-
```scala
60-
libraryDependencies += "com.sourcegraph" % "semanticdb-javac" % "@STABLE_VERSION@"
61-
```
62-
6357
## Step 2: Enable `-Xplugin:semanticdb` compiler option
6458

6559
Add `-Xplugin:semanticdb` to your compiler options to enable the SemanticDB
@@ -108,17 +102,6 @@ If you're using Maven.
108102
</project>
109103
```
110104

111-
If you're using sbt.
112-
113-
```scala
114-
javaHome := Some(...) // Must be configured to fork the compiler.
115-
Compile / javacOptions += {
116-
val sourceroot = (ThisBuild / baseDirectory).value
117-
val targetroot = sourceroot / "target" / "semanticdb-targetroot"
118-
s"-Xplugin:semanticdb -sourceroot:$sourceroot -targetroot:$targetroot"
119-
}
120-
```
121-
122105
## Step 3: Compile the codebase
123106

124107
Compile all source files in the codebase once the compiler setting has been
@@ -127,7 +110,6 @@ examples:
127110

128111
- Gradle: `./gradlew clean compileJava compileTestJava`
129112
- Maven: `mvn clean verify -DskipTests`
130-
- sbt: `sbt clean test:compile`
131113
- Bazel: `bazel build //...`
132114

133115
If everything went well, you should have a lot of `*.semanticdb` files in the

flake.nix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
jdk
3030
jq
3131
(maven.override ({ jdk_headless = jdk; }))
32-
(mill.override ({ jre = jdk; }))
3332
nixfmt
3433
nodejs
3534
(sbt.override ({ jre = jdk; }))

project/plugins.sbt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0")
55
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.5")
66
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.14.3")
77
addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.6")
8-
addSbtPlugin("com.sourcegraph" % "sbt-sourcegraph" % "0.4.4")
98
addSbtPlugin("com.lightbend.sbt" % "sbt-java-formatter" % "0.6.1")
109
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")
1110
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.15.0")
@@ -15,8 +14,5 @@ addSbtPlugin("com.github.sbt.junit" % "sbt-jupiter-interface" % "0.15.1")
1514
// [error] (plugin / Compile / compileIncremental) java.lang.NoClassDefFoundError: com/sun/tools/javac/code/Symbol
1615
addSbtPlugin("org.scala-debugger" % "sbt-jdi-tools" % "1.1.1")
1716

18-
libraryDependencies ++=
19-
List("com.thesamet.scalapb" %% "compilerplugin" % "0.11.11")
20-
2117
ThisBuild / libraryDependencySchemes ++=
2218
Seq("org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always)

0 commit comments

Comments
 (0)