| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This is a zero-dependency sbt plugin to help you enable precise code intelligence for Scala projects on Sourcegraph.
Overview:
First, make sure you are using sbt v1.4 or newer. This plugin does not work with older versions of sbt.
Next, add the sbt plugin to your build in project/plugins.sbt.
// project/plugins.sbt
+ addSbtPlugin("com.sourcegraph" % "sbt-sourcegraph" % "0.4.0")Next, enable SemanticDB in build.sbt and use the latest version of SemanticDB.
// build.sbt
+ ThisBuild / semanticdbEnabled := true
+ ThisBuild / semanticdbVersion := "4.4.7"
lazy val myproject1 = project
.settings(
...
)
lazy val myproject2 = projectNext, add a GitHub Actions workflow to your repository to configure your CI to upload indexes on pull requests and merge into your main branch.
mkdir -p .github/workflows && \
curl -L https://raw.githubusercontent.com/sourcegraph/sbt-sourcegraph/master/.github/workflows/sourcegraph.yml > .github/workflows/sourcegraph.ymlOptionally, adjust sourcegraph.yml to your needs. For example, you may want to disable the upload job for pull requests and use Java 11.
// .github/workslows/sourcegraph.yml
on:
push:
branches:
- main
- pull_request:
jobs:
lsif:
steps:
- uses: olafurpg/setup-scala@v10
+ with:
+ java-version: adopt@1.11
- uses: actions/setup-go@v2
with:
go-version: "1.15.6"Commit the new file and push it to GitHub to trigger the upload job. Once the upload job completes, you should be able to observe precise code intelligence on GitHub.
If you don't want to enable SemanticDB in build.sbt, you can do it a single sbt session inside the upload CI job.
$ sbt sourcegraphEnable sourcegraphUploadIf you have projects that don't work with SemanticDB, you can optionally enable SemanticDB on a per-project basis instead of via ThisBuild.
// build.sbt
- ThisBuild / semanticdbEnabled := true
ThisBuild / semanticdbVersion := "LATEST_VERSION"
lazy val myproject1 = project
.settings(
...
+ semanticdbEnabled := true
)
lazy val myproject2 = projectThis plugin can be used with any CI system. If you don't use GitHub Actions, you can adjust the installation steps from sourcegraph.yml to work with your own CI system.
First, install the src command-line tool (https://github.com/sourcegraph/src-cli) to $PATH.
Next, create a GitHub access token following the instructions here.
Finally, run sbt sourcegraphUpload with the GitHub access token available via GITHUB_TOKEN.
export GITHUB_TOKEN="REPLACE_THIS_WITH_ACTUAL_TOKEN"
sbt sourcegraphUploadEnvironment variables:
Tasks:
Optional settings:
Use .disablePlugins(SourcegraphPlugin)) to disable this plugin for a specific project.
// build.sbt
lazy val myProject1 = project
lazy val myProject2 = project
+ .disablePlugins(SourcegraphPlugin)Precise code intelligence for Scala is still under development. Below are some known issues:
The error below happens when you use this plugin with sbt v1.3 or older versions.
java.lang.NoSuchMethodError: sbt.Def$.ifS(Lsbt/internal/util/Init$Initialize;Lsbt/internal/util/Init$Initialize;Lsbt/internal/util/Init$Initialize;)Lsbt/internal/util/Init$Initialize;
To fix this problem, upgrade to sbt v1.4.6 or newer.
# project/build.properties
- sbt.version=1.3.10
+ sbt.version=1.4.6| Back | FazBrowse Home | New Git URL |