Skip to content

Commit b67e5ea

Browse files
Fixes required for --auto-classpath:
- Configure the symbol table with the validated classpath - For --auto-classpath-roots, use both folders and '*.jar' files
1 parent afb20dd commit b67e5ea

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

scalafix-cli/src/main/scala/scalafix/internal/v1/Args.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ case class Args(
187187
def configuredSymtab: Configured[SymbolTable] = {
188188
Try(
189189
ClasspathOps.newSymbolTable(
190-
classpath = classpath,
190+
classpath = validatedClasspath,
191191
out = out
192192
)
193193
) match {

scalafix-reflect/src/main/scala/scalafix/internal/reflect/ClasspathOps.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ object ClasspathOps {
5555
path.resolve(META_INF).resolve(SEMANTICDB).toFile.isDirectory
5656
}
5757

58+
private def isJar(path: AbsolutePath): Boolean =
59+
path.isFile &&
60+
path.toFile.getName.endsWith(".jar")
61+
5862
def autoClasspath(roots: List[AbsolutePath]): Classpath = {
5963
val buffer = List.newBuilder[AbsolutePath]
6064
val visitor = new SimpleFileVisitor[Path] {
@@ -71,6 +75,7 @@ object ClasspathOps {
7175
}
7276
}
7377
roots.foreach(x => Files.walkFileTree(x.toNIO, visitor))
78+
roots.filter(isJar).foreach(buffer += _)
7479
Classpath(buffer.result())
7580
}
7681

0 commit comments

Comments
 (0)