aboutsummaryrefslogtreecommitdiff
path: root/build-logic/src/main/kotlin/dokkabuild/PublicationUtils.kt
blob: dd83cf5fde330b9ada491036fabe7a94900ed4d6 (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
/*
 * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
 */

package dokkabuild

import org.gradle.api.Project
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.withType

object PublicationName {
    const val JVM = "jvm"
    const val GRADLE_PLUGIN = "pluginMaven"
}

fun Project.overridePublicationArtifactId(
    artifactId: String,
    publicationName: String = PublicationName.JVM
) {
    extensions.configure<PublishingExtension> {
        publications.withType<MavenPublication>().named(publicationName) {
            this.artifactId = artifactId
        }
    }
}