From 90b7041002bef847c14261ff325194ee3e63f551 Mon Sep 17 00:00:00 2001 From: Dirk Dittert Date: Sat, 25 Mar 2017 15:47:15 +0100 Subject: [PATCH 1/3] Fix the link to the sample project for build variants. --- plug-ins/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plug-ins/index.html b/plug-ins/index.html index aa05d9e..c10cf3a 100644 --- a/plug-ins/index.html +++ b/plug-ins/index.html @@ -286,7 +286,7 @@ class BuildConfig { } }

- Take a look at the variants example + Take a look at the variants example project to see an actual example using variants and BuildConfig.

From 9a34937836580fb16409a7fbff6b56061125b612 Mon Sep 17 00:00:00 2001 From: Dirk Dittert Date: Sat, 25 Mar 2017 16:02:09 +0100 Subject: [PATCH 2/3] Fix code examples. Fixes some inconsistencies in the code examples (e.g. the name of plugin class). It also addresses the problem that the code fails if one of the default source directories does not exist. --- ten-minutes/index.html | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/ten-minutes/index.html b/ten-minutes/index.html index 98b6737..a75be12 100644 --- a/ten-minutes/index.html +++ b/ten-minutes/index.html @@ -121,11 +121,12 @@ val project = project {

+// LineCountPlugin.kt
 package com.beust.kobalt.plugin.linecount
 
 import com.beust.kobalt.api.*
 
-public class Main : BasePlugin() {
+class LineCountPlugin : BasePlugin() {
     override val name = "kobalt-line-count"
 
     override fun apply(project: Project, context: KobaltContext) {
@@ -162,22 +163,25 @@ bintray {
           

-// Main.kt
+// LineCountPlugin.kt
 @Task(name = "lineCount", description = "Count the lines", runBefore = arrayOf("compile"))
 fun lineCount(project: Project): TaskResult {
   var fileCount = 0
   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 {
-        if (matcher.matches(path)) {
-          fileCount++
-          lineCount += Files.lines(path).count()
+    val path = Paths.get(it)
+    if (Files.isDirectory(path)) {
+      Files.walkFileTree(path, object : SimpleFileVisitor<Path>() {
+        override fun visitFile(path: Path, attrs: BasicFileAttributes): FileVisitResult {
+          if (matcher.matches(path)) {
+            fileCount++
+            lineCount += Files.lines(path).count()
+          }
+          return FileVisitResult.CONTINUE
         }
-        return FileVisitResult.CONTINUE
-      }
-    })
+      })
+    }
   }
   log(1, "Found $lineCount lines in $fileCount files")
   return TaskResult()
@@ -189,7 +193,7 @@ fun lineCount(project: Project): TaskResult {
           

-public class Main : BasePlugin() {
+class LineCountPlugin : BasePlugin() {
 

@@ -276,7 +280,7 @@ fun main(argv: Array<String>) { com.beust.kobalt.main(argv) } -public class Main : BasePlugin() { +class LineCountPlugin : BasePlugin() { // ...

From 75332fdb995b898e7fc5a22c62661a3216fa34a7 Mon Sep 17 00:00:00 2001 From: Dirk Dittert Date: Sat, 25 Mar 2017 16:22:53 +0100 Subject: [PATCH 3/3] Add missing dash. --- documentation/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/index.html b/documentation/index.html index 373a433..079d51d 100644 --- a/documentation/index.html +++ b/documentation/index.html @@ -959,7 +959,7 @@ Now, all you need to do is to upload your package: Finally, you invoke ./kobaltw with the --profiles parameter followed by the profiles you want to activate, separated by a comma:

-  ./kobaltw -profiles experimental,premium assemble
+  ./kobaltw --profiles experimental,premium assemble
 

Keep in mind that since your build file is a real Kotlin source file,