Skip to content

Commit

Permalink
More permissive version matching (e.g. 11.0.20.1) (#86)
Browse files Browse the repository at this point in the history
* More permissive version matching (e.g. 11.0.20.1)
* Bootstrapped SCIP upload
  • Loading branch information
keynmol authored Sep 8, 2023
1 parent 5720d81 commit e4e1f0d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/sourcegraph.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,20 @@ on:
jobs:
lsif:
runs-on: ubuntu-latest
name: "Upload LSIF"
name: "Upload SCIP"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v3
with:
distribution: "temurin"
cache: "sbt"
java-version: 17
- run: |
curl -fL "https://github.com/coursier/launchers/raw/master/cs-x86_64-pc-linux.gz" | gzip -d > cs && chmod +x cs
./cs launch com.sourcegraph:scip-java_2.13:latest.stable -M com.sourcegraph.scip_java.ScipJava -- index
- run: sbt dumpVersion publishLocal
- run: echo "addSbtPlugin(\"com.sourcegraph\" % \"sbt-sourcegraph\" % \"$(cat VERSION)\")" > project/sourcegraph_generated.sbt
- run: sbt sourcegraphEnable sourcegraphScip
- run: yarn global add @sourcegraph/src
- run: |
mv target/sbt-sourcegraph/index.scip index.scip
src code-intel upload "-commit=${GITHUB_SHA}" "-github-token=${GITHUB_TOKEN}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12 changes: 12 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,15 @@ scriptedLaunchOpts ++= Seq(
s"-Dscip-java.version=${Versions.semanticdbJavacVersion()}",
s"-Dplugin.version=${version.value}"
)

lazy val dumpVersion = taskKey[Unit](
"Dump the version of sbt-sourcegraph to a VERSION file"
)
dumpVersion := {
val versionValue = version.value

val path = (ThisBuild / baseDirectory).value / "VERSION"
IO.write(path, versionValue)

sLog.value.info(s"Dumping version [$versionValue] to path [$path]")
}
6 changes: 3 additions & 3 deletions src/main/scala/com/sourcegraph/sbtsourcegraph/Versions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,13 @@ object Versions {
segments match {
// Java 1.6 - 1.8
case "1" :: lessThan8 :: _ :: Nil => lessThan8.toInt
// Java 17.0.1, ..
case modern :: _ :: _ :: Nil => modern.toInt
// Java 17.0.1, 11.0.20.1, ..
case modern :: _ :: _ :: rest => modern.toInt
// Java 12
case modern :: Nil => modern.toInt
case other =>
sys.error(
s"Cannot process java.home property, unknown format: [$raw]"
s"Cannot process [java.version] property, unknown format: [$raw]"
)
}
}
Expand Down

0 comments on commit e4e1f0d

Please sign in to comment.