Skip to content

Commit

Permalink
Fixes required for --auto-classpath:
Browse files Browse the repository at this point in the history
- Configure the symbol table with the validated classpath
- For --auto-classpath-roots, use both folders and '*.jar' files
  • Loading branch information
NicolasRouquette committed Dec 15, 2018
1 parent afb20dd commit b67e5ea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Expand Up @@ -187,7 +187,7 @@ case class Args(
def configuredSymtab: Configured[SymbolTable] = {
Try(
ClasspathOps.newSymbolTable(
classpath = classpath,
classpath = validatedClasspath,
out = out
)
) match {
Expand Down
Expand Up @@ -55,6 +55,10 @@ object ClasspathOps {
path.resolve(META_INF).resolve(SEMANTICDB).toFile.isDirectory
}

private def isJar(path: AbsolutePath): Boolean =
path.isFile &&
path.toFile.getName.endsWith(".jar")

def autoClasspath(roots: List[AbsolutePath]): Classpath = {
val buffer = List.newBuilder[AbsolutePath]
val visitor = new SimpleFileVisitor[Path] {
Expand All @@ -71,6 +75,7 @@ object ClasspathOps {
}
}
roots.foreach(x => Files.walkFileTree(x.toNIO, visitor))
roots.filter(isJar).foreach(buffer += _)
Classpath(buffer.result())
}

Expand Down

0 comments on commit b67e5ea

Please sign in to comment.