Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class LsifBuildTool(index: IndexCommand) extends BuildTool("LSIF", index) {
val deps = Dependencies.resolveDependencies(config.dependencies.map(_.repr))
val sourceroot = index.workingDirectory
if (!Files.isDirectory(sourceroot)) {
throw new NoSuchFileException(sourceroot.toString())
throw new NoSuchFileException(sourceroot.toString)
}
val allSourceFiles = collectAllSourceFiles(sourceroot)
val javaFiles = allSourceFiles.filter(path => javaPattern.matches(path))
Expand All @@ -150,46 +150,47 @@ class LsifBuildTool(index: IndexCommand) extends BuildTool("LSIF", index) {
return CommandResult(0, Nil)
}
val errors = ListBuffer.empty[Try[Unit]]
errors += compileJavaFiles(tmp, deps, config, javaFiles)
errors += compileScalaFiles(deps, scalaFiles)
compileJavaFiles(tmp, deps, config, javaFiles)
.recover(e => errors.addOne(Failure(e)))
compileScalaFiles(deps, scalaFiles).recover(e => errors.addOne(Failure(e)))
if (index.cleanup) {
Files.walkFileTree(tmp, new DeleteVisitor)
}
val isSemanticdbGenerated = Files
.isDirectory(targetroot.resolve("META-INF"))
if (errors.nonEmpty && !isSemanticdbGenerated) {
CommandResult(1, Nil)
} else {
if (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."
)
}
CommandResult(0, 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")
)
}
CommandResult(0, Nil)
}

private def compileScalaFiles(
deps: Dependencies,
allScalaFiles: List[Path]
): Try[Unit] =
Try {
withScalaPresentationCompiler(deps) { compiler =>
allScalaFiles.foreach { path =>
try compileScalaFile(compiler, path)
catch {
case NonFatal(e) =>
// We want to try and index as much as possible so we don't fail the entire
// compilation even if a single file fails to compile.
index.app.reporter.log(Diagnostic.exception(e))
if (allScalaFiles.nonEmpty)
withScalaPresentationCompiler(deps) { compiler =>
allScalaFiles.foreach { path =>
try compileScalaFile(compiler, path)
catch {
case NonFatal(e) =>
// We want to try and index as much as possible so we don't fail the entire
// compilation even if a single file fails to compile.
index.app.reporter.log(Diagnostic.exception(e))
}
}
}
}
}

private def compileScalaFile(
Expand Down
61 changes: 0 additions & 61 deletions tests/unit/src/test/scala/tests/PackageStoreSuite.scala

This file was deleted.