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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
import org.jetbrains.*
plugins {
`kotlin-dsl`
id("org.jetbrains.conventions.maven-publish")
id("org.jetbrains.conventions.base-java")
id("com.gradle.plugin-publish")
}
dependencies {
api(projects.core)
compileOnly(libs.gradlePlugin.kotlin)
compileOnly(libs.gradlePlugin.android)
testImplementation(projects.testUtils)
testImplementation(libs.gradlePlugin.kotlin)
testImplementation(libs.gradlePlugin.android)
}
// Gradle will put its own version of the stdlib in the classpath, so not pull our own we will end up with
// warnings like 'Runtime JAR files in the classpath should have the same version'
configurations.api.configure {
excludeGradleCommonDependencies()
}
/**
* These dependencies will be provided by Gradle, and we should prevent version conflict
* Code taken from the Kotlin Gradle plugin:
* https://github.com/JetBrains/kotlin/blob/70e15b281cb43379068facb82b8e4bcb897a3c4f/buildSrc/src/main/kotlin/GradleCommon.kt#L72
*/
fun Configuration.excludeGradleCommonDependencies() {
dependencies
.withType<ModuleDependency>()
.configureEach {
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib")
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk7")
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk8")
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-common")
exclude(group = "org.jetbrains.kotlin", module = "kotlin-reflect")
exclude(group = "org.jetbrains.kotlin", module = "kotlin-script-runtime")
}
}
gradlePlugin {
plugins {
create("dokkaGradlePlugin") {
id = "org.jetbrains.dokka"
displayName = "Dokka plugin"
description = "Dokka, the Kotlin documentation tool"
implementationClass = "org.jetbrains.dokka.gradle.DokkaPlugin"
version = dokkaVersion
isAutomatedPublishing = true
}
}
}
pluginBundle {
website = "https://www.kotlinlang.org/"
vcsUrl = "https://github.com/kotlin/dokka.git"
tags = listOf("dokka", "kotlin", "kdoc", "android", "documentation")
mavenCoordinates {
groupId = "org.jetbrains.dokka"
artifactId = "dokka-gradle-plugin"
}
}
publishing {
publications {
register<MavenPublication>("dokkaGradlePluginForIntegrationTests") {
artifactId = "dokka-gradle-plugin"
from(components["java"])
version = "for-integration-tests-SNAPSHOT"
}
register<MavenPublication>("pluginMaven") {
configurePom("Dokka ${project.name}")
artifactId = "dokka-gradle-plugin"
}
afterEvaluate {
named<MavenPublication>("dokkaGradlePluginPluginMarkerMaven") {
configurePom("Dokka plugin")
}
}
}
}
tasks.validatePlugins {
enableStricterValidation.set(true)
}
tasks.withType<PublishToMavenRepository>().configureEach {
onlyIf { publication != publishing.publications["dokkaGradlePluginForIntegrationTests"] }
}
afterEvaluate { // Workaround for an interesting design choice https://github.com/gradle/gradle/blob/c4f935f77377f1783f70ec05381c8182b3ade3ea/subprojects/plugin-development/src/main/java/org/gradle/plugin/devel/plugins/MavenPluginPublishPlugin.java#L49
configureSpacePublicationIfNecessary("pluginMaven", "dokkaGradlePluginPluginMarkerMaven")
configureSonatypePublicationIfNecessary("pluginMaven", "dokkaGradlePluginPluginMarkerMaven")
createDokkaPublishTaskIfNecessary()
}
tasks.processResources {
duplicatesStrategy = DuplicatesStrategy.WARN
}
|