Skip to content

Commit c8a122a

Browse files
authored
Merge pull request #220 from olafurpg/fix-jdk
Fix minor PackageHub regressions
2 parents d796c58 + c4d8214 commit c8a122a

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

packagehub/src/main/scala/com/sourcegraph/packagehub/PackageActor.scala

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class PackageActor(
4949
src: String,
5050
coursier: String,
5151
store: PackageStore,
52-
packagehubUrl: String,
52+
lsifJavaVersion: String,
5353
val dir: Path,
5454
val addr: Int = 3434
5555
)(implicit ctx: Context, log: cask.Logger)
@@ -247,7 +247,10 @@ class PackageActor(
247247
return dump
248248
pkg match {
249249
case _: NpmPackage =>
250-
exec(sourceroot, List("yarn", "install"))
250+
val toolVersions = sourceroot.resolve(".tool-versions")
251+
if (!Files.isRegularFile(toolVersions)) {
252+
Files.write(toolVersions, List("yarn 1.22.4").asJava)
253+
}
251254
val tsconfig = sourceroot.resolve("tsconfig.json")
252255
if (!Files.isRegularFile(tsconfig)) {
253256
val config = Obj(
@@ -256,6 +259,7 @@ class PackageActor(
256259
)
257260
Files.write(tsconfig, List(ujson.write(config, indent = 2)).asJava)
258261
}
262+
exec(sourceroot, List("yarn", "install"))
259263
exec(
260264
sourceroot,
261265
List("npx", "@olafurpg/lsif-tsc", "-p", sourceroot.toString)
@@ -285,8 +289,9 @@ class PackageActor(
285289
"launch",
286290
"--jvm",
287291
jvm,
288-
"--contrib",
289-
"lsif-java",
292+
s"com.sourcegraph:lsif-java_2.13:${lsifJavaVersion}",
293+
"-r",
294+
"sonatype:snapshots",
290295
"--",
291296
"index",
292297
"--output",

packagehub/src/main/scala/com/sourcegraph/packagehub/PackageHub.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ case class PackageHub(
3939
postgres: PostgresOptions = PostgresOptions(),
4040
@Description("URL of the PackageHub server") packagehubUrl: String =
4141
"https://packagehub-ohcltxh6aq-uc.a.run.app",
42+
@Description(
43+
"The version of lsif-java to use for indexing packages"
44+
) lsifJavaVersion: String = BuildInfo.version,
4245
@Description("Path to the src-cli binary") src: String = "src",
4346
@Description("Path to the coursier binary") coursier: String = "coursier",
4447
@Description("If enabled, schedule an LSIF index after the given delay")
@@ -62,7 +65,7 @@ case class PackageHub(
6265
src,
6366
coursier,
6467
store,
65-
packagehubUrl,
68+
lsifJavaVersion,
6669
dir.getOrElse(app.env.cacheDirectory)
6770
)(ctx, log)
6871
val routes = new PackageRoutes(this, actor, store, log)(ctx)

0 commit comments

Comments
 (0)