Files
kotlin-fork/libraries/kotlinx-metadata/jvm/build.gradle.kts
T
Leonid Startsev ed30221f42 Publish kotlin-metadata-jvm as a part of Kotlin distribution
and add a corresponding POM test.

#KT-63161 Fixed
2024-02-15 15:32:33 +00:00

95 lines
2.4 KiB
Kotlin

import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
description = "Kotlin JVM metadata manipulation library"
group = "org.jetbrains.kotlin"
plugins {
kotlin("jvm")
id("jps-compatible")
id("org.jetbrains.kotlinx.binary-compatibility-validator")
id("org.jetbrains.dokka")
}
sourceSets {
"main" { projectDefault() }
"test" { projectDefault() }
}
val embedded by configurations
embedded.isTransitive = false
configurations.getByName("compileOnly").extendsFrom(embedded)
configurations.getByName("testApi").extendsFrom(embedded)
dependencies {
api(kotlinStdlib())
embedded(project(":kotlin-metadata"))
embedded(project(":core:metadata"))
embedded(project(":core:metadata.jvm"))
embedded(protobufLite())
testImplementation(kotlinTest("junit"))
testImplementation(libs.junit4)
testImplementation(commonDependency("org.jetbrains.intellij.deps:asm-all"))
testImplementation(commonDependency("org.jetbrains.kotlin:kotlin-reflect")) { isTransitive = false }
}
kotlin {
explicitApi()
compilerOptions {
freeCompilerArgs.add("-Xallow-kotlin-package")
}
}
publish()
val runtimeJar = runtimeJarWithRelocation {
from(mainSourceSet.output)
exclude("**/*.proto")
relocate("org.jetbrains.kotlin", "kotlin.metadata.internal")
}
tasks.apiBuild {
inputJar.value(runtimeJar.flatMap { it.archiveFile })
}
apiValidation {
ignoredPackages.add("kotlin.metadata.internal")
nonPublicMarkers.addAll(
listOf(
"kotlin.metadata.internal.IgnoreInApiDump",
"kotlin.metadata.jvm.internal.IgnoreInApiDump"
)
)
}
tasks.dokkaHtml.configure {
outputDirectory.set(layout.buildDirectory.dir("dokka"))
pluginsMapConfiguration.set(
mapOf(
"org.jetbrains.dokka.base.DokkaBase"
to """{ "templatesDir": "${projectDir.toString().replace('\\', '/')}/dokka-templates" }"""
)
)
dokkaSourceSets.configureEach {
includes.from(project.file("dokka/moduledoc.md").path)
sourceRoots.from(project(":kotlin-metadata").getSources())
skipDeprecated.set(true)
reportUndocumented.set(true)
failOnWarning.set(true)
perPackageOption {
matchingRegex.set("kotlin\\.metadata\\.internal(\$|\\.).*")
suppress.set(true)
reportUndocumented.set(false)
}
}
}
sourcesJar()
javadocJar()