mirror of
https://github.com/ethauvin/kobalt-line-count.git
synced 2025-04-24 18:57:11 -07:00
Update
This commit is contained in:
parent
83dbbc9fe1
commit
c3ba642496
2 changed files with 7 additions and 4 deletions
|
@ -20,7 +20,7 @@ val project = project {
|
|||
version = "0.23"
|
||||
|
||||
dependencies {
|
||||
compile("com.beust:kobalt-plugin-api:0.930")
|
||||
compile("com.beust:kobalt-plugin-api:0.939")
|
||||
}
|
||||
|
||||
assemble {
|
||||
|
|
|
@ -12,7 +12,10 @@ import java.nio.file.attribute.BasicFileAttributes
|
|||
// com.beust.kobalt.main(argv)
|
||||
//}
|
||||
|
||||
public class LineCountPlugin : BasePlugin(), ITaskContributor {
|
||||
/**
|
||||
* A simple line counting plug-in for Kobalt.
|
||||
*/
|
||||
class LineCountPlugin : BasePlugin(), ITaskContributor {
|
||||
// ITaskContributor
|
||||
override fun tasksFor(project: Project, context: KobaltContext) = listOf(
|
||||
DynamicTask(this,
|
||||
|
@ -44,7 +47,7 @@ public class LineCountPlugin : BasePlugin(), ITaskContributor {
|
|||
val path = Paths.get(it)
|
||||
if (path.toFile().exists()) {
|
||||
Files.walkFileTree(path, object : SimpleFileVisitor<Path>() {
|
||||
override public fun visitFile(path: Path, attrs: BasicFileAttributes): FileVisitResult {
|
||||
override fun visitFile(path: Path, attrs: BasicFileAttributes): FileVisitResult {
|
||||
if (matcher.matches(path)) {
|
||||
fileCount++
|
||||
lineCount += Files.lines(path).count()
|
||||
|
@ -63,7 +66,7 @@ public class LineCountPlugin : BasePlugin(), ITaskContributor {
|
|||
data class LineCountInfo(var suffix: String = "**kt")
|
||||
|
||||
@Directive
|
||||
public fun lineCount(init: LineCountInfo.() -> Unit): LineCountInfo {
|
||||
fun lineCount(init: LineCountInfo.() -> Unit): LineCountInfo {
|
||||
with(LineCountInfo()) {
|
||||
init()
|
||||
(Kobalt.findPlugin(LineCountPlugin.NAME) as LineCountPlugin).info = this
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue