Skip to content

Commit aaabb54

Browse files
committed
netlify badge
1 parent 44f1a66 commit aaabb54

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

build.gradle.kts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,20 @@ java.modularity.inferModulePath.set(true)
3737

3838
tasks {
3939

40+
val netlifyBadge by registering {
41+
doLast {
42+
val index = dokkaHtml.get().outputDirectory.get().resolve("kotlin-unsigned" + File.separatorChar + "index.html")
43+
val text = index.readText()
44+
val ofs = text.lastIndexOf("</span>") + 7
45+
val badge = """
46+
<a href="https://www.netlify.com">
47+
<img src="https://www.netlify.com/img/global/badges/netlify-color-accent.svg" alt="Deploys by Netlify" style="vertical-align:middle;margin:10px 10px" />
48+
</a>
49+
""".trimIndent()
50+
index.writeText(text.replaceRange(ofs, ofs, badge))
51+
}
52+
}
53+
4054
dokkaHtml {
4155
dokkaSourceSets {
4256
configureEach {
@@ -50,6 +64,7 @@ tasks {
5064
}
5165
}
5266
}
67+
finalizedBy(netlifyBadge)
5368
}
5469

5570
withType<KotlinCompile>().all {

0 commit comments

Comments
 (0)