Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ jobs:
- uses: actions/checkout@v2
- run: yarn global add @bazel/bazelisk
- run: bazel build //... --//semanticdb-javac:enabled=true
- run: bazel run lsif-semanticdb:bazel -- --sourceroot "$PWD"
- run: du -h dump.lsif-typed
- run: bazel build //... --@lsif_java//semanticdb-javac:enabled=true
- run: bazel run scip-semanticdb:bazel -- --sourceroot "$PWD"
- run: du -h index.scip
- run: bazel build //... --@scip_java//semanticdb-javac:enabled=true
working-directory: examples/bazel-example
- run: bazel run @lsif_java//lsif-semanticdb:bazel -- --sourceroot "$PWD"
- run: bazel run @scip_java//scip-semanticdb:bazel -- --sourceroot "$PWD"
working-directory: examples/bazel-example
- run: du -h dump.lsif-typed
- run: du -h index.scip
working-directory: examples/bazel-example
check:
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sourcegraph.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ on:
- olafurpg/lets-go
pull_request:
jobs:
lsif:
scip:
runs-on: ubuntu-latest
name: "Upload LSIF"
name: "Upload SCIP"
steps:
- uses: actions/checkout@v2
- uses: olafurpg/setup-scala@v13
Expand Down
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@ project/metals.sbt
out/
*.hnir
test-report.json
dump.lsif
index.scip

./generated
/sources
bazel-bin
bazel-lsif-java
bazel-scip-java
bazel-out
bazel-testlogs
bazel-lsif-java
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Contributing guide

See https://sourcegraph.github.io/lsif-java/docs/contributing.html
See https://sourcegraph.github.io/scip-java/docs/contributing.html
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Java indexer for the Language Server Index Format (LSIF) ![](https://img.shields.io/badge/status-development-yellow?style=flat)
# Java, Scala, and Kotlin indexer for SCIP ![](https://img.shields.io/badge/status-development-green?style=flat)

| Documentation | Link |
| -------------------- | ---------------------------------------------------------------------- |
| Landing page | https://sourcegraph.github.io/lsif-java |
| Getting started | https://sourcegraph.github.io/lsif-java/docs/getting-started.html |
| Manual configuration | https://sourcegraph.github.io/lsif-java/docs/manual-configuration.html |
| Contributing | https://sourcegraph.github.io/lsif-java/docs/contributing.html |
| Design | https://sourcegraph.github.io/lsif-java/docs/design.html |
| Landing page | https://sourcegraph.github.io/scip-java |
| Getting started | https://sourcegraph.github.io/scip-java/docs/getting-started.html |
| Manual configuration | https://sourcegraph.github.io/scip-java/docs/manual-configuration.html |
| Contributing | https://sourcegraph.github.io/scip-java/docs/contributing.html |
| Design | https://sourcegraph.github.io/scip-java/docs/design.html |

2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
workspace(name = "lsif_java_tests")
workspace(name = "scip_java_tests")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

##############
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# Wrapper script for `lsif-java`, which automatically picks up the correct JVM
# Wrapper script for `scip-java`, which automatically picks up the correct JVM
# version. It assumes that `coursier` is available on the `$PATH` and that the
# `lsif-java` binary is already installed at `/app/lsif-java/bin/lsif-java`.
# `scip-java` binary is already installed at `/app/scip-java/bin/scip-java`.
set -eu
JVM_VERSION="8"
FILE="$PWD/lsif-java.json"
Expand All @@ -22,4 +22,4 @@ if [ "$JVM_VERSION" = "17" ]; then
export JAVA_OPTS="--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"
fi

/app/lsif-java/bin/lsif-java "$@"
/app/scip-java/bin/scip-java "$@"
42 changes: 21 additions & 21 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ inThisBuild(
semanticdbEnabled := true,
semanticdbVersion := V.scalameta,
organization := "com.sourcegraph",
homepage := Some(url("https://github.com/sourcegraph/lsif-java")),
homepage := Some(url("https://github.com/sourcegraph/scip-java")),
dynverSeparator := "-",
licenses :=
List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
Expand Down Expand Up @@ -124,10 +124,10 @@ lazy val plugin = project
)
.dependsOn(semanticdb)

lazy val lsif = project
.in(file("lsif-semanticdb"))
lazy val scip = project
.in(file("scip-semanticdb"))
.settings(
moduleName := "lsif-semanticdb",
moduleName := "scip-semanticdb",
javaToolchainVersion := "8",
javaOnlySettings,
libraryDependencies +=
Expand All @@ -139,10 +139,10 @@ lazy val lsif = project
.dependsOn(semanticdb)

lazy val cli = project
.in(file("lsif-java"))
.in(file("scip-java"))
.settings(
moduleName := "lsif-java",
(Compile / mainClass) := Some("com.sourcegraph.lsif_java.LsifJava"),
moduleName := "scip-java",
(Compile / mainClass) := Some("com.sourcegraph.scip_java.ScipJava"),
(run / baseDirectory) := (ThisBuild / baseDirectory).value,
buildInfoKeys :=
Seq[BuildInfoKey](
Expand All @@ -168,7 +168,7 @@ lazy val cli = project
"bloopVersion" -> V.bloop,
"bspVersion" -> V.bsp
),
buildInfoPackage := "com.sourcegraph.lsif_java",
buildInfoPackage := "com.sourcegraph.scip_java",
libraryDependencies ++=
List(
"io.get-coursier" %% "coursier" % V.coursier,
Expand Down Expand Up @@ -200,26 +200,26 @@ lazy val cli = project

IO.copy(outs)
val props = new Properties()
val propsFile = out.resolve("lsif-java.properties").toFile
val propsFile = out.resolve("scip-java.properties").toFile
val copiedJars = outs.collect { case (_, out) =>
out
}
val names = copiedJars.map(_.getName).mkString(";")
props.put("jarNames", names)
IO.write(props, "lsif-java", propsFile)
IO.write(props, "scip-java", propsFile)

propsFile :: copiedJars.toList
}
.taskValue,
docker / imageNames :=
List(
ImageName("sourcegraph/lsif-java:latest"),
ImageName(s"sourcegraph/lsif-java:${version.value}")
ImageName("sourcegraph/scip-java:latest"),
ImageName(s"sourcegraph/scip-java:${version.value}")
),
docker / dockerfile := {
val binaryDistribution = pack.value
val script = (ThisBuild / baseDirectory).value / "bin" /
"lsif-java-docker-script.sh"
"scip-java-docker-script.sh"
new Dockerfile {
from("gradle:7.2.0-jdk8")

Expand Down Expand Up @@ -248,14 +248,14 @@ lazy val cli = project
"https://github.com/coursier/jvm-index/blob/master/index.json"
)

// Install `lsif-java` binary.
add(script, "/usr/local/bin/lsif-java")
add(binaryDistribution, "/app/lsif-java")
// Install `scip-java` binary.
add(script, "/usr/local/bin/scip-java")
add(binaryDistribution, "/app/scip-java")
}
}
)
.enablePlugins(PackPlugin, DockerPlugin, BuildInfoPlugin)
.dependsOn(lsif)
.dependsOn(scip)

def commitAll(): Unit = {
import scala.sys.process._
Expand All @@ -273,7 +273,7 @@ commands +=
Command.command("nativeImageProfiled") { s =>
val targetroot =
file("tests/minimized/.j11/target/scala-2.13/meta").absolutePath
val output = Files.createTempFile("lsif-java", "dump.lsif")
val output = Files.createTempFile("scip-java", "index.scip")
"minimized/compile" ::
s"""nativeImageRunAgent " index-semanticdb --output=$output $targetroot"""" ::
"nativeImage" :: s
Expand Down Expand Up @@ -403,17 +403,17 @@ lazy val snapshots = project
lazy val bench = project
.in(file("tests/benchmarks"))
.settings(
moduleName := "lsif-java-bench",
moduleName := "scip-java-bench",
(run / fork) := true,
(publish / skip) := true
)
.dependsOn(unit)
.enablePlugins(JmhPlugin)

lazy val docs = project
.in(file("lsif-java-docs"))
.in(file("scip-java-docs"))
.settings(
moduleName := "lsif-java-docs",
moduleName := "scip-java-docs",
mdocOut :=
(ThisBuild / baseDirectory).value / "website" / "target" / "docs",
fork := false,
Expand Down
2 changes: 1 addition & 1 deletion docs/benchmarks.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ sbt:root> bench/jmh:run -i 10 -wi 10 -f1 -t1
compilation by 45-50%.
- Recommendation: do not enable the SemanticDB compiler plugin during local
edit-and-test workflows. The compiler plugin is primarily intended to be
enabled in custom CI jobs to upload LSIF indexes.
enabled in custom CI jobs to upload SCIP indexes.
12 changes: 6 additions & 6 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: Contributing guide
---

This page documents tips and tricks for contributing to the
[sourcegraph/lsif-java](https://github.com/sourcegraph/lsif-java) codebase.
[sourcegraph/scip-java](https://github.com/sourcegraph/scip-java) codebase.

## System dependencies

Expand All @@ -29,7 +29,7 @@ These are the main components of the project.
- `tests/snapshots`: slow running
["snapshot tests"](https://jestjs.io/docs/en/snapshot-testing) that index a
corpus of published Java libraries.
- `cli/src/main/scala`: implementation of the `lsif-java` command-line
- `cli/src/main/scala`: implementation of the `scip-java` command-line
interface.
- `build.sbt`: the sbt build definition.
- `project/plugins.sbt`: plugins for the sbt build.
Expand All @@ -47,8 +47,8 @@ These are the main components of the project.
| `snapshots/testOnly tests.LibrarySnapshotSuite` | sbt | Runs slow snapshot tests. Indexes a corpus of external Java libraries. |
| `snapshots/test` | sbt | Runs all snapshot tests. |
| `snapshots/run` | sbt | Update snapshot tests. Use this command after you have fixed a bug. |
| `cli/run --cwd DIRECTORY` | sbt | Run `lsif-java` command-line tool against a given Gradle/Maven build. |
| `cd website && yarn install && yarn start` | terminal | Start live-reload preview of the website at http://localhost:3000/lsif-java. |
| `cli/run --cwd DIRECTORY` | sbt | Run `scip-java` command-line tool against a given Gradle/Maven build. |
| `cd website && yarn install && yarn start` | terminal | Start live-reload preview of the website at http://localhost:3000/scip-java. |
| `docs/mdoc --watch` | sbt | Re-generate markdown files in the `docs/` directory. |
| `fixAll` | sbt | Run Scalafmt, Scalafix and Javafmt on all sources. Run this before opening a PR. |

Expand Down Expand Up @@ -81,7 +81,7 @@ It's best to run tests from the sbt shell, not from the IntelliJ UI.
If you want to use completions and precise code navigation, it's not recommended
to use other editors than IntelliJ. IntelliJ is the only IDE that properly
supports hybrid Java/Scala codebases at the moment, although that may change
soon thanks to lsif-java :)
soon thanks to scip-java :)

## Tests are written in Scala

Expand All @@ -95,4 +95,4 @@ write tests because:
- Multiline literal strings in Scala make it easy to write unit tests for source
code (which is always multiline). Modern versions of Java support multiline
string literals, but they're not supported in Java 8, which is supported by
lsif-java.
scip-java.
16 changes: 8 additions & 8 deletions docs/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ This project is implemented as a
that generates one
[SemanticDB](https://scalameta.org/docs/semanticdb/specification.html) file for
every `*.java` source file. After compilation completes, the SemanticDB files
are processed to produce LSIF.
are processed to produce SCIP.

![A three stage pipeline that starts with a list of Java sources, creates a list of SemanticDB files that then become a single LSIF index.](assets/semanticdb-javac-pipeline.svg)
![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)

### Why Java compiler plugin?

There are several benefits to implementing lsif-java as a compiler plugin:
There are several benefits to implementing scip-java as a compiler plugin:

- **Simple installation**: compiler plugins are enabled with the `-Xplugin`
compiler option. All Java build tools support a way to customize compiler
options, simplifying installation.
- **Language fidelity**: by using the Java compiler to produce semantic
information, we ensure that the produced LSIF data is accurate even as new
information, we ensure that the produced SCIP data is accurate even as new
Java language versions with new language features are released.
- **Environment fidelity**: by hooking into the compilation process of the build
tool, we minimize the risk of diverging from the CI build environment such as
Expand All @@ -31,16 +31,16 @@ There are several benefits to implementing lsif-java as a compiler plugin:

SemanticDB is Protobuf schema for information about symbols and types in Java
programs, Scala programs and other languages. There are several benefits to
using SemanticDB as an intermediary representation for LSIF:
using SemanticDB as an intermediary representation for SCIP:

- **Simplicity**: It's easy to translate a single Java source file into a single
SemanticDB file inside a compiler plugin. It's more complicated to produce
LSIF because compiler plugins does not have access to a project-wide context,
SCIP because compiler plugins does not have access to a project-wide context,
which is necessary to produce accurate definitions and hovers in multi-module
projects with external library dependencies.
- **Performance**: SemanticDB is fast to write and read. Each compilation unit
can be processed independently to keep memory usage low. The final conversion
from SemanticDB to LSIF can be safely parallelized.
from SemanticDB to SCIP can be safely parallelized.
- **Cross-language**: SemanticDB has a
[spec](https://scalameta.org/docs/semanticdb/specification.html) for Java and
Scala enabling cross-language navigation in hybrid Java/Scala codebases.
Expand All @@ -50,5 +50,5 @@ using SemanticDB as an intermediary representation for LSIF:
the classpath alone (no source code) and from the syntax tree of an individual
source file (no classpath). This flexibility allows the
[Metals](https://scalameta.org/metals/) language server to index codebases
from a variety of different inputs, and will be helpful for lsif-java in the
from a variety of different inputs, and will be helpful for scip-java in the
future to unblock cross-repository navigation.
Loading