From 75d2a12305d40c4e890820921e6c74028787e07e Mon Sep 17 00:00:00 2001 From: jupblb Date: Tue, 2 Jun 2026 09:54:01 +0200 Subject: [PATCH 1/6] sbt: consume scip-java-bindings from Maven Central --- build.sbt | 22 +- scip-java-proto/src/main/protobuf/scip.proto | 342 +++++++++--------- .../sourcegraph/scip_java/ScipPrinters.scala | 18 +- .../commands/IndexSemanticdbCommand.scala | 5 +- .../scip_java/commands/SnapshotCommand.scala | 4 +- .../scip_semanticdb/BazelBuildTool.java | 4 +- .../scip_semanticdb/ScipSemanticdb.java | 118 +++--- .../ScipSemanticdbOptions.java | 6 +- .../scip_semanticdb/ScipWriter.java | 4 +- .../MinimizedSnapshotScipGenerator.scala | 2 +- 10 files changed, 269 insertions(+), 256 deletions(-) diff --git a/build.sbt b/build.sbt index 9430dd380..8fd33416f 100644 --- a/build.sbt +++ b/build.sbt @@ -8,7 +8,8 @@ import scala.collection.mutable.ListBuffer lazy val V = new { - val protobuf = "4.32.1" + val protobuf = "4.34.2" + val scipBindings = "0.8.0" val scalaXml = "2.1.0" val moped = "0.2.0" val gradle = "7.0" @@ -171,29 +172,22 @@ lazy val javacPlugin = project ) .dependsOn(semanticdb) -lazy val scipProto = project - .in(file("scip-java-proto")) - .settings( - moduleName := "scip-java-proto", - javaOnlySettings, - libraryDependencies += - "com.google.protobuf" % "protobuf-java-util" % V.protobuf, - (Compile / PB.targets) := - Seq(PB.gens.java(V.protobuf) -> (Compile / sourceManaged).value), - Compile / PB.protocOptions := Seq("--experimental_allow_proto3_optional") - ) - lazy val scip = project .in(file("scip-semanticdb")) .settings( publishMavenStyle := true, moduleName := "scip-semanticdb", javaOnlySettings, + libraryDependencies ++= + Seq( + "org.scip-code" % "scip-java-bindings" % V.scipBindings, + "com.google.protobuf" % "protobuf-java-util" % V.protobuf + ), (Compile / PB.targets) := Seq(PB.gens.java(V.protobuf) -> (Compile / sourceManaged).value), Compile / PB.protocOptions := Seq("--experimental_allow_proto3_optional") ) - .dependsOn(semanticdb, scipProto) + .dependsOn(semanticdb) lazy val mavenPlugin = project .in(file("maven-plugin")) diff --git a/scip-java-proto/src/main/protobuf/scip.proto b/scip-java-proto/src/main/protobuf/scip.proto index af55d2e69..326df0dd5 100644 --- a/scip-java-proto/src/main/protobuf/scip.proto +++ b/scip-java-proto/src/main/protobuf/scip.proto @@ -12,8 +12,10 @@ syntax = "proto3"; package scip; -option go_package = "github.com/sourcegraph/scip/bindings/go/scip/"; -option java_package = "com.sourcegraph"; +option go_package = "github.com/scip-code/scip/bindings/go/scip/"; +option java_multiple_files = true; +option java_outer_classname = "ScipProto"; +option java_package = "org.scip_code.scip"; // Index represents a complete SCIP index for a workspace this is rooted at a // single directory. An Index message payload can have a large memory footprint @@ -96,13 +98,11 @@ message Document { // Relationship.is_definition). repeated SymbolInformation symbols = 3; - // (optional) Text contents of the this document. Indexers are not expected to - // include the text by default. It's preferrable that clients read the text + // (optional) Text contents of this document. Indexers are not expected to + // include the text by default. It's preferable that clients read the text // contents from the file system by resolving the absolute path from joining - // `Index.metadata.project_root` and `Document.relative_path`. This field was - // introduced to support `SymbolInformation.signature_documentation`, but it - // can be used for other purposes as well, for example testing or when working - // with virtual/in-memory documents. + // `Index.metadata.project_root` and `Document.relative_path`. This field + // can be useful for testing or when working with virtual/in-memory documents. string text = 5; // Specifies the encoding used for source ranges in this Document. @@ -211,7 +211,7 @@ message Descriptor { // NOTE: This corresponds to a package in Go and JVM languages. Namespace = 1; // Use Namespace instead. - Package = 1 [deprecated=true]; + Package = 1 [deprecated = true]; Type = 2; Term = 3; Method = 4; @@ -229,6 +229,25 @@ message Descriptor { // function responsible for parsing symbols. } +// Signature represents the signature of a symbol as it's displayed in API +// documentation or hover tooltips. It uses a subset of Document's fields with +// the same field numbers for wire compatibility with older indexes that encoded +// signatures using the Document message type. +message Signature { + // The language of the signature, e.g. "java", "go", "python". + string language = 4; + // The text content of the signature, e.g. "void add(int a, int b)". + string text = 5; + // (optional) Occurrences within the signature text that reference other + // symbols, enabling hyperlinking of types in the signature. Ranges are + // relative to the `text` field. + repeated Occurrence occurrences = 2; + + // Reserved field numbers from the Document message to prevent accidental + // reuse, which would break wire compatibility with older indexes. + reserved 1, 3, 6; +} + // SymbolInformation defines metadata about a symbol, such as the symbol's // docstring or what package it's defined it. message SymbolInformation { @@ -263,148 +282,148 @@ message SymbolInformation { // - If two symbols have the same Kind, they should share the same Suffix. // - If two symbols have different Suffixes, they should have different Kinds. enum Kind { - UnspecifiedKind = 0; - // A method which may or may not have a body. For Java, Kotlin etc. - AbstractMethod = 66; - // For Ruby's attr_accessor - Accessor = 72; - Array = 1; - // For Alloy - Assertion = 2; - AssociatedType = 3; - // For C++ - Attribute = 4; - // For Lean - Axiom = 5; - Boolean = 6; - Class = 7; - // For C++ - Concept = 86; - Constant = 8; - Constructor = 9; - // For Solidity - Contract = 62; - // For Haskell - DataFamily = 10; - // For C# and F# - Delegate = 73; - Enum = 11; - EnumMember = 12; - Error = 63; - Event = 13; - // For Dart - Extension = 84; - // For Alloy - Fact = 14; - Field = 15; - File = 16; - Function = 17; - // For 'get' in Swift, 'attr_reader' in Ruby - Getter = 18; - // For Raku - Grammar = 19; - // For Purescript and Lean - Instance = 20; - Interface = 21; - Key = 22; - // For Racket - Lang = 23; - // For Lean - Lemma = 24; - // For solidity - Library = 64; - Macro = 25; - Method = 26; - // For Ruby - MethodAlias = 74; - // Analogous to 'ThisParameter' and 'SelfParameter', but for languages - // like Go where the receiver doesn't have a conventional name. - MethodReceiver = 27; - // Analogous to 'AbstractMethod', for Go. - MethodSpecification = 67; - // For Protobuf - Message = 28; - // For Dart - Mixin = 85; - // For Solidity - Modifier = 65; - Module = 29; - Namespace = 30; - Null = 31; - Number = 32; - Object = 33; - Operator = 34; - Package = 35; - PackageObject = 36; - Parameter = 37; - ParameterLabel = 38; - // For Haskell's PatternSynonyms - Pattern = 39; - // For Alloy - Predicate = 40; - Property = 41; - // Analogous to 'Trait' and 'TypeClass', for Swift and Objective-C - Protocol = 42; - // Analogous to 'AbstractMethod', for Swift and Objective-C. - ProtocolMethod = 68; - // Analogous to 'AbstractMethod', for C++. - PureVirtualMethod = 69; - // For Haskell - Quasiquoter = 43; - // 'self' in Python, Rust, Swift etc. - SelfParameter = 44; - // For 'set' in Swift, 'attr_writer' in Ruby - Setter = 45; - // For Alloy, analogous to 'Struct'. - Signature = 46; - // For Ruby - SingletonClass = 75; - // Analogous to 'StaticMethod', for Ruby. - SingletonMethod = 76; - // Analogous to 'StaticField', for C++ - StaticDataMember = 77; - // For C# - StaticEvent = 78; - // For C# - StaticField = 79; - // For Java, C#, C++ etc. - StaticMethod = 80; - // For C#, TypeScript etc. - StaticProperty = 81; - // For C, C++ - StaticVariable = 82; - String = 48; - Struct = 49; - // For Swift - Subscript = 47; - // For Lean - Tactic = 50; - // For Lean - Theorem = 51; - // Method receiver for languages - // 'this' in JavaScript, C++, Java etc. - ThisParameter = 52; - // Analogous to 'Protocol' and 'TypeClass', for Rust, Scala etc. - Trait = 53; - // Analogous to 'AbstractMethod', for Rust, Scala etc. - TraitMethod = 70; - // Data type definition for languages like OCaml which use `type` - // rather than separate keywords like `struct` and `enum`. - Type = 54; - TypeAlias = 55; - // Analogous to 'Trait' and 'Protocol', for Haskell, Purescript etc. - TypeClass = 56; - // Analogous to 'AbstractMethod', for Haskell, Purescript etc. - TypeClassMethod = 71; - // For Haskell - TypeFamily = 57; - TypeParameter = 58; - // For C, C++, Capn Proto - Union = 59; - Value = 60; - Variable = 61; - // Next = 87; - // Feel free to open a PR proposing new language-specific kinds. + UnspecifiedKind = 0; + // A method which may or may not have a body. For Java, Kotlin etc. + AbstractMethod = 66; + // For Ruby's attr_accessor + Accessor = 72; + Array = 1; + // For Alloy + Assertion = 2; + AssociatedType = 3; + // For C++ + Attribute = 4; + // For Lean + Axiom = 5; + Boolean = 6; + Class = 7; + // For C++ + Concept = 86; + Constant = 8; + Constructor = 9; + // For Solidity + Contract = 62; + // For Haskell + DataFamily = 10; + // For C# and F# + Delegate = 73; + Enum = 11; + EnumMember = 12; + Error = 63; + Event = 13; + // For Dart + Extension = 84; + // For Alloy + Fact = 14; + Field = 15; + File = 16; + Function = 17; + // For 'get' in Swift, 'attr_reader' in Ruby + Getter = 18; + // For Raku + Grammar = 19; + // For Purescript and Lean + Instance = 20; + Interface = 21; + Key = 22; + // For Racket + Lang = 23; + // For Lean + Lemma = 24; + // For solidity + Library = 64; + Macro = 25; + Method = 26; + // For Ruby + MethodAlias = 74; + // Analogous to 'ThisParameter' and 'SelfParameter', but for languages + // like Go where the receiver doesn't have a conventional name. + MethodReceiver = 27; + // Analogous to 'AbstractMethod', for Go. + MethodSpecification = 67; + // For Protobuf + Message = 28; + // For Dart + Mixin = 85; + // For Solidity + Modifier = 65; + Module = 29; + Namespace = 30; + Null = 31; + Number = 32; + Object = 33; + Operator = 34; + Package = 35; + PackageObject = 36; + Parameter = 37; + ParameterLabel = 38; + // For Haskell's PatternSynonyms + Pattern = 39; + // For Alloy + Predicate = 40; + Property = 41; + // Analogous to 'Trait' and 'TypeClass', for Swift and Objective-C + Protocol = 42; + // Analogous to 'AbstractMethod', for Swift and Objective-C. + ProtocolMethod = 68; + // Analogous to 'AbstractMethod', for C++. + PureVirtualMethod = 69; + // For Haskell + Quasiquoter = 43; + // 'self' in Python, Rust, Swift etc. + SelfParameter = 44; + // For 'set' in Swift, 'attr_writer' in Ruby + Setter = 45; + // For Alloy, analogous to 'Struct'. + Signature = 46; + // For Ruby + SingletonClass = 75; + // Analogous to 'StaticMethod', for Ruby. + SingletonMethod = 76; + // Analogous to 'StaticField', for C++ + StaticDataMember = 77; + // For C# + StaticEvent = 78; + // For C# + StaticField = 79; + // For Java, C#, C++ etc. + StaticMethod = 80; + // For C#, TypeScript etc. + StaticProperty = 81; + // For C, C++ + StaticVariable = 82; + String = 48; + Struct = 49; + // For Swift + Subscript = 47; + // For Lean + Tactic = 50; + // For Lean + Theorem = 51; + // Method receiver for languages + // 'this' in JavaScript, C++, Java etc. + ThisParameter = 52; + // Analogous to 'Protocol' and 'TypeClass', for Rust, Scala etc. + Trait = 53; + // Analogous to 'AbstractMethod', for Rust, Scala etc. + TraitMethod = 70; + // Data type definition for languages like OCaml which use `type` + // rather than separate keywords like `struct` and `enum`. + Type = 54; + TypeAlias = 55; + // Analogous to 'Trait' and 'Protocol', for Haskell, Purescript etc. + TypeClass = 56; + // Analogous to 'AbstractMethod', for Haskell, Purescript etc. + TypeClassMethod = 71; + // For Haskell + TypeFamily = 57; + TypeParameter = 58; + // For C, C++, Capn Proto + Union = 59; + Value = 60; + Variable = 61; + // Next = 87; + // Feel free to open a PR proposing new language-specific kinds. } // (optional) The name of this symbol as it should be displayed to the user. // For example, the symbol "com/example/MyClass#myMethod(+1)." should have the @@ -418,11 +437,11 @@ message SymbolInformation { string display_name = 6; // (optional) The signature of this symbol as it's displayed in API // documentation or in hover tooltips. For example, a Java method that adds - // two numbers this would have `Document.language = "java"` and `Document.text - // = "void add(int a, int b)". The `language` and `text` fields are required - // while other fields such as `Documentation.occurrences` can be optionally - // included to support hyperlinking referenced symbols in the signature. - Document signature_documentation = 7; + // two numbers would have `Signature.language = "java"` and + // `Signature.text = "void add(int a, int b)"`. The `language` and `text` + // fields are required while `occurrences` can be optionally included to + // support hyperlinking referenced symbols in the signature. + Signature signature_documentation = 7; // (optional) The enclosing symbol if this is a local symbol. For non-local // symbols, the enclosing symbol should be parsed from the `symbol` field // using the `Descriptor` grammar. @@ -443,7 +462,6 @@ message SymbolInformation { string enclosing_symbol = 8; } - message Relationship { string symbol = 1; // When resolving "Find references", this field documents what other symbols @@ -494,10 +512,6 @@ message Relationship { // of mixins, you can use is_definition to relate the symbol to the // matching symbol in ancestor classes, and is_reference to relate the // symbol to the matching symbol in mixins. - // - // NOTE: At the moment, due to limitations of the SCIP to LSIF conversion, - // only global symbols in an index are allowed to use is_definition. - // The relationship may not get recorded if either symbol is local. bool is_definition = 5; // Update registerInverseRelationships on adding a new field here. } @@ -546,7 +560,7 @@ enum SyntaxKind { // `if`, `else`, `return`, `class`, etc. Keyword = 4; - IdentifierKeyword = 4 [deprecated=true]; + IdentifierKeyword = 4 [deprecated = true]; // `+`, `*`, etc. IdentifierOperator = 5; @@ -572,7 +586,7 @@ enum SyntaxKind { // NOTE: This corresponds to a package in Go and JVM languages, // and a module in languages like Python and JavaScript. IdentifierNamespace = 14; - IdentifierModule = 14 [deprecated=true]; + IdentifierModule = 14 [deprecated = true]; // Function references, including calls IdentifierFunction = 15; @@ -816,7 +830,7 @@ enum Language { JavaScript = 22; JavaScriptReact = 93; Jsonnet = 76; - Julia = 55; + Julia = 55; Justfile = 109; Kotlin = 4; LaTeX = 83; diff --git a/scip-java/src/main/scala/com/sourcegraph/scip_java/ScipPrinters.scala b/scip-java/src/main/scala/com/sourcegraph/scip_java/ScipPrinters.scala index 4e2027359..2916a7948 100644 --- a/scip-java/src/main/scala/com/sourcegraph/scip_java/ScipPrinters.scala +++ b/scip-java/src/main/scala/com/sourcegraph/scip_java/ScipPrinters.scala @@ -4,11 +4,13 @@ import scala.collection.mutable import scala.jdk.CollectionConverters.CollectionHasAsScala import scala.math.Ordering.Implicits.seqOrdering -import com.sourcegraph.Scip -import com.sourcegraph.Scip.SymbolRole import com.sourcegraph.scip_java.commands.CommentSyntax import moped.reporters.Input import moped.reporters.Position +import org.scip_code.scip.Document +import org.scip_code.scip.Occurrence +import org.scip_code.scip.SymbolInformation +import org.scip_code.scip.SymbolRole object ScipPrinters { @@ -19,7 +21,7 @@ object ScipPrinters { val sourceIndent = " " def printTextDocument( - doc: Scip.Document, + doc: Document, text: String, comments: CommentSyntax = CommentSyntax.default ): String = { @@ -148,7 +150,7 @@ object ScipPrinters { out.toString() } - private def mopedPosition(input: Input, occ: Scip.Occurrence): Position = { + private def mopedPosition(input: Input, occ: Occurrence): Position = { if (occ.getRangeCount == 3) Position.range( input, @@ -172,11 +174,11 @@ object ScipPrinters { private def formatOccurrence( input: Input, out: mutable.StringBuilder, - occ: Scip.Occurrence, + occ: Occurrence, line: String, - symtab: Map[String, Scip.SymbolInformation], + symtab: Map[String, SymbolInformation], comment: String, - syntheticDefinition: Option[Scip.SymbolInformation] = None + syntheticDefinition: Option[SymbolInformation] = None ): Unit = { val pos = mopedPosition(input, occ) val isMultiline = pos.startLine != pos.endLine @@ -263,7 +265,7 @@ object ScipPrinters { .append(info.getEnclosingSymbol) .append("\n") } - if (info.getKind != Scip.SymbolInformation.Kind.UnspecifiedKind) { + if (info.getKind != SymbolInformation.Kind.UnspecifiedKind) { out.append(prefix).append("kind ").append(info.getKind).append("\n") } 0.until(info.getDocumentationCount) diff --git a/scip-java/src/main/scala/com/sourcegraph/scip_java/commands/IndexSemanticdbCommand.scala b/scip-java/src/main/scala/com/sourcegraph/scip_java/commands/IndexSemanticdbCommand.scala index 194c1a85c..c8e561e61 100644 --- a/scip-java/src/main/scala/com/sourcegraph/scip_java/commands/IndexSemanticdbCommand.scala +++ b/scip-java/src/main/scala/com/sourcegraph/scip_java/commands/IndexSemanticdbCommand.scala @@ -6,7 +6,6 @@ import java.util.concurrent.TimeUnit import scala.jdk.CollectionConverters._ -import com.sourcegraph.Scip import com.sourcegraph.io.AbsolutePath import com.sourcegraph.scip_java.BuildInfo import com.sourcegraph.scip_java.buildtools.ClasspathEntry @@ -18,6 +17,7 @@ import moped.annotations._ import moped.cli.Application import moped.cli.Command import moped.cli.CommandParser +import org.scip_code.scip.ToolInfo import ujson.Arr import ujson.Obj @@ -95,8 +95,7 @@ final case class IndexSemanticdbCommand( AbsolutePath.of(output, sourceroot), sourceroot, reporter, - Scip - .ToolInfo + ToolInfo .newBuilder() .setName("scip-java") .setVersion(BuildInfo.version) diff --git a/scip-java/src/main/scala/com/sourcegraph/scip_java/commands/SnapshotCommand.scala b/scip-java/src/main/scala/com/sourcegraph/scip_java/commands/SnapshotCommand.scala index 6b3425739..3c298ff7d 100644 --- a/scip-java/src/main/scala/com/sourcegraph/scip_java/commands/SnapshotCommand.scala +++ b/scip-java/src/main/scala/com/sourcegraph/scip_java/commands/SnapshotCommand.scala @@ -7,13 +7,13 @@ import java.nio.file.attribute.BasicFileAttributes import scala.jdk.CollectionConverters._ -import com.sourcegraph.Scip import com.sourcegraph.io.DeleteVisitor import com.sourcegraph.scip_java.ScipPrinters import moped.annotations._ import moped.cli.Application import moped.cli.Command import moped.cli.CommandParser +import org.scip_code.scip.Index @Description( "Generates annotated snapshots for each `*.scip` file in the given target roots." @@ -52,7 +52,7 @@ case class SnapshotCommand( ): FileVisitResult = { if (scipPattern.matches(file)) { foundScipFile = true - val index = Scip.Index.parseFrom(Files.readAllBytes(file)) + val index = Index.parseFrom(Files.readAllBytes(file)) val root = URI.create(index.getMetadata.getProjectRoot) index .getDocumentsList diff --git a/scip-semanticdb/src/main/java/com/sourcegraph/scip_semanticdb/BazelBuildTool.java b/scip-semanticdb/src/main/java/com/sourcegraph/scip_semanticdb/BazelBuildTool.java index e5fb161f3..590a9e461 100644 --- a/scip-semanticdb/src/main/java/com/sourcegraph/scip_semanticdb/BazelBuildTool.java +++ b/scip-semanticdb/src/main/java/com/sourcegraph/scip_semanticdb/BazelBuildTool.java @@ -1,7 +1,7 @@ package com.sourcegraph.scip_semanticdb; import com.sourcegraph.scip_java.Bazelbuild; -import com.sourcegraph.Scip; +import org.scip_code.scip.ToolInfo; import java.io.*; import java.nio.file.FileSystems; @@ -58,7 +58,7 @@ public boolean hasErrors() { options.output, options.sourceroot, reporter, - Scip.ToolInfo.newBuilder().setName("scip-java").setVersion("HEAD").build(), + ToolInfo.newBuilder().setName("scip-java").setVersion("HEAD").build(), ScipOutputFormat.TYPED_PROTOBUF, options.parallel, mavenPackages, diff --git a/scip-semanticdb/src/main/java/com/sourcegraph/scip_semanticdb/ScipSemanticdb.java b/scip-semanticdb/src/main/java/com/sourcegraph/scip_semanticdb/ScipSemanticdb.java index 789a9afef..065ba314b 100644 --- a/scip-semanticdb/src/main/java/com/sourcegraph/scip_semanticdb/ScipSemanticdb.java +++ b/scip-semanticdb/src/main/java/com/sourcegraph/scip_semanticdb/ScipSemanticdb.java @@ -2,13 +2,20 @@ import com.google.protobuf.CodedInputStream; import com.sourcegraph.semanticdb_javac.Semanticdb; -import com.sourcegraph.semanticdb_javac.Semanticdb.SymbolInformation; -import com.sourcegraph.semanticdb_javac.Semanticdb.SymbolInformation.Kind; -import com.sourcegraph.semanticdb_javac.Semanticdb.SymbolInformation.Property; import com.sourcegraph.semanticdb_javac.Semanticdb.SymbolOccurrence; import com.sourcegraph.semanticdb_javac.Semanticdb.SymbolOccurrence.Role; import com.sourcegraph.semanticdb_javac.SemanticdbSymbols; -import com.sourcegraph.Scip; +import org.scip_code.scip.Document; +import org.scip_code.scip.Index; +import org.scip_code.scip.Metadata; +import org.scip_code.scip.Occurrence; +import org.scip_code.scip.ProtocolVersion; +import org.scip_code.scip.Relationship; +import org.scip_code.scip.Signature; +import org.scip_code.scip.SymbolInformation; +import org.scip_code.scip.SymbolRole; +import org.scip_code.scip.TextEncoding; +import org.scip_code.scip.ToolInfo; import java.io.IOException; import java.net.URI; @@ -73,71 +80,71 @@ private String typedSymbol(String symbol, Package pkg) { return "semanticdb maven " + pkg.repoName() + " " + pkg.version() + " " + symbol; } - private static Scip.SymbolInformation.Kind scipKind(SymbolInformation info) { - Kind kind = info.getKind(); + private static SymbolInformation.Kind scipKind(Semanticdb.SymbolInformation info) { + Semanticdb.SymbolInformation.Kind kind = info.getKind(); int properties = info.getProperties(); - boolean isStatic = (properties & Property.STATIC_VALUE) > 0; - boolean isAbstract = (properties & Property.ABSTRACT_VALUE) > 0; - boolean isEnum = (properties & Property.ENUM_VALUE) > 0; + boolean isStatic = (properties & Semanticdb.SymbolInformation.Property.STATIC_VALUE) > 0; + boolean isAbstract = (properties & Semanticdb.SymbolInformation.Property.ABSTRACT_VALUE) > 0; + boolean isEnum = (properties & Semanticdb.SymbolInformation.Property.ENUM_VALUE) > 0; switch (kind) { case CLASS: if (isEnum) { - return Scip.SymbolInformation.Kind.Enum; + return SymbolInformation.Kind.Enum; } else { - return Scip.SymbolInformation.Kind.Class; + return SymbolInformation.Kind.Class; } case CONSTRUCTOR: - return Scip.SymbolInformation.Kind.Constructor; + return SymbolInformation.Kind.Constructor; case FIELD: if (isStatic) { - return Scip.SymbolInformation.Kind.StaticField; + return SymbolInformation.Kind.StaticField; } else { - return Scip.SymbolInformation.Kind.Field; + return SymbolInformation.Kind.Field; } case INTERFACE: - return Scip.SymbolInformation.Kind.Interface; + return SymbolInformation.Kind.Interface; case LOCAL: if (isStatic) { - return Scip.SymbolInformation.Kind.StaticVariable; + return SymbolInformation.Kind.StaticVariable; } else { - return Scip.SymbolInformation.Kind.Variable; + return SymbolInformation.Kind.Variable; } case MACRO: - return Scip.SymbolInformation.Kind.Macro; + return SymbolInformation.Kind.Macro; case METHOD: if (isStatic) { - return Scip.SymbolInformation.Kind.StaticMethod; + return SymbolInformation.Kind.StaticMethod; } else if (isAbstract) { - return Scip.SymbolInformation.Kind.AbstractMethod; + return SymbolInformation.Kind.AbstractMethod; } else { - return Scip.SymbolInformation.Kind.Method; + return SymbolInformation.Kind.Method; } case OBJECT: - return Scip.SymbolInformation.Kind.Object; + return SymbolInformation.Kind.Object; case PACKAGE: - return Scip.SymbolInformation.Kind.Package; + return SymbolInformation.Kind.Package; case PACKAGE_OBJECT: - return Scip.SymbolInformation.Kind.PackageObject; + return SymbolInformation.Kind.PackageObject; case PARAMETER: - return Scip.SymbolInformation.Kind.Parameter; + return SymbolInformation.Kind.Parameter; case SELF_PARAMETER: - return Scip.SymbolInformation.Kind.SelfParameter; + return SymbolInformation.Kind.SelfParameter; case TRAIT: - return Scip.SymbolInformation.Kind.Trait; + return SymbolInformation.Kind.Trait; case TYPE: if (isEnum) { - return Scip.SymbolInformation.Kind.Enum; + return SymbolInformation.Kind.Enum; } else { - return Scip.SymbolInformation.Kind.Type; + return SymbolInformation.Kind.Type; } case TYPE_PARAMETER: - return Scip.SymbolInformation.Kind.TypeParameter; + return SymbolInformation.Kind.TypeParameter; case UNKNOWN_KIND: - return Scip.SymbolInformation.Kind.UnspecifiedKind; + return SymbolInformation.Kind.UnspecifiedKind; } - return Scip.SymbolInformation.Kind.UnspecifiedKind; + return SymbolInformation.Kind.UnspecifiedKind; } public static boolean isDefinitionRole(Role role) { @@ -156,14 +163,14 @@ private void processTypedDocument( StreamSupport.stream(options.sourceroot.relativize(absolutePath).spliterator(), false) .map(p -> p.getFileName().toString()) .collect(Collectors.joining("/")); - Scip.Document.Builder tdoc = Scip.Document.newBuilder().setRelativePath(relativePath); + Document.Builder tdoc = Document.newBuilder().setRelativePath(relativePath); for (SymbolOccurrence occ : doc.sortedSymbolOccurrences()) { if (occ.getSymbol().isEmpty()) { continue; } int role = 0; if (isDefinitionRole(occ.getRole())) { - role |= Scip.SymbolRole.Definition_VALUE; + role |= SymbolRole.Definition_VALUE; } boolean isSingleLineRange = occ.getRange().getStartLine() == occ.getRange().getEndLine(); Iterable range = @@ -178,8 +185,8 @@ private void processTypedDocument( occ.getRange().getEndLine(), occ.getRange().getEndCharacter()); Package pkg = packages.packageForSymbol(occ.getSymbol()).orElse(Package.EMPTY); - Scip.Occurrence.Builder occBuilder = - Scip.Occurrence.newBuilder() + Occurrence.Builder occBuilder = + Occurrence.newBuilder() .addAllRange(range) .setSymbol(typedSymbol(occ.getSymbol(), pkg)) .setSymbolRoles(role); @@ -204,13 +211,13 @@ private void processTypedDocument( tdoc.addOccurrences(occBuilder); } Symtab symtab = new Symtab(doc.semanticdb); - for (SymbolInformation info : doc.semanticdb.getSymbolsList()) { + for (Semanticdb.SymbolInformation info : doc.semanticdb.getSymbolsList()) { if (info.getSymbol().isEmpty()) { continue; } Package pkg = packages.packageForSymbol(info.getSymbol()).orElse(Package.EMPTY); - Scip.SymbolInformation.Builder scipInfo = - Scip.SymbolInformation.newBuilder().setSymbol(typedSymbol(info.getSymbol(), pkg)); + SymbolInformation.Builder scipInfo = + SymbolInformation.newBuilder().setSymbol(typedSymbol(info.getSymbol(), pkg)); scipInfo.setDisplayName(info.getDisplayName()); if (!info.getEnclosingSymbol().isEmpty()) { @@ -227,7 +234,7 @@ private void processTypedDocument( Package inverseReferencePkg = packages.packageForSymbol(inverseReference).orElse(Package.EMPTY); scipInfo.addRelationships( - Scip.Relationship.newBuilder() + Relationship.newBuilder() .setSymbol(typedSymbol(inverseReference, inverseReferencePkg)) .setIsImplementation(true) .setIsReference(true)); @@ -241,10 +248,10 @@ private void processTypedDocument( } Package definitionSymbolPkg = packages.packageForSymbol(definitionSymbol).orElse(Package.EMPTY); - SymbolInformation definitionInfo = symtab.symbols.get(definitionSymbol); + Semanticdb.SymbolInformation definitionInfo = symtab.symbols.get(definitionSymbol); scipInfo.addRelationships( - Scip.Relationship.newBuilder() + Relationship.newBuilder() .setSymbol(typedSymbol(definitionSymbol, definitionSymbolPkg)) .setIsDefinition(true) .setIsReference( @@ -264,7 +271,7 @@ private void processTypedDocument( Package overriddenSymbolPkg = packages.packageForSymbol(overriddenSymbol).orElse(Package.EMPTY); scipInfo.addRelationships( - Scip.Relationship.newBuilder() + Relationship.newBuilder() .setSymbol(typedSymbol(overriddenSymbol, overriddenSymbolPkg)) .setIsImplementation(true) .setIsReference(supportsReferenceRelationship(info))); @@ -273,11 +280,8 @@ private void processTypedDocument( String language = doc.semanticdb.getLanguage().toString().toLowerCase(Locale.ROOT).intern(); String signature = new SignatureFormatter(info, symtab).formatSymbol(); - Scip.Document.Builder signatureDocumentation = - Scip.Document.newBuilder() - .setRelativePath(relativePath) - .setLanguage(language) - .setText(signature); + Signature.Builder signatureDocumentation = + Signature.newBuilder().setLanguage(language).setText(signature); scipInfo.setSignatureDocumentation(signatureDocumentation); } String documentation = info.getDocumentation().getMessage(); @@ -286,19 +290,19 @@ private void processTypedDocument( } tdoc.addSymbols(scipInfo); } - writer.emitTyped(Scip.Index.newBuilder().addDocuments(tdoc).build()); + writer.emitTyped(Index.newBuilder().addDocuments(tdoc).build()); } } - private Scip.Index typedMetadata() { - return Scip.Index.newBuilder() + private Index typedMetadata() { + return Index.newBuilder() .setMetadata( - Scip.Metadata.newBuilder() - .setVersion(Scip.ProtocolVersion.UnspecifiedProtocolVersion) + Metadata.newBuilder() + .setVersion(ProtocolVersion.UnspecifiedProtocolVersion) .setProjectRoot(options.sourceroot.toUri().toString()) - .setTextDocumentEncoding(Scip.TextEncoding.UTF8) + .setTextDocumentEncoding(TextEncoding.UTF8) .setToolInfo( - Scip.ToolInfo.newBuilder() + ToolInfo.newBuilder() .setName(options.toolInfo.getName()) .setVersion(options.toolInfo.getVersion()) .addAllArguments(options.toolInfo.getArgumentsList()))) @@ -335,7 +339,7 @@ private InverseReferenceRelationships inverseReferenceRelationships(List f private Stream referenceRelationships(ScipTextDocument document) { ArrayList relationships = new ArrayList<>(); for (int i = 0; i < document.semanticdb.getSymbolsCount(); i++) { - SymbolInformation info = document.semanticdb.getSymbols(i); + Semanticdb.SymbolInformation info = document.semanticdb.getSymbols(i); if (!supportsReferenceRelationship(info)) { continue; } @@ -353,7 +357,7 @@ private Stream referenceRelationships(ScipTextDocument docum return relationships.stream(); } - private static boolean supportsReferenceRelationship(SymbolInformation info) { + private static boolean supportsReferenceRelationship(Semanticdb.SymbolInformation info) { switch (info.getKind()) { case INTERFACE: case TYPE: diff --git a/scip-semanticdb/src/main/java/com/sourcegraph/scip_semanticdb/ScipSemanticdbOptions.java b/scip-semanticdb/src/main/java/com/sourcegraph/scip_semanticdb/ScipSemanticdbOptions.java index e598fe495..c885eff0c 100644 --- a/scip-semanticdb/src/main/java/com/sourcegraph/scip_semanticdb/ScipSemanticdbOptions.java +++ b/scip-semanticdb/src/main/java/com/sourcegraph/scip_semanticdb/ScipSemanticdbOptions.java @@ -1,8 +1,8 @@ package com.sourcegraph.scip_semanticdb; -import com.sourcegraph.Scip; import java.nio.file.Path; import java.util.List; +import org.scip_code.scip.ToolInfo; /** Configuration options to tweak the scip-semanticdb command. */ public class ScipSemanticdbOptions { @@ -11,7 +11,7 @@ public class ScipSemanticdbOptions { public final Path output; public final Path sourceroot; public final ScipSemanticdbReporter reporter; - public final Scip.ToolInfo toolInfo; + public final ToolInfo toolInfo; public final ScipOutputFormat format; public final boolean parallel; public final List packages; @@ -24,7 +24,7 @@ public ScipSemanticdbOptions( Path output, Path sourceroot, ScipSemanticdbReporter reporter, - Scip.ToolInfo toolInfo, + ToolInfo toolInfo, ScipOutputFormat format, boolean parallel, List packages, diff --git a/scip-semanticdb/src/main/java/com/sourcegraph/scip_semanticdb/ScipWriter.java b/scip-semanticdb/src/main/java/com/sourcegraph/scip_semanticdb/ScipWriter.java index 2b323740b..14a4e1d49 100644 --- a/scip-semanticdb/src/main/java/com/sourcegraph/scip_semanticdb/ScipWriter.java +++ b/scip-semanticdb/src/main/java/com/sourcegraph/scip_semanticdb/ScipWriter.java @@ -1,7 +1,7 @@ package com.sourcegraph.scip_semanticdb; import com.google.protobuf.util.JsonFormat; -import com.sourcegraph.Scip; +import org.scip_code.scip.Index; import java.io.BufferedOutputStream; import java.io.IOException; @@ -35,7 +35,7 @@ public ScipWriter(ScipSemanticdbOptions options) throws IOException { this.jsonPrinter = JsonFormat.printer().omittingInsignificantWhitespace(); } - public void emitTyped(Scip.Index index) { + public void emitTyped(Index index) { try { if (options.format.isNewlineDelimitedJSON()) { this.output.write(jsonPrinter.print(index).getBytes(StandardCharsets.UTF_8)); diff --git a/tests/snapshots/src/main/scala/tests/MinimizedSnapshotScipGenerator.scala b/tests/snapshots/src/main/scala/tests/MinimizedSnapshotScipGenerator.scala index 86f69a2a5..b17dafe99 100644 --- a/tests/snapshots/src/main/scala/tests/MinimizedSnapshotScipGenerator.scala +++ b/tests/snapshots/src/main/scala/tests/MinimizedSnapshotScipGenerator.scala @@ -10,10 +10,10 @@ import scala.jdk.CollectionConverters.CollectionHasAsScala import scala.meta.internal.io.FileIO import scala.meta.io.AbsolutePath -import com.sourcegraph.Scip.Index import com.sourcegraph.io.DeleteVisitor import com.sourcegraph.scip_java.ScipJava import com.sourcegraph.scip_java.ScipPrinters +import org.scip_code.scip.Index class MinimizedSnapshotScipGenerator { def run(args: List[String]): Unit = { From a75037415f8ba5a008967a2834b0f1bea60816b0 Mon Sep 17 00:00:00 2001 From: jupblb Date: Tue, 2 Jun 2026 09:58:04 +0200 Subject: [PATCH 2/6] bazel: consume scip-java-bindings from Maven Central --- WORKSPACE | 5 +- scip-java-proto/src/main/protobuf/BUILD | 16 - scip-java-proto/src/main/protobuf/scip.proto | 900 ------------------- scip-semanticdb/BUILD | 2 +- 4 files changed, 4 insertions(+), 919 deletions(-) delete mode 100644 scip-java-proto/src/main/protobuf/BUILD delete mode 100644 scip-java-proto/src/main/protobuf/scip.proto diff --git a/WORKSPACE b/WORKSPACE index 18f83df71..d3af54387 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -49,9 +49,10 @@ rules_jvm_external_setup() load("@rules_jvm_external//:defs.bzl", "maven_install") maven_install( artifacts = [ - "com.google.protobuf:protobuf-java:3.15.6", - "com.google.protobuf:protobuf-java-util:3.15.6", + "com.google.protobuf:protobuf-java:4.34.2", + "com.google.protobuf:protobuf-java-util:4.34.2", "org.projectlombok:lombok:1.18.22", + "org.scip-code:scip-java-bindings:0.8.0", ], repositories = [ "https://repo1.maven.org/maven2", diff --git a/scip-java-proto/src/main/protobuf/BUILD b/scip-java-proto/src/main/protobuf/BUILD deleted file mode 100644 index c42438965..000000000 --- a/scip-java-proto/src/main/protobuf/BUILD +++ /dev/null @@ -1,16 +0,0 @@ -load("@rules_java//java:defs.bzl", "java_proto_library") -load("@rules_proto//proto:defs.bzl", "proto_library") - -package( - default_visibility = ["//visibility:public"], -) - -java_proto_library( - name = "scip_java_proto", - deps = [":scip_proto"], -) - -proto_library( - name = "scip_proto", - srcs = ["scip.proto"], -) diff --git a/scip-java-proto/src/main/protobuf/scip.proto b/scip-java-proto/src/main/protobuf/scip.proto deleted file mode 100644 index 326df0dd5..000000000 --- a/scip-java-proto/src/main/protobuf/scip.proto +++ /dev/null @@ -1,900 +0,0 @@ -// An index contains one or more pieces of information about a given piece of -// source code or software artifact. Complementary information can be merged -// together from multiple sources to provide a unified code intelligence -// experience. -// -// Programs producing a file of this format is an "indexer" and may operate -// somewhere on the spectrum between precision, such as indexes produced by -// compiler-backed indexers, and heurstics, such as indexes produced by local -// syntax-directed analysis for scope rules. - -syntax = "proto3"; - -package scip; - -option go_package = "github.com/scip-code/scip/bindings/go/scip/"; -option java_multiple_files = true; -option java_outer_classname = "ScipProto"; -option java_package = "org.scip_code.scip"; - -// Index represents a complete SCIP index for a workspace this is rooted at a -// single directory. An Index message payload can have a large memory footprint -// and it's therefore recommended to emit and consume an Index payload one field -// value at a time. To permit streaming consumption of an Index payload, the -// `metadata` field must appear at the start of the stream and must only appear -// once in the stream. Other field values may appear in any order. -message Index { - // Metadata about this index. - Metadata metadata = 1; - // Documents that belong to this index. - repeated Document documents = 2; - // (optional) Symbols that are referenced from this index but are defined in - // an external package (a separate `Index` message). Leave this field empty - // if you assume the external package will get indexed separately. If the - // external package won't get indexed for some reason then you can use this - // field to provide hover documentation for those external symbols. - repeated SymbolInformation external_symbols = 3; - // IMPORTANT: When adding a new field to `Index` here, add a matching - // function in `IndexVisitor` and update `ParseStreaming`. -} - -message Metadata { - // Which version of this protocol was used to generate this index? - ProtocolVersion version = 1; - // Information about the tool that produced this index. - ToolInfo tool_info = 2; - // URI-encoded absolute path to the root directory of this index. All - // documents in this index must appear in a subdirectory of this root - // directory. - string project_root = 3; - // Text encoding of the source files on disk that are referenced from - // `Document.relative_path`. This value is unrelated to the `Document.text` - // field, which is a Protobuf string and hence must be UTF-8 encoded. - TextEncoding text_document_encoding = 4; -} - -enum ProtocolVersion { - UnspecifiedProtocolVersion = 0; -} - -enum TextEncoding { - UnspecifiedTextEncoding = 0; - UTF8 = 1; - UTF16 = 2; -} - -message ToolInfo { - // Name of the indexer that produced this index. - string name = 1; - // Version of the indexer that produced this index. - string version = 2; - // Command-line arguments that were used to invoke this indexer. - repeated string arguments = 3; -} - -// Document defines the metadata about a source file on disk. -message Document { - // The string ID for the programming language this file is written in. - // The `Language` enum contains the names of most common programming languages. - // This field is typed as a string to permit any programming language, including - // ones that are not specified by the `Language` enum. - string language = 4; - // (Required) Unique path to the text document. - // - // 1. The path must be relative to the directory supplied in the associated - // `Metadata.project_root`. - // 2. The path must not begin with a leading '/'. - // 3. The path must point to a regular file, not a symbolic link. - // 4. The path must use '/' as the separator, including on Windows. - // 5. The path must be canonical; it cannot include empty components ('//'), - // or '.' or '..'. - string relative_path = 1; - // Occurrences that appear in this file. - repeated Occurrence occurrences = 2; - // Symbols that are "defined" within this document. - // - // This should include symbols which technically do not have any definition, - // but have a reference and are defined by some other symbol (see - // Relationship.is_definition). - repeated SymbolInformation symbols = 3; - - // (optional) Text contents of this document. Indexers are not expected to - // include the text by default. It's preferable that clients read the text - // contents from the file system by resolving the absolute path from joining - // `Index.metadata.project_root` and `Document.relative_path`. This field - // can be useful for testing or when working with virtual/in-memory documents. - string text = 5; - - // Specifies the encoding used for source ranges in this Document. - // - // Usually, this will match the type used to index the string type - // in the indexer's implementation language in O(1) time. - // - For an indexer implemented in JVM/.NET language or JavaScript/TypeScript, - // use UTF16CodeUnitOffsetFromLineStart. - // - For an indexer implemented in Python, - // use UTF32CodeUnitOffsetFromLineStart. - // - For an indexer implemented in Go, Rust or C++, - // use UTF8ByteOffsetFromLineStart. - PositionEncoding position_encoding = 6; -} - -// Encoding used to interpret the 'character' value in source ranges. -enum PositionEncoding { - // Default value. This value should not be used by new SCIP indexers - // so that a consumer can process the SCIP index without ambiguity. - UnspecifiedPositionEncoding = 0; - // The 'character' value is interpreted as an offset in terms - // of UTF-8 code units (i.e. bytes). - // - // Example: For the string "🚀 Woo" in UTF-8, the bytes are - // [240, 159, 154, 128, 32, 87, 111, 111], so the offset for 'W' - // would be 5. - UTF8CodeUnitOffsetFromLineStart = 1; - // The 'character' value is interpreted as an offset in terms - // of UTF-16 code units (each is 2 bytes). - // - // Example: For the string "🚀 Woo", the UTF-16 code units are - // ['\ud83d', '\ude80', ' ', 'W', 'o', 'o'], so the offset for 'W' - // would be 3. - UTF16CodeUnitOffsetFromLineStart = 2; - // The 'character' value is interpreted as an offset in terms - // of UTF-32 code units (each is 4 bytes). - // - // Example: For the string "🚀 Woo", the UTF-32 code units are - // ['🚀', ' ', 'W', 'o', 'o'], so the offset for 'W' would be 2. - UTF32CodeUnitOffsetFromLineStart = 3; -} - -// Symbol is similar to a URI, it identifies a class, method, or a local -// variable. `SymbolInformation` contains rich metadata about symbols such as -// the docstring. -// -// Symbol has a standardized string representation, which can be used -// interchangeably with `Symbol`. The syntax for Symbol is the following: -// ``` -// # ()+ stands for one or more repetitions of -// # ()? stands for zero or one occurrence of -// ::= ' ' ' ' ()+ | 'local ' -// ::= ' ' ' ' -// ::= any UTF-8, escape spaces with double space. Must not be empty nor start with 'local' -// ::= any UTF-8, escape spaces with double space. Use the placeholder '.' to indicate an empty value -// ::= same as above -// ::= same as above -// ::= | | | | | | | -// ::= '/' -// ::= '#' -// ::= '.' -// ::= ':' -// ::= '!' -// ::= '(' ()? ').' -// ::= '[' ']' -// ::= '(' ')' -// ::= -// ::= -// ::= | -// ::= ()+ -// ::= '_' | '+' | '-' | '$' | ASCII letter or digit -// ::= '`' ()+ '`', must contain at least one non- -// ::= any UTF-8, escape backticks with double backtick. -// ::= -// ``` -// -// The list of descriptors for a symbol should together form a fully -// qualified name for the symbol. That is, it should serve as a unique -// identifier across the package. Typically, it will include one descriptor -// for every node in the AST (along the ancestry path) between the root of -// the file and the node corresponding to the symbol. -// -// Local symbols MUST only be used for entities which are local to a Document, -// and cannot be accessed from outside the Document. -message Symbol { - string scheme = 1; - Package package = 2; - repeated Descriptor descriptors = 3; -} - -// Unit of packaging and distribution. -// -// NOTE: This corresponds to a module in Go and JVM languages. -message Package { - string manager = 1; - string name = 2; - string version = 3; -} - -message Descriptor { - enum Suffix { - option allow_alias = true; - UnspecifiedSuffix = 0; - // Unit of code abstraction and/or namespacing. - // - // NOTE: This corresponds to a package in Go and JVM languages. - Namespace = 1; - // Use Namespace instead. - Package = 1 [deprecated = true]; - Type = 2; - Term = 3; - Method = 4; - TypeParameter = 5; - Parameter = 6; - // Can be used for any purpose. - Meta = 7; - Local = 8; - Macro = 9; - } - string name = 1; - string disambiguator = 2; - Suffix suffix = 3; - // NOTE: If you add new fields here, make sure to update the prepareSlot() - // function responsible for parsing symbols. -} - -// Signature represents the signature of a symbol as it's displayed in API -// documentation or hover tooltips. It uses a subset of Document's fields with -// the same field numbers for wire compatibility with older indexes that encoded -// signatures using the Document message type. -message Signature { - // The language of the signature, e.g. "java", "go", "python". - string language = 4; - // The text content of the signature, e.g. "void add(int a, int b)". - string text = 5; - // (optional) Occurrences within the signature text that reference other - // symbols, enabling hyperlinking of types in the signature. Ranges are - // relative to the `text` field. - repeated Occurrence occurrences = 2; - - // Reserved field numbers from the Document message to prevent accidental - // reuse, which would break wire compatibility with older indexes. - reserved 1, 3, 6; -} - -// SymbolInformation defines metadata about a symbol, such as the symbol's -// docstring or what package it's defined it. -message SymbolInformation { - // Identifier of this symbol, which can be referenced from `Occurence.symbol`. - // The string must be formatted according to the grammar in `Symbol`. - string symbol = 1; - // (optional, but strongly recommended) The markdown-formatted documentation - // for this symbol. Use `SymbolInformation.signature_documentation` to - // document the method/class/type signature of this symbol. - // Due to historical reasons, indexers may include signature documentation in - // this field by rendering markdown code blocks. New indexers should only - // include non-code documentation in this field, for example docstrings. - repeated string documentation = 3; - // (optional) Relationships to other symbols (e.g., implements, type definition). - repeated Relationship relationships = 4; - // The kind of this symbol. Use this field instead of - // `SymbolDescriptor.Suffix` to determine whether something is, for example, a - // class or a method. - Kind kind = 5; - // (optional) Kind represents the fine-grained category of a symbol, suitable for presenting - // information about the symbol's meaning in the language. - // - // For example: - // - A Java method would have the kind `Method` while a Go function would - // have the kind `Function`, even if the symbols for these use the same - // syntax for the descriptor `SymbolDescriptor.Suffix.Method`. - // - A Go struct has the symbol kind `Struct` while a Java class has - // the symbol kind `Class` even if they both have the same descriptor: - // `SymbolDescriptor.Suffix.Type`. - // - // Since Kind is more fine-grained than Suffix: - // - If two symbols have the same Kind, they should share the same Suffix. - // - If two symbols have different Suffixes, they should have different Kinds. - enum Kind { - UnspecifiedKind = 0; - // A method which may or may not have a body. For Java, Kotlin etc. - AbstractMethod = 66; - // For Ruby's attr_accessor - Accessor = 72; - Array = 1; - // For Alloy - Assertion = 2; - AssociatedType = 3; - // For C++ - Attribute = 4; - // For Lean - Axiom = 5; - Boolean = 6; - Class = 7; - // For C++ - Concept = 86; - Constant = 8; - Constructor = 9; - // For Solidity - Contract = 62; - // For Haskell - DataFamily = 10; - // For C# and F# - Delegate = 73; - Enum = 11; - EnumMember = 12; - Error = 63; - Event = 13; - // For Dart - Extension = 84; - // For Alloy - Fact = 14; - Field = 15; - File = 16; - Function = 17; - // For 'get' in Swift, 'attr_reader' in Ruby - Getter = 18; - // For Raku - Grammar = 19; - // For Purescript and Lean - Instance = 20; - Interface = 21; - Key = 22; - // For Racket - Lang = 23; - // For Lean - Lemma = 24; - // For solidity - Library = 64; - Macro = 25; - Method = 26; - // For Ruby - MethodAlias = 74; - // Analogous to 'ThisParameter' and 'SelfParameter', but for languages - // like Go where the receiver doesn't have a conventional name. - MethodReceiver = 27; - // Analogous to 'AbstractMethod', for Go. - MethodSpecification = 67; - // For Protobuf - Message = 28; - // For Dart - Mixin = 85; - // For Solidity - Modifier = 65; - Module = 29; - Namespace = 30; - Null = 31; - Number = 32; - Object = 33; - Operator = 34; - Package = 35; - PackageObject = 36; - Parameter = 37; - ParameterLabel = 38; - // For Haskell's PatternSynonyms - Pattern = 39; - // For Alloy - Predicate = 40; - Property = 41; - // Analogous to 'Trait' and 'TypeClass', for Swift and Objective-C - Protocol = 42; - // Analogous to 'AbstractMethod', for Swift and Objective-C. - ProtocolMethod = 68; - // Analogous to 'AbstractMethod', for C++. - PureVirtualMethod = 69; - // For Haskell - Quasiquoter = 43; - // 'self' in Python, Rust, Swift etc. - SelfParameter = 44; - // For 'set' in Swift, 'attr_writer' in Ruby - Setter = 45; - // For Alloy, analogous to 'Struct'. - Signature = 46; - // For Ruby - SingletonClass = 75; - // Analogous to 'StaticMethod', for Ruby. - SingletonMethod = 76; - // Analogous to 'StaticField', for C++ - StaticDataMember = 77; - // For C# - StaticEvent = 78; - // For C# - StaticField = 79; - // For Java, C#, C++ etc. - StaticMethod = 80; - // For C#, TypeScript etc. - StaticProperty = 81; - // For C, C++ - StaticVariable = 82; - String = 48; - Struct = 49; - // For Swift - Subscript = 47; - // For Lean - Tactic = 50; - // For Lean - Theorem = 51; - // Method receiver for languages - // 'this' in JavaScript, C++, Java etc. - ThisParameter = 52; - // Analogous to 'Protocol' and 'TypeClass', for Rust, Scala etc. - Trait = 53; - // Analogous to 'AbstractMethod', for Rust, Scala etc. - TraitMethod = 70; - // Data type definition for languages like OCaml which use `type` - // rather than separate keywords like `struct` and `enum`. - Type = 54; - TypeAlias = 55; - // Analogous to 'Trait' and 'Protocol', for Haskell, Purescript etc. - TypeClass = 56; - // Analogous to 'AbstractMethod', for Haskell, Purescript etc. - TypeClassMethod = 71; - // For Haskell - TypeFamily = 57; - TypeParameter = 58; - // For C, C++, Capn Proto - Union = 59; - Value = 60; - Variable = 61; - // Next = 87; - // Feel free to open a PR proposing new language-specific kinds. - } - // (optional) The name of this symbol as it should be displayed to the user. - // For example, the symbol "com/example/MyClass#myMethod(+1)." should have the - // display name "myMethod". The `symbol` field is not a reliable source of - // the display name for several reasons: - // - // - Local symbols don't encode the name. - // - Some languages have case-insensitive names, so the symbol is all-lowercase. - // - The symbol may encode names with special characters that should not be - // displayed to the user. - string display_name = 6; - // (optional) The signature of this symbol as it's displayed in API - // documentation or in hover tooltips. For example, a Java method that adds - // two numbers would have `Signature.language = "java"` and - // `Signature.text = "void add(int a, int b)"`. The `language` and `text` - // fields are required while `occurrences` can be optionally included to - // support hyperlinking referenced symbols in the signature. - Signature signature_documentation = 7; - // (optional) The enclosing symbol if this is a local symbol. For non-local - // symbols, the enclosing symbol should be parsed from the `symbol` field - // using the `Descriptor` grammar. - // - // The primary use-case for this field is to allow local symbol to be displayed - // in a symbol hierarchy for API documentation. It's OK to leave this field - // empty for local variables since local variables usually don't belong in API - // documentation. However, in the situation that you wish to include a local - // symbol in the hierarchy, then you can use `enclosing_symbol` to locate the - // "parent" or "owner" of this local symbol. For example, a Java indexer may - // choose to use local symbols for private class fields while providing an - // `enclosing_symbol` to reference the enclosing class to allow the field to - // be part of the class documentation hierarchy. From the perspective of an - // author of an indexer, the decision to use a local symbol or global symbol - // should exclusively be determined whether the local symbol is accessible - // outside the document, not by the capability to find the enclosing - // symbol. - string enclosing_symbol = 8; -} - -message Relationship { - string symbol = 1; - // When resolving "Find references", this field documents what other symbols - // should be included together with this symbol. For example, consider the - // following TypeScript code that defines two symbols `Animal#sound()` and - // `Dog#sound()`: - // ```ts - // interface Animal { - // ^^^^^^ definition Animal# - // sound(): string - // ^^^^^ definition Animal#sound() - // } - // class Dog implements Animal { - // ^^^ definition Dog#, relationships = [{symbol: "Animal#", is_implementation: true}] - // public sound(): string { return "woof" } - // ^^^^^ definition Dog#sound(), references_symbols = Animal#sound(), relationships = [{symbol: "Animal#sound()", is_implementation:true, is_reference: true}] - // } - // const animal: Animal = new Dog() - // ^^^^^^ reference Animal# - // console.log(animal.sound()) - // ^^^^^ reference Animal#sound() - // ``` - // Doing "Find references" on the symbol `Animal#sound()` should return - // references to the `Dog#sound()` method as well. Vice-versa, doing "Find - // references" on the `Dog#sound()` method should include references to the - // `Animal#sound()` method as well. - bool is_reference = 2; - // Similar to `is_reference` but for "Find implementations". - // It's common for `is_implementation` and `is_reference` to both be true but - // it's not always the case. - // In the TypeScript example above, observe that `Dog#` has an - // `is_implementation` relationship with `"Animal#"` but not `is_reference`. - // This is because "Find references" on the "Animal#" symbol should not return - // "Dog#". We only want "Dog#" to return as a result for "Find - // implementations" on the "Animal#" symbol. - bool is_implementation = 3; - // Similar to `references_symbols` but for "Go to type definition". - bool is_type_definition = 4; - // Allows overriding the behavior of "Go to definition" and "Find references" - // for symbols which do not have a definition of their own or could - // potentially have multiple definitions. - // - // For example, in a language with single inheritance and no field overriding, - // inherited fields can reuse the same symbol as the ancestor which declares - // the field. In such a situation, is_definition is not needed. - // - // On the other hand, in languages with single inheritance and some form - // of mixins, you can use is_definition to relate the symbol to the - // matching symbol in ancestor classes, and is_reference to relate the - // symbol to the matching symbol in mixins. - bool is_definition = 5; - // Update registerInverseRelationships on adding a new field here. -} - -// SymbolRole declares what "role" a symbol has in an occurrence. A role is -// encoded as a bitset where each bit represents a different role. For example, -// to determine if the `Import` role is set, test whether the second bit of the -// enum value is defined. In pseudocode, this can be implemented with the -// logic: `const isImportRole = (role.value & SymbolRole.Import.value) > 0`. -enum SymbolRole { - // This case is not meant to be used; it only exists to avoid an error - // from the Protobuf code generator. - UnspecifiedSymbolRole = 0; - // Is the symbol defined here? If not, then this is a symbol reference. - Definition = 0x1; - // Is the symbol imported here? - Import = 0x2; - // Is the symbol written here? - WriteAccess = 0x4; - // Is the symbol read here? - ReadAccess = 0x8; - // Is the symbol in generated code? - Generated = 0x10; - // Is the symbol in test code? - Test = 0x20; - // Is this a signature for a symbol that is defined elsewhere? - // - // Applies to forward declarations for languages like C, C++ - // and Objective-C, as well as `val` declarations in interface - // files in languages like SML and OCaml. - ForwardDefinition = 0x40; -} - -enum SyntaxKind { - option allow_alias = true; - - UnspecifiedSyntaxKind = 0; - - // Comment, including comment markers and text - Comment = 1; - - // `;` `.` `,` - PunctuationDelimiter = 2; - // (), {}, [] when used syntactically - PunctuationBracket = 3; - - // `if`, `else`, `return`, `class`, etc. - Keyword = 4; - IdentifierKeyword = 4 [deprecated = true]; - - // `+`, `*`, etc. - IdentifierOperator = 5; - - // non-specific catch-all for any identifier not better described elsewhere - Identifier = 6; - // Identifiers builtin to the language: `min`, `print` in Python. - IdentifierBuiltin = 7; - // Identifiers representing `null`-like values: `None` in Python, `nil` in Go. - IdentifierNull = 8; - // `xyz` in `const xyz = "hello"` - IdentifierConstant = 9; - // `var X = "hello"` in Go - IdentifierMutableGlobal = 10; - // Parameter definition and references - IdentifierParameter = 11; - // Identifiers for variable definitions and references within a local scope - IdentifierLocal = 12; - // Identifiers that shadow other identifiers in an outer scope - IdentifierShadowed = 13; - // Identifier representing a unit of code abstraction and/or namespacing. - // - // NOTE: This corresponds to a package in Go and JVM languages, - // and a module in languages like Python and JavaScript. - IdentifierNamespace = 14; - IdentifierModule = 14 [deprecated = true]; - - // Function references, including calls - IdentifierFunction = 15; - // Function definition only - IdentifierFunctionDefinition = 16; - - // Macro references, including invocations - IdentifierMacro = 17; - // Macro definition only - IdentifierMacroDefinition = 18; - - // non-builtin types - IdentifierType = 19; - // builtin types only, such as `str` for Python or `int` in Go - IdentifierBuiltinType = 20; - - // Python decorators, c-like __attribute__ - IdentifierAttribute = 21; - - // `\b` - RegexEscape = 22; - // `*`, `+` - RegexRepeated = 23; - // `.` - RegexWildcard = 24; - // `(`, `)`, `[`, `]` - RegexDelimiter = 25; - // `|`, `-` - RegexJoin = 26; - - // Literal strings: "Hello, world!" - StringLiteral = 27; - // non-regex escapes: "\t", "\n" - StringLiteralEscape = 28; - // datetimes within strings, special words within a string, `{}` in format strings - StringLiteralSpecial = 29; - // "key" in { "key": "value" }, useful for example in JSON - StringLiteralKey = 30; - // 'c' or similar, in languages that differentiate strings and characters - CharacterLiteral = 31; - // Literal numbers, both floats and integers - NumericLiteral = 32; - // `true`, `false` - BooleanLiteral = 33; - - // Used for XML-like tags - Tag = 34; - // Attribute name in XML-like tags - TagAttribute = 35; - // Delimiters for XML-like tags - TagDelimiter = 36; -} - -// Occurrence associates a source position with a symbol and/or highlighting -// information. -// -// If possible, indexers should try to bundle logically related information -// across occurrences into a single occurrence to reduce payload sizes. -message Occurrence { - // Half-open [start, end) range of this occurrence. Must be exactly three or four - // elements: - // - // - Four elements: `[startLine, startCharacter, endLine, endCharacter]` - // - Three elements: `[startLine, startCharacter, endCharacter]`. The end line - // is inferred to have the same value as the start line. - // - // It is allowed for the range to be empty (i.e. start==end). - // - // Line numbers and characters are always 0-based. Make sure to increment the - // line/character values before displaying them in an editor-like UI because - // editors conventionally use 1-based numbers. - // - // The 'character' value is interpreted based on the PositionEncoding for - // the Document. - // - // Historical note: the original draft of this schema had a `Range` message - // type with `start` and `end` fields of type `Position`, mirroring LSP. - // Benchmarks revealed that this encoding was inefficient and that we could - // reduce the total payload size of an index by 50% by using `repeated int32` - // instead. The `repeated int32` encoding is admittedly more embarrassing to - // work with in some programming languages but we hope the performance - // improvements make up for it. - repeated int32 range = 1; - // (optional) The symbol that appears at this position. See - // `SymbolInformation.symbol` for how to format symbols as strings. - string symbol = 2; - // (optional) Bitset containing `SymbolRole`s in this occurrence. - // See `SymbolRole`'s documentation for how to read and write this field. - int32 symbol_roles = 3; - // (optional) CommonMark-formatted documentation for this specific range. If - // empty, the `Symbol.documentation` field is used instead. One example - // where this field might be useful is when the symbol represents a generic - // function (with abstract type parameters such as `List`) and at this - // occurrence we know the exact values (such as `List`). - // - // This field can also be used for dynamically or gradually typed languages, - // which commonly allow for type-changing assignment. - repeated string override_documentation = 4; - // (optional) What syntax highlighting class should be used for this range? - SyntaxKind syntax_kind = 5; - // (optional) Diagnostics that have been reported for this specific range. - repeated Diagnostic diagnostics = 6; - // (optional) Using the same encoding as the sibling `range` field, half-open - // source range of the nearest non-trivial enclosing AST node. This range must - // enclose the `range` field. Example applications that make use of the - // enclosing_range field: - // - // - Call hierarchies: to determine what symbols are references from the body - // of a function - // - Symbol outline: to display breadcrumbs from the cursor position to the - // root of the file - // - Expand selection: to select the nearest enclosing AST node. - // - Highlight range: to indicate the AST expression that is associated with a - // hover popover - // - // For definition occurrences, the enclosing range should indicate the - // start/end bounds of the entire definition AST node, including - // documentation. - // ``` - // const n = 3 - // ^ range - // ^^^^^^^^^^^ enclosing_range - // - // /** Parses the string into something */ - // ^ enclosing_range start --------------------------------------| - // function parse(input string): string { | - // ^^^^^ range | - // return input.slice(n) | - // } | - // ^ enclosing_range end <---------------------------------------| - // ``` - // - // Any attributes/decorators/attached macros should also be part of the - // enclosing range. - // - // ```python - // @cache - // ^ enclosing_range start---------------------| - // def factorial(n): | - // return n * factorial(n-1) if n else 1 | - // < enclosing_range end-----------------------| - // - // ``` - // - // For reference occurrences, the enclosing range should indicate the start/end - // bounds of the parent expression. - // ``` - // const a = a.b - // ^ range - // ^^^ enclosing_range - // const b = a.b(41).f(42).g(43) - // ^ range - // ^^^^^^^^^^^^^ enclosing_range - // ``` - repeated int32 enclosing_range = 7; -} - -// Represents a diagnostic, such as a compiler error or warning, which should be -// reported for a document. -message Diagnostic { - // Should this diagnostic be reported as an error, warning, info, or hint? - Severity severity = 1; - // (optional) Code of this diagnostic, which might appear in the user interface. - string code = 2; - // Message of this diagnostic. - string message = 3; - // (optional) Human-readable string describing the source of this diagnostic, e.g. - // 'typescript' or 'super lint'. - string source = 4; - repeated DiagnosticTag tags = 5; -} - -enum Severity { - UnspecifiedSeverity = 0; - Error = 1; - Warning = 2; - Information = 3; - Hint = 4; -} - -enum DiagnosticTag { - UnspecifiedDiagnosticTag = 0; - Unnecessary = 1; - Deprecated = 2; -} - -// Language standardises names of common programming languages that can be used -// for the `Document.language` field. The primary purpose of this enum is to -// prevent a situation where we have a single programming language ends up with -// multiple string representations. For example, the C++ language uses the name -// "CPP" in this enum and other names such as "cpp" are incompatible. -// Feel free to send a pull-request to add missing programming languages. -enum Language { - UnspecifiedLanguage = 0; - ABAP = 60; - Apex = 96; - APL = 49; - Ada = 39; - Agda = 45; - AsciiDoc = 86; - Assembly = 58; - Awk = 66; - Bat = 68; - BibTeX = 81; - C = 34; - COBOL = 59; - CPP = 35; // C++ (the name "CPP" was chosen for consistency with LSP) - CSS = 26; - CSharp = 1; - Clojure = 8; - Coffeescript = 21; - CommonLisp = 9; - Coq = 47; - CUDA = 97; - Dart = 3; - Delphi = 57; - Diff = 88; - Dockerfile = 80; - Dyalog = 50; - Elixir = 17; - Erlang = 18; - FSharp = 42; - Fish = 65; - Flow = 24; - Fortran = 56; - Git_Commit = 91; - Git_Config = 89; - Git_Rebase = 92; - Go = 33; - GraphQL = 98; - Groovy = 7; - HTML = 30; - Hack = 20; - Handlebars = 90; - Haskell = 44; - Idris = 46; - Ini = 72; - J = 51; - JSON = 75; - Java = 6; - JavaScript = 22; - JavaScriptReact = 93; - Jsonnet = 76; - Julia = 55; - Justfile = 109; - Kotlin = 4; - LaTeX = 83; - Lean = 48; - Less = 27; - Lua = 12; - Luau = 108; - Makefile = 79; - Markdown = 84; - Matlab = 52; - Nickel = 110; // https://nickel-lang.org/ - Nix = 77; - OCaml = 41; - Objective_C = 36; - Objective_CPP = 37; - Pascal = 99; - PHP = 19; - PLSQL = 70; - Perl = 13; - PowerShell = 67; - Prolog = 71; - Protobuf = 100; - Python = 15; - R = 54; - Racket = 11; - Raku = 14; - Razor = 62; - Repro = 102; // Internal language for testing SCIP - ReST = 85; - Ruby = 16; - Rust = 40; - SAS = 61; - SCSS = 29; - SML = 43; - SQL = 69; - Sass = 28; - Scala = 5; - Scheme = 10; - ShellScript = 64; // Bash - Skylark = 78; - Slang = 107; - Solidity = 95; - Svelte = 106; - Swift = 2; - Tcl = 101; - TOML = 73; - TeX = 82; - Thrift = 103; - TypeScript = 23; - TypeScriptReact = 94; - Verilog = 104; - VHDL = 105; - VisualBasic = 63; - Vue = 25; - Wolfram = 53; - XML = 31; - XSL = 32; - YAML = 74; - Zig = 38; - // NextLanguage = 111; - // Steps add a new language: - // 1. Copy-paste the "NextLanguage = N" line above - // 2. Increment "NextLanguage = N" to "NextLanguage = N+1" - // 3. Replace "NextLanguage = N" with the name of the new language. - // 4. Move the new language to the correct line above using alphabetical order - // 5. (optional) Add a brief comment behind the language if the name is not self-explanatory -} diff --git a/scip-semanticdb/BUILD b/scip-semanticdb/BUILD index 6c2b8b5a0..ad99cb261 100644 --- a/scip-semanticdb/BUILD +++ b/scip-semanticdb/BUILD @@ -18,12 +18,12 @@ java_library( srcs = glob(["src/main/java/**/*.java"]), deps = [ ":all_java_proto", - "//scip-java-proto/src/main/protobuf:scip_java_proto", "//semanticdb-java", "//semanticdb-java/src/main/protobuf:semanticdb_java_proto", "@maven//:com_google_code_findbugs_jsr305", "@maven//:com_google_protobuf_protobuf_java", "@maven//:com_google_protobuf_protobuf_java_util", + "@maven//:org_scip_code_scip_java_bindings", ], ) From f59a908faaa6d1bbb74eff1a03df30ecaab12895 Mon Sep 17 00:00:00 2001 From: jupblb Date: Tue, 2 Jun 2026 09:59:41 +0200 Subject: [PATCH 3/6] gitignore: add bazel-bindings symlink --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 19eaa7a6e..74e1d9d0e 100644 --- a/.gitignore +++ b/.gitignore @@ -61,6 +61,7 @@ index.scip ./generated /sources bazel-bin +bazel-bindings bazel-scip-java bazel-out bazel-testlogs From 2e9f3f1d6f554a24b7150f7ae39711a1ecbd0c4e Mon Sep 17 00:00:00 2001 From: jupblb Date: Tue, 2 Jun 2026 10:34:50 +0200 Subject: [PATCH 4/6] bazel: override protobuf-java 3.20 with maven 4.34.2 --- WORKSPACE | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index d3af54387..48f97af0f 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -26,10 +26,6 @@ http_archive( "https://github.com/bazelbuild/rules_proto/archive/refs/tags/4.0.0-3.20.0.tar.gz", ], ) -load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains") -rules_proto_dependencies() -rules_proto_toolchains() - ############## # JVM External ############## @@ -57,4 +53,18 @@ maven_install( repositories = [ "https://repo1.maven.org/maven2", ], + # Also create java_import_external-compatible repos such as + # @com_google_protobuf_protobuf_java//jar. compat_repositories() below + # MUST run before rules_proto_dependencies() so it pre-empts the + # 3.20.0 protobuf-java jar rules_proto would otherwise install at the + # same label, causing a class-load IllegalAccessError on the + # protobuf-4 scip-java-bindings runtime. + generate_compat_repositories = True, ) + +load("@maven//:compat.bzl", "compat_repositories") +compat_repositories() + +load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains") +rules_proto_dependencies() +rules_proto_toolchains() From 383b13548b005872753afa6fc823a7d1961b1f99 Mon Sep 17 00:00:00 2001 From: jupblb Date: Tue, 2 Jun 2026 10:35:49 +0200 Subject: [PATCH 5/6] bazel: trim protobuf override comment --- WORKSPACE | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 48f97af0f..f4c12100d 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -53,12 +53,8 @@ maven_install( repositories = [ "https://repo1.maven.org/maven2", ], - # Also create java_import_external-compatible repos such as - # @com_google_protobuf_protobuf_java//jar. compat_repositories() below - # MUST run before rules_proto_dependencies() so it pre-empts the - # 3.20.0 protobuf-java jar rules_proto would otherwise install at the - # same label, causing a class-load IllegalAccessError on the - # protobuf-4 scip-java-bindings runtime. + # Pre-empts rules_proto's bundled protobuf-java 3.20 so the + # scip-java-bindings 4.x gencode sees a compatible runtime. generate_compat_repositories = True, ) From 4b00148d6e20c20f1753cae30dd070d7075bb7e0 Mon Sep 17 00:00:00 2001 From: jupblb Date: Tue, 2 Jun 2026 10:43:25 +0200 Subject: [PATCH 6/6] bazel-example: mirror parent WORKSPACE protobuf fix --- examples/bazel-example/WORKSPACE | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/examples/bazel-example/WORKSPACE b/examples/bazel-example/WORKSPACE index c907b6de8..f9e8f0f4f 100644 --- a/examples/bazel-example/WORKSPACE +++ b/examples/bazel-example/WORKSPACE @@ -46,12 +46,6 @@ http_archive( ], ) -load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains") - -rules_proto_dependencies() - -rules_proto_toolchains() - ############## # JVM External ############## @@ -79,8 +73,9 @@ load("@rules_jvm_external//:defs.bzl", "maven_install") maven_install( artifacts = [ - "com.google.protobuf:protobuf-java:3.15.6", # Required dependency by scip-java. - "com.google.protobuf:protobuf-java-util:3.15.6", # Required dependency by scip-java. + "com.google.protobuf:protobuf-java:4.34.2", # Required dependency by scip-java. + "com.google.protobuf:protobuf-java-util:4.34.2", # Required dependency by scip-java. + "org.scip-code:scip-java-bindings:0.8.0", # Required dependency by scip-java. # These dependencies are only required for the tests "com.google.guava:guava:31.0-jre", "com.google.auto.value:auto-value:1.5.3", @@ -88,4 +83,17 @@ maven_install( repositories = [ "https://repo1.maven.org/maven2", ], + # Pre-empts rules_proto's bundled protobuf-java 3.20 so the + # scip-java-bindings 4.x gencode sees a compatible runtime. + generate_compat_repositories = True, ) + +load("@maven//:compat.bzl", "compat_repositories") + +compat_repositories() + +load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains") + +rules_proto_dependencies() + +rules_proto_toolchains()