Skip to content

Commit 3c509e2

Browse files
authored
Remove LSIF graph format support (#842)
Drop support for LSIF output format, keeping only typed SCIP output (.scip and .scip.ndjson).
1 parent b1bb57a commit 3c509e2

File tree

20 files changed

+43
-643
lines changed

20 files changed

+43
-643
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/buildtools/BuildTool.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ object BuildTool {
4646
def generateScipFromTargetroot(
4747
generateSemanticdbResult: CommandResult,
4848
targetroot: Path,
49-
index: IndexCommand,
50-
buildKind: String = ""
49+
index: IndexCommand
5150
): Int = {
5251
if (!Files.isDirectory(targetroot)) {
5352
generateSemanticdbResult.exitCode
@@ -62,7 +61,6 @@ object BuildTool {
6261
output = index.finalOutput,
6362
targetroot = List(targetroot),
6463
packagehub = index.packagehub,
65-
buildKind = buildKind,
6664
app = index.app
6765
)
6866
.run()

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ class ScipBuildTool(index: IndexCommand) extends BuildTool("SCIP", index) {
105105
BuildTool.generateScipFromTargetroot(
106106
generateSemanticdb(),
107107
index.finalTargetroot(defaultTargetroot),
108-
index,
109-
buildKind
108+
index
110109
)
111110
}
112111

@@ -117,7 +116,6 @@ class ScipBuildTool(index: IndexCommand) extends BuildTool("SCIP", index) {
117116
ScipBuildTool
118117
.ConfigFileNames
119118
.map(name => index.workingDirectory.resolve(name))
120-
private def buildKind: String = parsedConfig.fold(_.kind, _ => "")
121119
private def generateSemanticdb(): CommandResult = {
122120
parsedConfig match {
123121
case ValueResult(value) =>

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import java.util.concurrent.TimeUnit
66

77
import scala.jdk.CollectionConverters._
88

9+
import com.sourcegraph.Scip
910
import com.sourcegraph.io.AbsolutePath
10-
import com.sourcegraph.lsif_protocol.LsifToolInfo
1111
import com.sourcegraph.scip_java.BuildInfo
1212
import com.sourcegraph.scip_java.buildtools.ClasspathEntry
1313
import com.sourcegraph.scip_semanticdb.ConsoleScipSemanticdbReporter
@@ -47,8 +47,6 @@ final case class IndexSemanticdbCommand(
4747
@Description("Directories that contain SemanticDB files.")
4848
@PositionalArguments()
4949
targetroot: List[Path] = Nil,
50-
@Description("The kind of this build, one of: empty string, jdk, maven")
51-
buildKind: String = "",
5250
@Description(
5351
"If true, don't report an error when no documents have been indexed. " +
5452
"The resulting SCIP index will silently be empty instead."
@@ -79,7 +77,7 @@ final case class IndexSemanticdbCommand(
7977
if (format == ScipOutputFormat.UNKNOWN) {
8078
app.error(
8179
s"unknown output format for filename '$outputFilename'. " +
82-
s"Supported file extension are `*.scip`, `*scip '"
80+
s"Supported file extensions are `*.scip` and `*.scip.ndjson`"
8381
)
8482
return 1
8583
}
@@ -97,16 +95,15 @@ final case class IndexSemanticdbCommand(
9795
AbsolutePath.of(output, sourceroot),
9896
sourceroot,
9997
reporter,
100-
LsifToolInfo
98+
Scip
99+
.ToolInfo
101100
.newBuilder()
102101
.setName("scip-java")
103102
.setVersion(BuildInfo.version)
104103
.build(),
105-
"java",
106104
format,
107105
parallel,
108106
packages.map(_.toPackageInformation).asJava,
109-
buildKind,
110107
emitInverseRelationships,
111108
allowEmptyIndex,
112109
allowExportingGlobalSymbolsFromDirectoryEntries

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 & 4 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,12 +58,10 @@ public boolean hasErrors() {
5858
options.output,
5959
options.sourceroot,
6060
reporter,
61-
LsifToolInfo.newBuilder().setName("scip-java").setVersion("HEAD").build(),
62-
"java",
61+
Scip.ToolInfo.newBuilder().setName("scip-java").setVersion("HEAD").build(),
6362
ScipOutputFormat.TYPED_PROTOBUF,
6463
options.parallel,
6564
mavenPackages,
66-
/* buildKind */ "",
6765
/* emitInverseRelationships */ true,
6866
/* allowEmptyIndex */ true,
6967
/* indexDirectoryEntries */ false // because Bazel only compiles to jar files.

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: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,25 @@
88
import java.util.Enumeration;
99
import java.util.HashMap;
1010
import java.util.HashSet;
11-
import java.util.Iterator;
1211
import java.util.Map;
1312
import java.util.Optional;
1413
import java.util.Set;
15-
import java.util.concurrent.ConcurrentHashMap;
16-
import java.util.function.Function;
1714
import java.util.jar.JarEntry;
1815
import java.util.jar.JarFile;
19-
import java.util.regex.Pattern;
2016

21-
public class PackageTable implements Function<Package, Integer> {
17+
public class PackageTable {
2218

2319
private final Map<String, Package> byClassfile = new HashMap<>();
2420
private final Set<String> cachedJdkSymbols = new HashSet<>();
25-
private final Map<Package, Integer> scip = new ConcurrentHashMap<>();
2621
private final JavaVersion javaVersion;
27-
private final ScipWriter writer;
2822
private final boolean indexDirectoryEntries;
2923

3024
private static final PathMatcher CLASS_PATTERN =
3125
FileSystems.getDefault().getPathMatcher("glob:**.class");
3226
private static final PathMatcher JAR_PATTERN =
3327
FileSystems.getDefault().getPathMatcher("glob:**.jar");
3428

35-
public PackageTable(ScipSemanticdbOptions options, ScipWriter writer) throws IOException {
36-
this.writer = writer;
29+
public PackageTable(ScipSemanticdbOptions options) throws IOException {
3730
this.javaVersion = new JavaVersion();
3831
this.indexDirectoryEntries = options.allowExportingGlobalSymbolsFromDirectoryEntries;
3932
// NOTE: it's important that we index the JDK before maven packages. Some maven packages
@@ -46,11 +39,6 @@ public PackageTable(ScipSemanticdbOptions options, ScipWriter writer) throws IOE
4639
}
4740
}
4841

49-
public void writeMonikerPackage(int monikerId, Package pkg) {
50-
int pkgId = scip.computeIfAbsent(pkg, this);
51-
writer.emitPackageInformationEdge(monikerId, pkgId);
52-
}
53-
5442
public Optional<Package> packageForSymbol(String symbol) {
5543
return SymbolDescriptor.toplevel(symbol)
5644
.flatMap(
@@ -148,9 +136,4 @@ private void indexBootstrapClasspath() throws IOException {
148136
}
149137
}
150138
}
151-
152-
@Override
153-
public Integer apply(Package pkg) {
154-
return writer.emitpackageinformationVertex(pkg);
155-
}
156139
}

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.

0 commit comments

Comments
 (0)