aboutsummaryrefslogtreecommitdiff
path: root/dokka-runners/dokkatoo/buildSrc/src/main/kotlin/buildsrc/conventions/kotlin-gradle-plugin.gradle.kts
blob: 4174088ab9122026b3a5bf63557ee91b5e5e2d58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package buildsrc.conventions

plugins {
  id("buildsrc.conventions.base")
  id("buildsrc.conventions.java-base")
  id("org.gradle.kotlin.kotlin-dsl")
  id("com.gradle.plugin-publish")
}

tasks.validatePlugins {
  enableStricterValidation.set(true)
}

val createJavadocJarReadme by tasks.registering(Sync::class) {
  description = "generate a readme.txt for the Javadoc JAR"
  from(
    resources.text.fromString(
      """
      This Javadoc JAR is intentionally empty.
      
      For documentation, see the sources JAR or https://github.com/adamko-dev/dokkatoo/
      
    """.trimIndent()
    )
  ) {
    rename { "readme.txt" }
  }
  into(temporaryDir)
}


// The Gradle Publish Plugin enables the Javadoc JAR in afterEvaluate, so find it lazily
tasks.withType<Jar>()
  .matching { it.name == "javadocJar" }
  .configureEach {
    from(createJavadocJarReadme)
  }