diff --git a/.github/workflows/sourcegraph.yml b/.github/workflows/sourcegraph.yml index 6c6c626..d635b2e 100644 --- a/.github/workflows/sourcegraph.yml +++ b/.github/workflows/sourcegraph.yml @@ -10,11 +10,12 @@ jobs: name: "Upload LSIF" steps: - uses: actions/checkout@v2 - - uses: coursier/setup-action@v1.1.2 + - uses: actions/setup-java@v3 with: - jvm: adopt:8 + distribution: "temurin" + java-version: 8 - run: | - cs launch com.sourcegraph:scip-java_2.13:latest.stable -M com.sourcegraph.scip_java.ScipJava -- index + ./src/main/resources/sbt-sourcegraph/coursier launch com.sourcegraph:scip-java_2.13:latest.stable -M com.sourcegraph.scip_java.ScipJava -- index - run: yarn global add @sourcegraph/src - run: | src code-intel upload "-commit=${GITHUB_SHA}" "-github-token=${GITHUB_TOKEN}" diff --git a/.gitignore b/.gitignore index 08a7d9b..00462b7 100644 --- a/.gitignore +++ b/.gitignore @@ -52,3 +52,4 @@ out/ test-report.json dump.lsif index.scip +.bsp/ diff --git a/.scalafmt.conf b/.scalafmt.conf index 7bc7c40..1df2e4b 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,6 +1,6 @@ -version = "2.7.5" +runner.dialect=scala213 +version = "3.7.3" assumeStandardLibraryStripMargin = true -docstrings = JavaDoc project.git=true project.excludeFilters = [ ".*scala-3*" diff --git a/build.sbt b/build.sbt index eb4eccd..52e1e9b 100644 --- a/build.sbt +++ b/build.sbt @@ -2,17 +2,12 @@ import scala.jdk.CollectionConverters._ import java.util.Properties import com.sourcegraph.sbtsourcegraph.Versions -val V = new { - def scala212 = "2.12.12" - def scalameta = "4.4.25" -} - -scalaVersion := V.scala212 +scalaVersion := Versions.scala212 ThisBuild / scalafixDependencies += "com.github.liancheng" %% "organize-imports" % "0.5.0-alpha.1" ThisBuild / versionScheme := Some("early-semver") organization := "com.sourcegraph" semanticdbEnabled := !scalaVersion.value.startsWith("2.10") -semanticdbVersion := "4.4.26" +semanticdbVersion := Versions.scalametaVersion homepage := Some(url("https://github.com/sourcegraph/sbt-sourcegraph")) licenses := List( "Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0") @@ -39,8 +34,6 @@ commands += } // Cross-building settings (see https://github.com/sbt/sbt/issues/3473#issuecomment-325729747) -def scala212 = "2.12.13" -def scala210 = "2.10.7" sbtPlugin := true moduleName := "sbt-sourcegraph" @@ -51,14 +44,16 @@ Compile / resourceGenerators += Def.task { if (!out.exists()) { val versions = Versions.semanticdbVersionsByScalaVersion() val props = new Properties() - props.putAll(versions.asJava) + versions.foreach { case (scalaVersion, semanticdbVersion) => + props.put(scalaVersion, semanticdbVersion) + } IO.write(props, "SemanticDB versions grouped by Scala version.", out) } List(out) } -crossScalaVersions := Seq(scala212, scala210) +crossScalaVersions := Seq(Versions.scala212, Versions.scala210) scalacOptions ++= { - if (scalaVersion.value == scala210) List() + if (scalaVersion.value == Versions.scala210) List() else List("-Xlint:unused") } diff --git a/project/build.properties b/project/build.properties index 19479ba..46e43a9 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.5.2 +sbt.version=1.8.2 diff --git a/project/plugins.sbt b/project/plugins.sbt index bd93ff9..927bc8d 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,8 +1,7 @@ -addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.5") -addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0") +addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.11") +addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.3") -addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.29") -addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.4.9-22-2d02726c") +addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.4") libraryDependencies += "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value diff --git a/src/main/scala/com/sourcegraph/sbtsourcegraph/SourcegraphEnable.scala b/src/main/scala/com/sourcegraph/sbtsourcegraph/SourcegraphEnable.scala index 971da36..6c18e70 100644 --- a/src/main/scala/com/sourcegraph/sbtsourcegraph/SourcegraphEnable.scala +++ b/src/main/scala/com/sourcegraph/sbtsourcegraph/SourcegraphEnable.scala @@ -1,10 +1,10 @@ -/** - * Adaptation of the `scalafixEnable` command from sbt-scalafix with the following modifications: - * - use older SemanticDB versions instead of upgrading the Scala version. - * - configure the semanticdb-javac compiler plugin for Java projects. - * Original license: Apache 2 - * Original source: https://github.com/scalacenter/sbt-scalafix/blob/cdee753f15bde75d84d93c26695d14fc3ec964f8/src/main/scala/scalafix/sbt/ScalafixEnable.scala - */ +/** Adaptation of the `scalafixEnable` command from sbt-scalafix with the + * following modifications: + * - use older SemanticDB versions instead of upgrading the Scala version. + * - configure the semanticdb-javac compiler plugin for Java projects. + * Original license: Apache 2 Original source: + * https://github.com/scalacenter/sbt-scalafix/blob/cdee753f15bde75d84d93c26695d14fc3ec964f8/src/main/scala/scalafix/sbt/ScalafixEnable.scala + */ package com.sourcegraph.sbtsourcegraph import sbt._ diff --git a/src/main/scala/com/sourcegraph/sbtsourcegraph/Versions.scala b/src/main/scala/com/sourcegraph/sbtsourcegraph/Versions.scala index b983bfe..17b44d7 100644 --- a/src/main/scala/com/sourcegraph/sbtsourcegraph/Versions.scala +++ b/src/main/scala/com/sourcegraph/sbtsourcegraph/Versions.scala @@ -7,7 +7,11 @@ import scala.collection.JavaConverters._ import scala.sys.process._ object Versions { - def scalametaVersion = "4.4.26" + def scalametaVersion = "4.7.7" + def scala210 = "2.10.7" + def scala211 = "2.11.12" + def scala212 = "2.12.17" + def scala213 = "2.13.10" private def semanticdbJavacKey = "semanticdb-javac" def semanticdbJavacVersion(): String = @@ -26,9 +30,9 @@ object Versions { } else { Map( semanticdbJavacKey -> "0.8.0", - "2.12.12" -> scalametaVersion, - "2.13.6" -> scalametaVersion, - "2.11.12" -> scalametaVersion + scala211 -> scalametaVersion, + scala212 -> scalametaVersion, + scala213 -> scalametaVersion ).withDefaultValue(scalametaVersion) } }