Skip to content

Commit f5346ff

Browse files
committed
Remove LSIF graph format support
Drop support for LSIF output format, keeping only typed SCIP output (.scip and .scip.ndjson). Deleted: - lsif.proto and generated types (LsifObject, LsifPosition, LsifHover, etc.) - SnapshotLsifCommand (was already deprecated) - MarkupContent, ResultIds, ResultSets, ScipByteOutputStream Simplified: - ScipOutputFormat: removed GRAPH_NDJSON/GRAPH_PROTOBUF - ScipWriter: removed 18 LSIF graph emission methods - ScipOutputStream: simplified to raw byte writing - ScipSemanticdb: removed runGraph() code path - ScipSemanticdbOptions: LsifToolInfo -> Scip.ToolInfo - PackageTable: removed ScipWriter dependency
1 parent 5f223b2 commit f5346ff

File tree

16 files changed

+27
-606
lines changed

16 files changed

+27
-606
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import com.sourcegraph.scip_java.commands.IndexCommand
66
import com.sourcegraph.scip_java.commands.IndexDependencyCommand
77
import com.sourcegraph.scip_java.commands.IndexSemanticdbCommand
88
import com.sourcegraph.scip_java.commands.SnapshotCommand
9-
import com.sourcegraph.scip_java.commands.SnapshotLsifCommand
109
import moped.cli.Application
1110
import moped.cli.CommandParser
1211
import moped.commands.HelpCommand
@@ -23,8 +22,7 @@ object ScipJava {
2322
CommandParser[IndexCommand],
2423
CommandParser[IndexSemanticdbCommand],
2524
CommandParser[IndexDependencyCommand],
26-
CommandParser[SnapshotCommand],
27-
CommandParser[SnapshotLsifCommand]
25+
CommandParser[SnapshotCommand]
2826
)
2927
)
3028
def main(args: Array[String]): Unit = {

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import java.util.concurrent.TimeUnit
77
import scala.jdk.CollectionConverters._
88

99
import com.sourcegraph.io.AbsolutePath
10-
import com.sourcegraph.lsif_protocol.LsifToolInfo
10+
import com.sourcegraph.Scip
1111
import com.sourcegraph.scip_java.BuildInfo
1212
import com.sourcegraph.scip_java.buildtools.ClasspathEntry
1313
import com.sourcegraph.scip_semanticdb.ConsoleScipSemanticdbReporter
@@ -79,7 +79,7 @@ final case class IndexSemanticdbCommand(
7979
if (format == ScipOutputFormat.UNKNOWN) {
8080
app.error(
8181
s"unknown output format for filename '$outputFilename'. " +
82-
s"Supported file extension are `*.scip`, `*scip '"
82+
s"Supported file extensions are `*.scip` and `*.scip.ndjson`"
8383
)
8484
return 1
8585
}
@@ -97,7 +97,8 @@ final case class IndexSemanticdbCommand(
9797
AbsolutePath.of(output, sourceroot),
9898
sourceroot,
9999
reporter,
100-
LsifToolInfo
100+
Scip
101+
.ToolInfo
101102
.newBuilder()
102103
.setName("scip-java")
103104
.setVersion(BuildInfo.version)

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

Lines changed: 0 additions & 32 deletions
This file was deleted.

scip-semanticdb/src/main/java/com/sourcegraph/scip_semanticdb/BazelBuildTool.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.sourcegraph.scip_semanticdb;
22

33
import com.sourcegraph.scip_java.Bazelbuild;
4-
import com.sourcegraph.lsif_protocol.LsifToolInfo;
4+
import com.sourcegraph.Scip;
55

66
import java.io.*;
77
import java.nio.file.FileSystems;
@@ -58,7 +58,7 @@ public boolean hasErrors() {
5858
options.output,
5959
options.sourceroot,
6060
reporter,
61-
LsifToolInfo.newBuilder().setName("scip-java").setVersion("HEAD").build(),
61+
Scip.ToolInfo.newBuilder().setName("scip-java").setVersion("HEAD").build(),
6262
"java",
6363
ScipOutputFormat.TYPED_PROTOBUF,
6464
options.parallel,

scip-semanticdb/src/main/java/com/sourcegraph/scip_semanticdb/MarkupContent.java

Lines changed: 0 additions & 13 deletions
This file was deleted.

scip-semanticdb/src/main/java/com/sourcegraph/scip_semanticdb/PackageTable.java

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,24 @@
1212
import java.util.Map;
1313
import java.util.Optional;
1414
import java.util.Set;
15-
import java.util.concurrent.ConcurrentHashMap;
16-
import java.util.function.Function;
15+
1716
import java.util.jar.JarEntry;
1817
import java.util.jar.JarFile;
1918
import java.util.regex.Pattern;
2019

21-
public class PackageTable implements Function<Package, Integer> {
20+
public class PackageTable {
2221

2322
private final Map<String, Package> byClassfile = new HashMap<>();
2423
private final Set<String> cachedJdkSymbols = new HashSet<>();
25-
private final Map<Package, Integer> scip = new ConcurrentHashMap<>();
2624
private final JavaVersion javaVersion;
27-
private final ScipWriter writer;
2825
private final boolean indexDirectoryEntries;
2926

3027
private static final PathMatcher CLASS_PATTERN =
3128
FileSystems.getDefault().getPathMatcher("glob:**.class");
3229
private static final PathMatcher JAR_PATTERN =
3330
FileSystems.getDefault().getPathMatcher("glob:**.jar");
3431

35-
public PackageTable(ScipSemanticdbOptions options, ScipWriter writer) throws IOException {
36-
this.writer = writer;
32+
public PackageTable(ScipSemanticdbOptions options) throws IOException {
3733
this.javaVersion = new JavaVersion();
3834
this.indexDirectoryEntries = options.allowExportingGlobalSymbolsFromDirectoryEntries;
3935
// NOTE: it's important that we index the JDK before maven packages. Some maven packages
@@ -46,11 +42,6 @@ public PackageTable(ScipSemanticdbOptions options, ScipWriter writer) throws IOE
4642
}
4743
}
4844

49-
public void writeMonikerPackage(int monikerId, Package pkg) {
50-
int pkgId = scip.computeIfAbsent(pkg, this);
51-
writer.emitPackageInformationEdge(monikerId, pkgId);
52-
}
53-
5445
public Optional<Package> packageForSymbol(String symbol) {
5546
return SymbolDescriptor.toplevel(symbol)
5647
.flatMap(
@@ -148,9 +139,4 @@ private void indexBootstrapClasspath() throws IOException {
148139
}
149140
}
150141
}
151-
152-
@Override
153-
public Integer apply(Package pkg) {
154-
return writer.emitpackageinformationVertex(pkg);
155-
}
156142
}

scip-semanticdb/src/main/java/com/sourcegraph/scip_semanticdb/ResultIds.java

Lines changed: 0 additions & 18 deletions
This file was deleted.

scip-semanticdb/src/main/java/com/sourcegraph/scip_semanticdb/ResultSets.java

Lines changed: 0 additions & 69 deletions
This file was deleted.

scip-semanticdb/src/main/java/com/sourcegraph/scip_semanticdb/ScipByteOutputStream.java

Lines changed: 0 additions & 15 deletions
This file was deleted.

scip-semanticdb/src/main/java/com/sourcegraph/scip_semanticdb/ScipOutputFormat.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,20 @@
11
package com.sourcegraph.scip_semanticdb;
22

3-
/**
4-
* Whether to generate index.scip (JSON) or index.scip-protobuf (Protobuf).
5-
*
6-
* <p>The Protobuf format is experimental and currently only exists as a proof-of-concept.
7-
*/
3+
/** Whether to generate index.scip (Protobuf) or index.scip.ndjson (newline-delimited JSON). */
84
public enum ScipOutputFormat {
9-
GRAPH_NDJSON,
10-
GRAPH_PROTOBUF,
115
TYPED_PROTOBUF,
126
TYPED_NDJSON,
137
UNKNOWN;
148

159
public boolean isTyped() {
16-
return this == TYPED_NDJSON || this == TYPED_PROTOBUF;
10+
return this != UNKNOWN;
1711
}
1812

1913
public boolean isNewlineDelimitedJSON() {
20-
return this == GRAPH_NDJSON || this == TYPED_NDJSON;
14+
return this == TYPED_NDJSON;
2115
}
2216

2317
public static ScipOutputFormat fromFilename(String name) {
24-
if (name.endsWith(".lsif")) return GRAPH_NDJSON;
25-
if (name.endsWith(".lsif-protobuf")) return GRAPH_PROTOBUF;
2618
if (name.endsWith(".scip")) return TYPED_PROTOBUF;
2719
if (name.endsWith(".scip.ndjson")) return TYPED_NDJSON;
2820
return UNKNOWN;

0 commit comments

Comments
 (0)