Skip to content

Commit 6820c41

Browse files
committed
PR3 (D6): scrub legacy SemanticDB wording from docs and help text
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.
1 parent 7c99f26 commit 6820c41

10 files changed

Lines changed: 44 additions & 48 deletions

File tree

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ If you'd rather install tools manually, you'll need at least:
3131

3232
These are the main components of the project.
3333

34-
- `semanticdb-javac/src/main/java`: the Java compiler plugin that creates
35-
SemanticDB files.
34+
- `semanticdb-javac/src/main/java`: the Java compiler plugin that emits
35+
SCIP shard files.
3636
- `tests/minimized`: minimized Java source files that reproduce interesting test
3737
cases.
3838
- `tests/unit`: fast running unit tests that are helpful for local edit-and-test

build.sbt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,10 @@ lazy val semanticdbKotlinc = project
437437
// `semanticdbKotlincMinimized` mirrors the (still-present) Gradle build at
438438
// semanticdb-kotlinc/minimized/build.gradle.kts. It compiles a small set of
439439
// Kotlin and Java fixtures with the assembled `semanticdbKotlinc` plugin
440-
// attached to kotlinc/javac, producing *.semanticdb files under
441-
// target/semanticdb-targetroot/ which are then converted to SCIP and rendered
442-
// as the human-readable golden snapshots by the `snapshots` task.
440+
// attached to kotlinc/javac, producing *.scip shard files under
441+
// target/semanticdb-targetroot/ which are then aggregated into a single SCIP
442+
// index and rendered as the human-readable golden snapshots by the
443+
// `snapshots` task.
443444
lazy val semanticdbKotlincMinimized = project
444445
.in(file("semanticdb-kotlinc/minimized"))
445446
.enablePlugins(KotlinPlugin)
@@ -503,7 +504,7 @@ lazy val semanticdbKotlincMinimized = project
503504
// ----- snapshots regeneration task -----
504505
// Invokes `com.sourcegraph.scip_java.ScipJava.main` twice in the cli JVM
505506
// (forked — ScipJava.main calls System.exit on failure). First pass
506-
// converts the *.semanticdb files under target/semanticdb-targetroot/
507+
// aggregates the *.scip shard files under target/semanticdb-targetroot/
507508
// into an index.scip; second pass renders that index as the human-readable
508509
// golden snapshots.
509510
//

docs/design.md

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ title: Design
55

66
This project is implemented as a
77
[Java compiler plugin](https://docs.oracle.com/en/java/javase/11/docs/api/jdk.compiler/com/sun/source/util/Plugin.html)
8-
that generates one
9-
[SemanticDB](https://scalameta.org/docs/semanticdb/specification.html) file for
10-
every `*.java` source file. After compilation completes, the SemanticDB files
11-
are processed to produce SCIP.
8+
that emits one [SCIP](https://github.com/sourcegraph/scip) shard file for every
9+
`*.java` source file. After compilation completes, the per-file SCIP shards are
10+
aggregated into a single SCIP index.
1211

1312
### Why Java compiler plugin?
1413

@@ -25,23 +24,18 @@ There are several benefits to implementing scip-java as a compiler plugin:
2524
installed system dependencies, custom compiler options and custom annotation
2625
processors.
2726

28-
### Why SemanticDB?
27+
### Why per-file SCIP shards?
2928

30-
SemanticDB is Protobuf schema for information about symbols and types in Java
31-
programs and other languages. There are several benefits to using SemanticDB as
32-
an intermediary representation for SCIP:
29+
The compiler plugin writes a small SCIP shard per compilation unit and a
30+
separate step aggregates the shards into a single SCIP index. There are several
31+
benefits to this two-phase pipeline:
3332

3433
- **Simplicity**: It's easy to translate a single Java source file into a single
35-
SemanticDB file inside a compiler plugin. It's more complicated to produce
36-
SCIP because compiler plugins does not have access to a project-wide context,
37-
which is necessary to produce accurate definitions and hovers in multi-module
38-
projects with external library dependencies.
39-
- **Performance**: SemanticDB is fast to write and read. Each compilation unit
40-
can be processed independently to keep memory usage low. The final conversion
41-
from SemanticDB to SCIP can be safely parallelized.
42-
- **Cross-repository**: Compiler plugins have access to both source code and the
43-
classpath (compiled bytecode of upstream dependencies). SemanticDB has been
44-
designed so that it's also possible to generate spec-compliant symbols from
45-
the classpath alone (no source code) and from the syntax tree of an individual
46-
source file (no classpath). This flexibility will be helpful for scip-java in
47-
the future to unblock cross-repository navigation.
34+
SCIP shard inside a compiler plugin. It would be more complicated to produce
35+
a full SCIP index from inside the plugin because compiler plugins don't have
36+
access to a project-wide context, which is necessary to produce accurate
37+
definitions and hovers in multi-module projects with external library
38+
dependencies.
39+
- **Performance**: Each compilation unit can be processed independently to keep
40+
memory usage low. The final aggregation of the shards into a single SCIP
41+
index can be safely parallelized.

docs/getting-started.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,10 +351,10 @@ Next, run the following command to generate the SCIP index (`index.scip`).
351351
```
352352
bazel run @scip_java//scip-semanticdb:bazel -- --sourceroot $PWD
353353
354-
# (optional) Validate that SemanticDB files were generated.
354+
# (optional) Validate that SCIP shard files were generated.
355355
# The command below works for the `examples/bazel-example` directory in the sourcegraph/scip-java repository.
356-
❯ jar tf bazel-bin/src/main/java/example/libexample.jar | grep semanticdb$
357-
META-INF/semanticdb/src/main/java/example/Example.java.semanticdb
356+
❯ jar tf bazel-bin/src/main/java/example/libexample.jar | grep scip$
357+
META-INF/scip/src/main/java/example/Example.java.scip
358358
```
359359

360360
Finally, run the following commands to upload the SCIP index to Sourcegraph.

docs/manual-configuration.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ fails.
1212

1313
Indexing a codebase consists of two independent phases:
1414

15-
- Compile the codebase with the SemanticDB compiler plugin.
16-
- Generate SCIP index from SemanticDB files.
15+
- Compile the codebase with the SemanticDB compiler plugin, which writes one
16+
SCIP shard per Java source file.
17+
- Aggregate the SCIP shards into a single SCIP index.
1718

18-
![A three stage pipeline that starts with a list of Java sources, creates a list of SemanticDB files that then become a single SCIP index.](assets/semanticdb-javac-pipeline.svg)
19+
![A three stage pipeline that starts with a list of Java sources, creates a list of per-file SCIP shards that then become a single SCIP index.](assets/semanticdb-javac-pipeline.svg)
1920

2021
The first phase can be complicated to configure and it can take a while to run.
2122
The second phase is quite simple to configure and it usually runs very fast.
@@ -63,7 +64,7 @@ compiler plugin. To do this you need to explicitly configure two directories:
6364
It's important that all of the source files that should be index live under
6465
this directory.
6566
- `-targetroot:PATH`: the absolute path to the directory where to generate
66-
SemanticDB file. This directory can be anywhere on your file system.
67+
SCIP shard files. This directory can be anywhere on your file system.
6768
Alternatively, pass in `-targetroot:javac-classes-directory` for the plugin to
6869
automatically use the `javac` output directory.
6970

@@ -112,13 +113,13 @@ examples:
112113
- Maven: `mvn clean verify -DskipTests`
113114
- Bazel: `bazel build //...`
114115

115-
If everything went well, you should have a lot of `*.semanticdb` files in the
116+
If everything went well, you should have a lot of `*.scip` shard files in the
116117
targetroot directory.
117118

118119
```
119120
❯ find $TARGETROOT -type f
120-
build/semanticdb-targetroot/META-INF/semanticdb/j11/src/test/java/example/ExampleTest.java.semanticdb
121-
build/semanticdb-targetroot/META-INF/semanticdb/j11/src/main/java/example/Example.java.semanticdb
121+
build/semanticdb-targetroot/META-INF/scip/j11/src/test/java/example/ExampleTest.java.scip
122+
build/semanticdb-targetroot/META-INF/scip/j11/src/main/java/example/Example.java.scip
122123
...
123124
```
124125

@@ -198,13 +199,13 @@ Which allows you to invoke it by simply running `mvn sourcegraph:sourcegraphDepe
198199
Cross-repository navigation is a feature that allows "goto definition" and "find
199200
references" to show results from multiple repositories.
200201

201-
## Step 5: Generate SCIP index from SemanticDB files
202+
## Step 5: Aggregate SCIP shards into a single SCIP index
202203

203204
First, install the `scip-java` command-line tool according to the instructions
204205
in the [getting started guide](getting-started.md).
205206

206-
Next, run the `scip-java index-semanticdb` command to convert SemanticDB files
207-
into SCIP.
207+
Next, run the `scip-java index-semanticdb` command to aggregate the per-file
208+
SCIP shards into a single SCIP index.
208209

209210
```sh
210211
❯ scip-java index-semanticdb $TARGETROOT

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ class ScipBuildTool(index: IndexCommand) extends BuildTool("SCIP", index) {
206206
.app
207207
.reporter
208208
.info(
209-
"Some SemanticDB files got generated even if there were compile errors. " +
209+
"Some SCIP shard files got generated even if there were compile errors. " +
210210
"In most cases, this means that scip-java managed to index everything " +
211211
"except the locations that had compile errors and you can ignore the compile errors."
212212
)

scip-java/src/main/scala/com/sourcegraph/scip_java/commands/IndexCommand.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ case class IndexCommand(
2929
@Description("The path where to generate the SCIP index.")
3030
output: Path = Paths.get("index.scip"),
3131
@Description(
32-
"The directory where to generate SemanticDB files. " +
32+
"The directory where to generate SCIP shard files. " +
3333
"Defaults to a build-specific path. " +
3434
"For example, the default value for Gradle is 'build/semanticdb-targetroot' and for Maven it's 'target/semanticdb-targetroot'"
3535
)

scip-java/src/main/scala/com/sourcegraph/scip_java/commands/IndexSemanticdbCommand.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import org.scip_code.scip.ToolInfo
2020
import ujson.Arr
2121
import ujson.Obj
2222

23-
@Description("Converts SemanticDB files into a single SCIP index file.")
23+
@Description("Aggregates SCIP shard files into a single SCIP index file.")
2424
@Usage("scip-java index-semanticdb [OPTIONS ...] [POSITIONAL ARGUMENTS ...]")
2525
@ExampleUsage(
2626
"scip-java index-semanticdb --out=myindex.scip my/targetroot1 my/targetroot2"
@@ -29,10 +29,10 @@ import ujson.Obj
2929
final case class IndexSemanticdbCommand(
3030
@Description("The name of the output file.")
3131
output: Path = Paths.get("index.scip"),
32-
@Description("Whether to process the SemanticDB files in parallel")
32+
@Description("Whether to process the SCIP shard files in parallel")
3333
parallel: Boolean = true,
3434
@Description(
35-
"Whether to infer the location of SemanticDB files based as produced by Bazel"
35+
"Whether to infer the location of SCIP shard files based as produced by Bazel"
3636
)
3737
bazel: Boolean = true,
3838
@Description(
@@ -43,7 +43,7 @@ final case class IndexSemanticdbCommand(
4343
@Description("URL to a PackageHub instance")
4444
@Hidden
4545
packagehub: Option[String] = None,
46-
@Description("Directories that contain SemanticDB files.")
46+
@Description("Directories that contain SCIP shard files.")
4747
@PositionalArguments()
4848
targetroot: List[Path] = Nil,
4949
@Description(

semanticdb-javac/src/main/java/com/sourcegraph/semanticdb_javac/SemanticdbJavacOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
/** Settings that can be configured alongside the -Xplugin compiler option. */
1919
public class SemanticdbJavacOptions {
2020

21-
/** The directory to place META-INF and its .semanticdb files */
21+
/** The directory to place META-INF and its SCIP shard files */
2222
public Path targetroot;
2323

2424
public Path sourceroot;

semanticdb-kotlinc/src/main/kotlin/com/sourcegraph/semanticdb_kotlinc/AnalyzerCommandLineProcessor.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class AnalyzerCommandLineProcessor : CommandLineProcessor {
2828
CliOption(
2929
VAL_TARGET,
3030
"<path>",
31-
"the absolute path to the directory where to generate SemanticDB files.",
31+
"the absolute path to the directory where to generate SCIP shard files.",
3232
required = true))
3333

3434
override fun processOption(

0 commit comments

Comments
 (0)