mirror of
https://github.com/ethauvin/kobalt-line-count.git
synced 2025-04-25 03:07:11 -07:00
Update to new architecture.
This commit is contained in:
parent
2bc76dbb05
commit
551c4b987f
4 changed files with 19 additions and 25 deletions
|
@ -17,11 +17,10 @@ val project = kotlinProject {
|
||||||
name = "kobalt-line-count"
|
name = "kobalt-line-count"
|
||||||
group = "com.beust.kobalt"
|
group = "com.beust.kobalt"
|
||||||
artifactId = name
|
artifactId = name
|
||||||
version = "0.16"
|
version = "0.17"
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// compile("file:" + homeDir("kotlin/kobalt/kobaltBuild/libs/kobalt-0.168.jar"))
|
compile("com.beust:kobalt-plugin-api:")
|
||||||
compile("com.beust:kobalt:0.226")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assemble {
|
assemble {
|
|
@ -1 +1 @@
|
||||||
kobalt.version=0.226
|
kobalt.version=0.388
|
|
@ -1,21 +1,25 @@
|
||||||
package com.beust.kobalt.plugin.linecount
|
package com.beust.kobalt.plugin.linecount
|
||||||
|
|
||||||
import com.beust.kobalt.api.BasePlugin
|
import com.beust.kobalt.TaskResult
|
||||||
import com.beust.kobalt.api.Kobalt
|
import com.beust.kobalt.api.*
|
||||||
import com.beust.kobalt.api.KobaltContext
|
|
||||||
import com.beust.kobalt.api.Project
|
|
||||||
import com.beust.kobalt.api.annotation.Directive
|
import com.beust.kobalt.api.annotation.Directive
|
||||||
import com.beust.kobalt.api.annotation.Task
|
import com.beust.kobalt.api.annotation.Task
|
||||||
import com.beust.kobalt.internal.TaskResult
|
|
||||||
import com.beust.kobalt.misc.log
|
import com.beust.kobalt.misc.log
|
||||||
import java.nio.file.*
|
import java.nio.file.*
|
||||||
import java.nio.file.attribute.BasicFileAttributes
|
import java.nio.file.attribute.BasicFileAttributes
|
||||||
|
|
||||||
fun main(argv: Array<String>) {
|
//fun main(argv: Array<String>) {
|
||||||
com.beust.kobalt.main(argv)
|
// com.beust.kobalt.main(argv)
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
public class LineCountPlugin : BasePlugin(), ITaskContributor {
|
||||||
|
override fun tasksFor(context: KobaltContext)
|
||||||
|
= listOf(DynamicTask(this, "dynamicTask", "Dynamic task", runBefore = listOf("compile"),
|
||||||
|
closure = { project ->
|
||||||
|
println("Running dynamic task")
|
||||||
|
TaskResult()
|
||||||
|
}))
|
||||||
|
|
||||||
public class LineCountPlugin : BasePlugin() {
|
|
||||||
companion object {
|
companion object {
|
||||||
const val NAME : String = "kobalt-line-count"
|
const val NAME : String = "kobalt-line-count"
|
||||||
}
|
}
|
||||||
|
@ -23,15 +27,6 @@ public class LineCountPlugin : BasePlugin() {
|
||||||
|
|
||||||
var info: LineCountInfo = LineCountInfo()
|
var info: LineCountInfo = LineCountInfo()
|
||||||
|
|
||||||
override fun apply(project: Project, context: KobaltContext) {
|
|
||||||
println("*** Applying plugin $name with project $project")
|
|
||||||
println("*** Adding dynamic task")
|
|
||||||
addTask(project, "dynamicTask", runBefore = listOf("compile")) {
|
|
||||||
println("Dynamic task")
|
|
||||||
TaskResult()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Task(name = "lineCount", description = "Count the lines", runBefore = arrayOf("compile"))
|
@Task(name = "lineCount", description = "Count the lines", runBefore = arrayOf("compile"))
|
||||||
fun lineCount(project: Project): TaskResult {
|
fun lineCount(project: Project): TaskResult {
|
||||||
var fileCount = 0
|
var fileCount = 0
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<kobalt-plugin>
|
<kobalt-plugin>
|
||||||
<name>kobalt-line-count</name>
|
<name>kobalt-line-count</name>
|
||||||
<plugins>
|
<plugin-actors>
|
||||||
<class-name>com.beust.kobalt.plugin.linecount.LineCountPlugin</class-name>
|
<class-name>com.beust.kobalt.plugin.linecount.LineCountPlugin</class-name>
|
||||||
</plugins>
|
</plugin-actors>
|
||||||
</kobalt-plugin>
|
</kobalt-plugin>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue