From c6c68332e1fbeb12f38bf16c3d26942343c49da4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93lafur=20P=C3=A1ll=20Geirsson?= Date: Mon, 6 Sep 2021 12:30:54 +0200 Subject: [PATCH] Return non-zero exit code when missing SemanticDB files Previously, `lsif-java index` would occasionally return a successful exit code even if it didn't produce a `dump.lsif` file. Now, it should return the exit code 1 instead in these scenarios. --- .../lsif_java/buildtools/LsifBuildTool.scala | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/lsif-java/src/main/scala/com/sourcegraph/lsif_java/buildtools/LsifBuildTool.scala b/lsif-java/src/main/scala/com/sourcegraph/lsif_java/buildtools/LsifBuildTool.scala index 4aa82a24..05a441bb 100644 --- a/lsif-java/src/main/scala/com/sourcegraph/lsif_java/buildtools/LsifBuildTool.scala +++ b/lsif-java/src/main/scala/com/sourcegraph/lsif_java/buildtools/LsifBuildTool.scala @@ -160,18 +160,20 @@ class LsifBuildTool(index: IndexCommand) extends BuildTool("LSIF", index) { .isDirectory(targetroot.resolve("META-INF")) if (errors.nonEmpty && !isSemanticdbGenerated) { CommandResult(1, Nil) - } else if (errors.nonEmpty && isSemanticdbGenerated) { - index - .app - .reporter - .info( - "Some SemanticDB files got generated even if there were compile errors. " + - "In most cases, this means that lsif-java managed to index everything " + - "except the locations that had compile errors and you can ignore the compile errors." + - errors.mkString("\n") - ) + } else { + if (errors.nonEmpty && isSemanticdbGenerated) { + index + .app + .reporter + .info( + "Some SemanticDB files got generated even if there were compile errors. " + + "In most cases, this means that lsif-java managed to index everything " + + "except the locations that had compile errors and you can ignore the compile errors." + + errors.mkString("\n") + ) + } + CommandResult(0, Nil) } - CommandResult(0, Nil) } private def compileScalaFiles(