Skip to content

Commit 27e9fc6

Browse files
Scip buildtool can now handle folders of source files
1 parent 8a247cc commit 27e9fc6

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

scip-java/src/main/scala/com/sourcegraph/scip_java/buildtools/ScipBuildTool.scala

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -683,15 +683,8 @@ class ScipBuildTool(index: IndexCommand) extends BuildTool("SCIP", index) {
683683
Files.walkFileTree(targetroot, new DeleteVisitor)
684684
}
685685

686-
/** Recursively collects all Java files in the working directory */
687-
private def collectAllSourceFiles(config: Config, dir: Path): List[Path] = {
688-
if (config.sourceFiles.nonEmpty) {
689-
return config
690-
.sourceFiles
691-
.map(path => AbsolutePath.of(Paths.get(path), dir))
692-
.filter(path => Files.isRegularFile(path))
693-
}
694-
val buf = ListBuffer.empty[Path]
686+
private def collectAllSourceFiles(dir: Path) = {
687+
val buf = List.newBuilder[Path]
695688
Files.walkFileTree(
696689
dir,
697690
new SimpleFileVisitor[Path] {
@@ -719,7 +712,27 @@ class ScipBuildTool(index: IndexCommand) extends BuildTool("SCIP", index) {
719712
): FileVisitResult = FileVisitResult.CONTINUE
720713
}
721714
)
722-
buf.toList
715+
buf.result()
716+
}
717+
718+
/** Recursively collects all Java files in the working directory */
719+
private def collectAllSourceFiles(config: Config, dir: Path): List[Path] = {
720+
if (config.sourceFiles.nonEmpty) {
721+
println(config.sourceFiles)
722+
config
723+
.sourceFiles
724+
.flatMap { relativePath =>
725+
val path = AbsolutePath.of(Paths.get(relativePath), dir)
726+
727+
if (Files.isRegularFile(path) && allPatterns.matches(path))
728+
List(path)
729+
else if (Files.isDirectory(path))
730+
collectAllSourceFiles(path)
731+
else
732+
Nil
733+
}
734+
} else
735+
collectAllSourceFiles(dir)
723736
}
724737

725738
// HACK(olafurpg): I haven't figured out a reliable way to get annotation processor jars on the processorpath.

0 commit comments

Comments
 (0)