1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt-line-count.git synced 2025-04-25 19:17:11 -07:00

Upgrade to 0.154.

This commit is contained in:
Cedric Beust 2015-10-07 22:56:25 -07:00
parent 34dcabbeb9
commit 72d27ac7d4
7 changed files with 34 additions and 16 deletions

View file

@ -23,17 +23,20 @@ public class Main : BasePlugin(), KobaltLogger {
var lineCount : Long = 0
val matcher = FileSystems.getDefault().getPathMatcher("glob:**.kt")
project.sourceDirectories.forEach {
Files.walkFileTree(Paths.get(it), object: SimpleFileVisitor<Path>() {
override public fun visitFile(path: Path, attrs: BasicFileAttributes): FileVisitResult {
log(2, "File: ${path}")
if (matcher.matches(path)) {
fileCount++
lineCount += Files.lines(path).count()
log(2, " MATCH")
val path = Paths.get(it)
if (path.toFile().exists()) {
Files.walkFileTree(path, object : SimpleFileVisitor<Path>() {
override public fun visitFile(path: Path, attrs: BasicFileAttributes): FileVisitResult {
log(2, "File: ${path}")
if (matcher.matches(path)) {
fileCount++
lineCount += Files.lines(path).count()
log(2, " MATCH")
}
return FileVisitResult.CONTINUE
}
return FileVisitResult.CONTINUE
}
})
})
}
}
log(1, "Found ${lineCount} lines in ${fileCount} files")
return TaskResult()