mirror of
https://github.com/ethauvin/kobalt-doc.git
synced 2025-04-25 03:57:11 -07:00
Merge pull request #14 from ethauvin/master
Updated plug-in dev docs to newer API.
This commit is contained in:
commit
1a85eae85b
2 changed files with 9 additions and 19 deletions
|
@ -546,18 +546,20 @@ intrface:
|
|||
</p>
|
||||
<pre class="brush:java">
|
||||
interface ITaskContributor {
|
||||
fun tasksFor(context: KobaltContext) : List<DynamicTask>
|
||||
fun tasksFor(project: Project, context: KobaltContext) : List<DynamicTask>
|
||||
}</pre>
|
||||
<p>
|
||||
For example:
|
||||
</p>
|
||||
<pre class="brush:java">
|
||||
override fun tasksFor(context: KobaltContext) = listOf(
|
||||
DynamicTask(
|
||||
override fun tasksFor(project: Project, context: KobaltContext) = listOf(
|
||||
DynamicTask(this
|
||||
name = "dynamicTask",
|
||||
description = "Description",
|
||||
group = "other",
|
||||
project = project,
|
||||
reverseDependsOn = listOf("compile"),
|
||||
closure = { project: Project ->
|
||||
closure = { project ->
|
||||
println("Running dynamicTask")
|
||||
TaskResult()
|
||||
}))</pre>
|
||||
|
|
|
@ -91,23 +91,11 @@ val project = project {
|
|||
...
|
||||
</pre>
|
||||
<p>
|
||||
We also need to add Kobalt as a dependency, so let's find out what the latest version of the
|
||||
jar file:
|
||||
</p>
|
||||
<pre class="brush:plain">
|
||||
$ ./kobaltw --resolve com.beust:kobalt:
|
||||
+======================================================================+
|
||||
| com.beust:kobalt: |
|
||||
| https://jcenter.bintray.com/com/beust/kobalt/0.335/kobalt-0.335.jar |
|
||||
+======================================================================+</pre>
|
||||
<p>
|
||||
<p>
|
||||
Note that the Maven id above doesn't specify a version (it ends with a colon), which means
|
||||
Kobalt will resolve it to the latest version it can find.Let's add this version in our dependencies:
|
||||
We also need to add Kobalt Plug-in API as a dependency:
|
||||
</p>
|
||||
<pre class="brush:java">
|
||||
dependencies {
|
||||
compile("com.beust:kobalt:0.335")
|
||||
compile("com.beust:kobalt-plugin-api:")
|
||||
}</pre>
|
||||
|
||||
<p>
|
||||
|
@ -303,7 +291,7 @@ public class Main : BasePlugin() {
|
|||
|
||||
<pre class="brush:java">
|
||||
val p = plugins(
|
||||
file(homeDir("kotlin/kobalt-line-count/kobaltBuild/libs/kobalt-line-count-0.8.jar"))
|
||||
file(homeDir("kotlin/kobalt-line-count/kobaltBuild/libs/kobalt-line-count-0.2.jar"))
|
||||
)
|
||||
</pre>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue