mirror of
https://github.com/ethauvin/kobalt-doc.git
synced 2025-04-25 20:07:11 -07:00
Updated plug-in dev docs to newer API.
This commit is contained in:
parent
75fbaa4538
commit
ce93cc0395
2 changed files with 9 additions and 19 deletions
|
@ -546,18 +546,20 @@ intrface:
|
||||||
</p>
|
</p>
|
||||||
<pre class="brush:java">
|
<pre class="brush:java">
|
||||||
interface ITaskContributor {
|
interface ITaskContributor {
|
||||||
fun tasksFor(context: KobaltContext) : List<DynamicTask>
|
fun tasksFor(project: Project, context: KobaltContext) : List<DynamicTask>
|
||||||
}</pre>
|
}</pre>
|
||||||
<p>
|
<p>
|
||||||
For example:
|
For example:
|
||||||
</p>
|
</p>
|
||||||
<pre class="brush:java">
|
<pre class="brush:java">
|
||||||
override fun tasksFor(context: KobaltContext) = listOf(
|
override fun tasksFor(project: Project, context: KobaltContext) = listOf(
|
||||||
DynamicTask(
|
DynamicTask(this
|
||||||
name = "dynamicTask",
|
name = "dynamicTask",
|
||||||
description = "Description",
|
description = "Description",
|
||||||
|
group = "other",
|
||||||
|
project = project,
|
||||||
reverseDependsOn = listOf("compile"),
|
reverseDependsOn = listOf("compile"),
|
||||||
closure = { project: Project ->
|
closure = { project ->
|
||||||
println("Running dynamicTask")
|
println("Running dynamicTask")
|
||||||
TaskResult()
|
TaskResult()
|
||||||
}))</pre>
|
}))</pre>
|
||||||
|
|
|
@ -91,23 +91,11 @@ val project = project {
|
||||||
...
|
...
|
||||||
</pre>
|
</pre>
|
||||||
<p>
|
<p>
|
||||||
We also need to add Kobalt as a dependency, so let's find out what the latest version of the
|
We also need to add Kobalt Plug-in API as a dependency:
|
||||||
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:
|
|
||||||
</p>
|
</p>
|
||||||
<pre class="brush:java">
|
<pre class="brush:java">
|
||||||
dependencies {
|
dependencies {
|
||||||
compile("com.beust:kobalt:0.335")
|
compile("com.beust:kobalt-plugin-api:")
|
||||||
}</pre>
|
}</pre>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
@ -303,7 +291,7 @@ public class Main : BasePlugin() {
|
||||||
|
|
||||||
<pre class="brush:java">
|
<pre class="brush:java">
|
||||||
val p = plugins(
|
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>
|
</pre>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue