aboutsummaryrefslogtreecommitdiff
path: root/build-logic/src/main/kotlin/dokkabuild.publish-shadow.gradle.kts
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2023-11-10 11:46:54 +0100
committerGitHub <noreply@github.com>2023-11-10 11:46:54 +0100
commit8e5c63d035ef44a269b8c43430f43f5c8eebfb63 (patch)
tree1b915207b2b9f61951ddbf0ff2e687efd053d555 /build-logic/src/main/kotlin/dokkabuild.publish-shadow.gradle.kts
parenta44efd4ba0c2e4ab921ff75e0f53fc9335aa79db (diff)
downloaddokka-8e5c63d035ef44a269b8c43430f43f5c8eebfb63.tar.gz
dokka-8e5c63d035ef44a269b8c43430f43f5c8eebfb63.tar.bz2
dokka-8e5c63d035ef44a269b8c43430f43f5c8eebfb63.zip
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 <whyoleg@gmail.com>
Diffstat (limited to 'build-logic/src/main/kotlin/dokkabuild.publish-shadow.gradle.kts')
-rw-r--r--build-logic/src/main/kotlin/dokkabuild.publish-shadow.gradle.kts31
1 files changed, 31 insertions, 0 deletions
diff --git a/build-logic/src/main/kotlin/dokkabuild.publish-shadow.gradle.kts b/build-logic/src/main/kotlin/dokkabuild.publish-shadow.gradle.kts
new file mode 100644
index 00000000..7abb3376
--- /dev/null
+++ b/build-logic/src/main/kotlin/dokkabuild.publish-shadow.gradle.kts
@@ -0,0 +1,31 @@
+/*
+ * 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.java")
+ id("dokkabuild.publish-base")
+ id("com.github.johnrengelman.shadow")
+}
+
+java {
+ withSourcesJar()
+ withJavadocJar()
+}
+
+tasks.shadowJar {
+ // separate directory because otherwise Gradle complains about multiple tasks writing into the same file
+ destinationDirectory.set(project.layout.buildDirectory.dir("shadowLibs"))
+ // removes the `-all` classifier from the artifact name
+ archiveClassifier.set("")
+}
+
+publishing.publications.register<MavenPublication>(PublicationName.JVM) {
+ // shadow.component call should be after the shadowJar task is configured in a build script,
+ // because if not, shadow uses the wrong archiveFile (as we change destinationDirectory and archiveClassifier)
+ shadow.component(this)
+ artifact(tasks.named("sourcesJar"))
+ artifact(tasks.named("javadocJar"))
+}