1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt-line-count.git synced 2025-04-25 03:07: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

3
.gitignore vendored
View file

@ -1,3 +1,4 @@
.idea .idea
.kobalt .kobalt
kobaltBuild
local.properties

View file

@ -1,24 +1,36 @@
import com.beust.kobalt.* import com.beust.kobalt.*
import com.beust.kobalt.plugin.packaging.* import com.beust.kobalt.plugin.packaging.*
import com.beust.kobalt.plugin.kotlin.* import com.beust.kobalt.plugin.kotlin.*
import com.beust.kobalt.plugin.publish.*
val repos = repos("https://dl.bintray.com/cbeust/maven/") val repos = repos("https://dl.bintray.com/cbeust/maven/")
val plugins = plugins(
"com.beust.kobalt:kobalt-line-count:0.8"
// file("/Users/beust/kotlin/kobalt-line-count/kobaltBuild/libs/kobalt-line-count-0.6.jar")
)
val project = kotlinProject { 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.2" version = "0.8"
dependencies { dependencies {
compile("com.beust:kobalt:0.139") compile("com.beust:kobalt:0.15")
} }
} }
val packProject = assemble(project) { val packProject = assemble(project) {
jar { mavenJars {
manifest { manifest {
attributes("Kobalt-Plugin-Class", "com.beust.kobalt.plugin.linecount.Main") attributes("Kobalt-Plugin-Class", "com.beust.kobalt.plugin.linecount.Main")
} }
} }
} }
val jc = jcenter(project) {
publish = true
}

View file

@ -44,5 +44,6 @@
<orderEntry type="library" name="Gradle: javax.inject:javax.inject:1" level="project" /> <orderEntry type="library" name="Gradle: javax.inject:javax.inject:1" level="project" />
<orderEntry type="library" name="Gradle: aopalliance:aopalliance:1.0" level="project" /> <orderEntry type="library" name="Gradle: aopalliance:aopalliance:1.0" level="project" />
<orderEntry type="library" name="Gradle: org.codehaus.plexus:plexus-utils:3.0.20" level="project" /> <orderEntry type="library" name="Gradle: org.codehaus.plexus:plexus-utils:3.0.20" level="project" />
<orderEntry type="library" name="kobalt-0.153" level="project" />
</component> </component>
</module> </module>

Binary file not shown.

View file

@ -1 +1 @@
kobalt.version=0.139 kobalt.version=0.154

View file

@ -1 +1,2 @@
java -jar kobalt/wrapper/kobalt-wrapper.jar $* java -jar kobalt/wrapper/kobalt-wrapper.jar $*

View file

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