Skip to content

Drop SemanticDB output from semanticdb-kotlinc and remove SemanticDB pipeline (split 2/2)#897

Open
jupblb wants to merge 10 commits into
michal/drop-semanticdb-javafrom
michal/drop-semanticdb-kotlin
Open

Drop SemanticDB output from semanticdb-kotlinc and remove SemanticDB pipeline (split 2/2)#897
jupblb wants to merge 10 commits into
michal/drop-semanticdb-javafrom
michal/drop-semanticdb-kotlin

Conversation

@jupblb
Copy link
Copy Markdown
Member

@jupblb jupblb commented Jun 2, 2026

Part 2 of a 2-PR split of #891. Stacked on #896.

What this PR does

Finishes the SemanticDB → SCIP migration on the Kotlin side, removes the now-unused SemanticDB consumer fallback and protobuf machinery, scrubs SemanticDB wording from docs, and applies four small simplifications that became possible once the legacy SemanticDB visitors were gone.

Pipeline before vs after this PR

Before (= state after #896):
  javac + plugin     ──►  *.scip shards  ─────┐
                                              ├─►  ScipShardAggregator  ──►  index.scip
  kotlinc + plugin   ──►  *.scip + *.semanticdb (dual)

After:
  javac + plugin     ──►  *.scip shards  ─┐
                                          ├─►  ScipShardAggregator  ──►  index.scip
  kotlinc + plugin   ──►  *.scip shards  ─┘

Commits

10 commits:

  • D3: semanticdb-kotlinc emits only SCIP shards (drops SemanticdbVisitor.kt / SemanticdbTextDocumentBuilder.kt / SemanticdbBuilders.kt and associated tests).
  • D4: aggregator drops the legacy SemanticDB fallback (removes ScipSemanticdb, SignatureFormatter, SemanticdbTreeVisitor, etc. — ~1.8 KLOC).
  • D5: drop SemanticDB protobuf generation and dead builders (semanticdb.proto in both semanticdb-java and semanticdb-kotlinc, SemanticdbBuilders.java, plus the now-unused semanticdb-java protobuf wiring in build.sbt).
  • D6 + 2 doc commits: scrub SemanticDB wording from docs/, CONTRIBUTING.md, build.sbt, plus removing a dangling pipeline.svg reference and the now-obsolete "Why per-file SCIP shards?" section.
  • 4 simplification commits: refactor ScipOccurrences to a stateful accumulator (Java + Kotlin), drop the redundant ScipRole enum, inline one-call wrappers, prune dead helpers (e.g. MD5.java, TargetPaths.java, remnants of the old CompilerRange enum), and LinkedHashSet-ify relationship dedup.

Net code change

~3,920 added / ~8,477 removed across ~105 files. Bulk is deletions (legacy SemanticDB output code, tests for that code, and the protobuf-driven scip-semanticdb aggregator).

Validation

  • sbt checkAll
  • sbt unit/test ✅ 28/28
  • sbt minimized/{clean,compile}
  • sbt snapshots/test ✅ 23/23
  • sbt semanticdbKotlincMinimized/clean kotlincSnapshots ✅ (no snapshot drift)

jupblb added 10 commits June 3, 2026 11:09
Drop the legacy SemanticDB code path from the Kotlin compiler plug-in:

* ScipRole: new local enum mirroring the DEFINITION/REFERENCE subset
  of Semanticdb.SymbolOccurrence.Role.
* SemanticdbVisitor: drop the documentBuilder field and
  build()/Semanticdb.TextDocument helper; the visitor now only feeds
  ScipTextDocumentBuilder and uses ScipRole at every emit site.
* ScipTextDocumentBuilder: switch role parameter from
  Semanticdb.SymbolOccurrence.Role to ScipRole.
* PostAnalysisExtension: remove the SemanticDB write path and the
  (Semanticdb.TextDocument) -> Unit callback; the extension now only
  walks the visitors and writes META-INF/scip/<rel>.scip shards.
* AnalyzerRegistrar: remove the SemanticDB callback parameter.

Delete the legacy implementation source:
  * SemanticdbTextDocumentBuilder.kt

Delete the legacy Kotlin test suites that asserted on Semanticdb
protobuf output:
  * src/test/kotlin/.../test/AnalyzerTest.kt (1528 lines)
  * src/test/kotlin/.../test/SemanticdbSymbolsTest.kt (726 lines)
  * src/test/kotlin/.../test/Utils.kt (203 lines)

The Kotlin compiler plug-in behavior remains covered end-to-end by the
existing snapshot suites (semanticdb-kotlinc/minimized fixtures + the
exposed-core library snapshot regenerated in PR2 K5).

Validation: sbt unit/test (28 passing), sbt snapshots/test
(102 passing).
The aggregator now consumes SCIP shards only. The legacy
SemanticDB-based reader/aggregator is removed.

Wiring:

* IndexSemanticdbCommand: remove the --use-scip-shards flag and the
  ScipSemanticdb.run() else branch; always call ScipShardAggregator.
* BazelBuildTool: switch the Bazel main entry to ScipShardAggregator.
* MinimizedSnapshotScipGenerator: drop the --use-scip-shards argument
  (the default switched in PR2 K4 and the flag is being removed now).
* build.sbt (kotlincSnapshots): drop --use-scip-shards from the
  index-semanticdb invocation.

Delete the legacy SemanticDB-consuming aggregator sources, none of
which have any remaining callers:

  * ScipSemanticdb.java
  * SemanticdbWalker.java
  * SemanticdbTreeVisitor.java
  * ScipTextDocument.java
  * SignatureFormatter.java
  * SignatureFormatterException.java
  * SymbolOccurrences.java
  * Symtab.java
  * RangeComparator.java

Validation: sbt unit/test (28 passing), sbt snapshots/test
(102 passing).
- Remove generated SemanticDB protobuf module:
  - semanticdb-java/src/main/protobuf/semanticdb.proto
  - semanticdb-java/src/main/protobuf/BUILD
  - semanticdb-kotlinc/src/main/proto/.../semanticdb.proto
- Delete unused SemanticDB builder helpers:
  - semanticdb-java/.../SemanticdbBuilders.java
  - semanticdb-kotlinc/.../SemanticdbBuilders.kt
- Keep a minimal semanticdb-java module that only ships
  SemanticdbSymbols.java (a pure-Java symbol helper still consumed by
  semanticdb-javac and scip-semanticdb), without protobuf generation.
- Update sbt and Bazel build files accordingly.
The Java/Kotlin compiler plugins now emit per-file SCIP shards directly
and the 'index-semanticdb' command aggregates those shards into a single
SCIP index. Update user-facing strings and docs to describe the actual
behavior instead of the now-removed SemanticDB->SCIP conversion step.

Keep compatibility names (Xplugin:semanticdb, index-semanticdb CLI,
semanticdb-targetroot directory, semanticdb-javac module/package) so
existing build integrations keep working.
@jupblb jupblb force-pushed the michal/drop-semanticdb-kotlin branch from b8b50ae to 9470838 Compare June 3, 2026 09:12
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 this pull request may close these issues.

1 participant