Skip to content

Commit e4e1f0d

Browse files
authored
More permissive version matching (e.g. 11.0.20.1) (#86)
* More permissive version matching (e.g. 11.0.20.1) * Bootstrapped SCIP upload
1 parent 5720d81 commit e4e1f0d

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

.github/workflows/sourcegraph.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,20 @@ on:
77
jobs:
88
lsif:
99
runs-on: ubuntu-latest
10-
name: "Upload LSIF"
10+
name: "Upload SCIP"
1111
steps:
1212
- uses: actions/checkout@v2
1313
- uses: actions/setup-java@v3
1414
with:
1515
distribution: "temurin"
1616
cache: "sbt"
1717
java-version: 17
18-
- run: |
19-
curl -fL "https://github.com/coursier/launchers/raw/master/cs-x86_64-pc-linux.gz" | gzip -d > cs && chmod +x cs
20-
./cs launch com.sourcegraph:scip-java_2.13:latest.stable -M com.sourcegraph.scip_java.ScipJava -- index
18+
- run: sbt dumpVersion publishLocal
19+
- run: echo "addSbtPlugin(\"com.sourcegraph\" % \"sbt-sourcegraph\" % \"$(cat VERSION)\")" > project/sourcegraph_generated.sbt
20+
- run: sbt sourcegraphEnable sourcegraphScip
2121
- run: yarn global add @sourcegraph/src
2222
- run: |
23+
mv target/sbt-sourcegraph/index.scip index.scip
2324
src code-intel upload "-commit=${GITHUB_SHA}" "-github-token=${GITHUB_TOKEN}"
2425
env:
2526
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build.sbt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,15 @@ scriptedLaunchOpts ++= Seq(
8484
s"-Dscip-java.version=${Versions.semanticdbJavacVersion()}",
8585
s"-Dplugin.version=${version.value}"
8686
)
87+
88+
lazy val dumpVersion = taskKey[Unit](
89+
"Dump the version of sbt-sourcegraph to a VERSION file"
90+
)
91+
dumpVersion := {
92+
val versionValue = version.value
93+
94+
val path = (ThisBuild / baseDirectory).value / "VERSION"
95+
IO.write(path, versionValue)
96+
97+
sLog.value.info(s"Dumping version [$versionValue] to path [$path]")
98+
}

src/main/scala/com/sourcegraph/sbtsourcegraph/Versions.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,13 @@ object Versions {
142142
segments match {
143143
// Java 1.6 - 1.8
144144
case "1" :: lessThan8 :: _ :: Nil => lessThan8.toInt
145-
// Java 17.0.1, ..
146-
case modern :: _ :: _ :: Nil => modern.toInt
145+
// Java 17.0.1, 11.0.20.1, ..
146+
case modern :: _ :: _ :: rest => modern.toInt
147147
// Java 12
148148
case modern :: Nil => modern.toInt
149149
case other =>
150150
sys.error(
151-
s"Cannot process java.home property, unknown format: [$raw]"
151+
s"Cannot process [java.version] property, unknown format: [$raw]"
152152
)
153153
}
154154
}

0 commit comments

Comments
 (0)