mirror of
https://github.com/ethauvin/kobalt-doc.git
synced 2025-04-25 20:07:11 -07:00
Merge pull request #17 from dittert/bugfix/doku_updates
Fix minor problems in the documentation
This commit is contained in:
commit
936b0a017a
3 changed files with 18 additions and 14 deletions
|
@ -959,7 +959,7 @@ Now, all you need to do is to upload your package:
|
||||||
Finally, you invoke <code>./kobaltw</code> with the <code>--profiles</code> parameter followed by the profiles you want to activate, separated by a comma:
|
Finally, you invoke <code>./kobaltw</code> with the <code>--profiles</code> parameter followed by the profiles you want to activate, separated by a comma:
|
||||||
</p>
|
</p>
|
||||||
<pre class="brush:plain">
|
<pre class="brush:plain">
|
||||||
./kobaltw -profiles experimental,premium assemble
|
./kobaltw --profiles experimental,premium assemble
|
||||||
</pre>
|
</pre>
|
||||||
<p>
|
<p>
|
||||||
Keep in mind that since your build file is a real Kotlin source file,
|
Keep in mind that since your build file is a real Kotlin source file,
|
||||||
|
|
|
@ -286,7 +286,7 @@ class BuildConfig {
|
||||||
}
|
}
|
||||||
}</pre>
|
}</pre>
|
||||||
<p>
|
<p>
|
||||||
Take a look at the <a href=https://github.com/cbeust/kobalt-examples/tree/master/variants>variants example
|
Take a look at the <a href=https://github.com/cbeust/kobalt-examples/tree/master/flavors/src>variants example
|
||||||
project</a> to see an actual example using variants and <code>BuildConfig</code>.
|
project</a> to see an actual example using variants and <code>BuildConfig</code>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
|
@ -121,11 +121,12 @@ val project = project {
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre class="brush:java">
|
<pre class="brush:java">
|
||||||
|
// LineCountPlugin.kt
|
||||||
package com.beust.kobalt.plugin.linecount
|
package com.beust.kobalt.plugin.linecount
|
||||||
|
|
||||||
import com.beust.kobalt.api.*
|
import com.beust.kobalt.api.*
|
||||||
|
|
||||||
public class Main : BasePlugin() {
|
class LineCountPlugin : BasePlugin() {
|
||||||
override val name = "kobalt-line-count"
|
override val name = "kobalt-line-count"
|
||||||
|
|
||||||
override fun apply(project: Project, context: KobaltContext) {
|
override fun apply(project: Project, context: KobaltContext) {
|
||||||
|
@ -162,22 +163,25 @@ bintray {
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre class="brush:java">
|
<pre class="brush:java">
|
||||||
// Main.kt
|
// LineCountPlugin.kt
|
||||||
@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
|
||||||
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 (Files.isDirectory(path)) {
|
||||||
if (matcher.matches(path)) {
|
Files.walkFileTree(path, object : SimpleFileVisitor<Path>() {
|
||||||
fileCount++
|
override fun visitFile(path: Path, attrs: BasicFileAttributes): FileVisitResult {
|
||||||
lineCount += Files.lines(path).count()
|
if (matcher.matches(path)) {
|
||||||
|
fileCount++
|
||||||
|
lineCount += Files.lines(path).count()
|
||||||
|
}
|
||||||
|
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()
|
||||||
|
@ -189,7 +193,7 @@ fun lineCount(project: Project): TaskResult {
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre class="brush:java">
|
<pre class="brush:java">
|
||||||
public class Main : BasePlugin() {
|
class LineCountPlugin : BasePlugin() {
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
@ -276,7 +280,7 @@ fun main(argv: Array<String>) {
|
||||||
com.beust.kobalt.main(argv)
|
com.beust.kobalt.main(argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Main : BasePlugin() {
|
class LineCountPlugin : BasePlugin() {
|
||||||
// ...
|
// ...
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue