Skip to content

Commit 15e8527

Browse files
committed
Updated Documentation and CHANGELOG.md
1 parent 613faa2 commit 15e8527

File tree

2 files changed

+32
-9
lines changed

2 files changed

+32
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
- Road to 1.0 - Migrate from java.util.Date to kotlinx.datetime [@gianluz] - [#147](https://github.com/danger/kotlin/pull/147)
2424
- Fix typo in Github Milestone serialization [@doodeec] - [#151](https://github.com/danger/kotlin/pull/151)
2525
- Use fixed commit of danger/kotlin repository in install.sh script [@davidbilik]- [#152](https://github.com/danger/kotlin/pull/152)
26+
- Library resolver and plugin installer gradle plugin [@gianluz] - [#158](https://github.com/danger/kotlin/pull/158)
2627

2728
# 0.7.1
2829

docs/tutorials/plugin_development.html.md

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Everything you need is just IntelliJ IDEA and the kotlin environment setup on yo
2020
**Step 2: Add the sdk as dependency**. In your `build.gradle` add the following dependency:
2121
```groovy
2222
dependencies {
23-
implementation "systems.danger:danger-kotlin-sdk:1.1"
23+
implementation "systems.danger:danger-kotlin-sdk:1.2"
2424
}
2525
```
2626

@@ -40,9 +40,32 @@ object MyAwesomeDangerPlugin : DangerPlugin() {
4040
}
4141
```
4242

43-
**Step 4: Try your plugin with Danger**. Create your `Dangerfile.df.kts` and import your plugin.
43+
**Step 4: Build your plugin**. You can copy manually your compiled jar into `/usr/local/lib/danger/libs` or alternatively use the gradle plugin as follow:
44+
```groovy
45+
buildscript {
46+
repositories {
47+
mavenLocal()
48+
}
49+
50+
dependencies {
51+
classpath "systems.danger:danger-plugin-installer:0.1-alpha"
52+
}
53+
}
54+
55+
apply plugin: 'danger-kotlin-plugin-installer'
56+
57+
group 'com.test'
58+
version '0.0.1'
59+
60+
dangerPlugin {
61+
outputJar = "${buildDir}/libs/my-awesome-plugin-0.0.1.jar"
62+
}
63+
```
64+
then invoke `./gradlew build` and `./gradlew installDangerPlugin`.
65+
66+
**Step 5: Try your plugin with Danger**. Create your `Dangerfile.df.kts` and import your plugin.
4467
```kotlin
45-
@file:DependsOn("./build/libs/my-awesome-plugin-0.0.1.jar")
68+
@file:DependsOn("my-awesome-plugin-0.0.1.jar")
4669

4770
import com.test.myawesomeplugin.MyAwesomePlugin
4871
import systems.danger.kotlin.*
@@ -55,12 +78,10 @@ MyAwesomePlugin.helloPlugin()
5578
```
5679
If danger is setup correctly you should see a message on your PR: `Hello Danger Plugin!`
5780

58-
**Step 5: Maven publication**. If you setup the autocomplete in `IntelliJ IDEA` for the DangerFiles, you will see that the autocomplete doesn't work for the imported `jar`.
59-
This feature at the moment is not supported by kotlin. However by
60-
publishing your plugin to Maven Central this problem can be solved. Then your `Dangerfile.df.kts` will be like:
81+
**Step 5: Maven publication**. Publish your plugin to maven central and add your plugin in [awesome-danger]. Then your `Dangerfile.df.kts` will be like:
6182
```kotlin
6283
@file:DependsOn("com.test:my-awesome-plugin:version")
63-
//If the repository url is not specified, will be Maven central by default
84+
//You can add more than one maven repository
6485
@file:Repository("http://url.to.maven.repo/repository")
6586

6687
import com.test.myawesomeplugin.MyAwesomePlugin
@@ -75,6 +96,7 @@ MyAwesomePlugin.helloPlugin()
7596

7697
## Resources
7798

78-
Some plugin examples can be found [here]
99+
Some plugins can be found in [awesome-danger] and an example plugin is also available [here]
79100

80-
[here]: https://github.com/danger/awesome-danger#kotlin-danger-kotlin
101+
[awesome-danger]: https://github.com/danger/awesome-danger#kotlin-danger-kotlin
102+
[here]: https://github.com/danger/kotlin/danger-kotlin-sample-plugin

0 commit comments

Comments
 (0)