aboutsummaryrefslogtreecommitdiff
path: root/build-logic/src/main/kotlin/dokkabuild.publish-shadow.gradle.kts
blob: 7abb33764cce89d595f63efe2313752eafc36f36 (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
/*
 * 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"))
}