From 8e5c63d035ef44a269b8c43430f43f5c8eebfb63 Mon Sep 17 00:00:00 2001 From: Ignat Beresnev Date: Fri, 10 Nov 2023 11:46:54 +0100 Subject: Restructure the project to utilize included builds (#3174) * Refactor and simplify artifact publishing * Update Gradle to 8.4 * Refactor and simplify convention plugins and build scripts Fixes #3132 --------- Co-authored-by: Adam <897017+aSemy@users.noreply.github.com> Co-authored-by: Oleg Yukhnevich --- .../dokkabuild.publish-gradle-plugin.gradle.kts | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 build-logic/src/main/kotlin/dokkabuild.publish-gradle-plugin.gradle.kts (limited to 'build-logic/src/main/kotlin/dokkabuild.publish-gradle-plugin.gradle.kts') diff --git a/build-logic/src/main/kotlin/dokkabuild.publish-gradle-plugin.gradle.kts b/build-logic/src/main/kotlin/dokkabuild.publish-gradle-plugin.gradle.kts new file mode 100644 index 00000000..93718909 --- /dev/null +++ b/build-logic/src/main/kotlin/dokkabuild.publish-gradle-plugin.gradle.kts @@ -0,0 +1,36 @@ +/* + * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +import dokkabuild.PublicationName + +plugins { + id("dokkabuild.publish-base") + id("com.gradle.plugin-publish") +} + +@Suppress("UnstableApiUsage") +gradlePlugin { + website.set("https://kotl.in/dokka") + vcsUrl.set("https://github.com/kotlin/dokka.git") +} + +// com.gradle.plugin-publish configures publication in afterEvaluate block +// so to be able to configure it directly in build scripts (f.e. to change artifactId) we need to register it earlier +// more info: https://docs.gradle.org/current/userguide/java_gradle_plugin.html#maven_publish_plugin +publishing.publications.register(PublicationName.GRADLE_PLUGIN) + +// com.gradle.plugin-publish configures javadoc only for the main plugin artifact, +// so we need to link it manually to other publications +// specifically with artifact `org.jetbrains.dokka.gradle.plugin` +// which is used to resolve plugins via `plugins { id("org.jetbrains.dokka") }` +// it's not needed for gradle plugin portal, but needed for Maven Central +// NOTE: it should be configured in `afterEvaluate` +// because `javadocJar` task is created in `afterEvaluate` block in `com.gradle.plugin-publish` plugin +afterEvaluate { + publishing.publications.withType() + .matching { it.name != PublicationName.GRADLE_PLUGIN } + .configureEach { + artifact(tasks.named("javadocJar")) + } +} -- cgit