Files
kotlin-fork/libraries/kotlinx-metadata/jvm/build.gradle.kts
T
Alexander.Likhachev a19bd2ed2e [Build] Migrate most of the build logic from Project.buildDir usage
It's going to be deprecated in Gradle 8.3

There's currently no way to pass a `org.gradle.api.provider.Provider` to the JavaExec.systemProperty or Test.systemProperty. There's a workaround using `org.gradle.process.CommandLineArgumentProvider`, but I intentionally don't rework these calls as Gradle is going to allow passing providers to configure system properties: https://github.com/gradle/gradle/issues/12247#issuecomment-1568427242
^KTI-1473 In Progress
2023-12-07 18:31:06 +00:00

110 lines
3.3 KiB
Kotlin

import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
description = "Kotlin JVM metadata manipulation library"
plugins {
kotlin("jvm")
id("jps-compatible")
id("org.jetbrains.kotlinx.binary-compatibility-validator")
id("org.jetbrains.dokka")
}
/*
* To publish this library use `:kotlinx-metadata-jvm:publish` task and specify the following parameters
*
* - `-PdeployVersion=1.2.nn`: the version of the standard library dependency to put into .pom
* - `-PkotlinxMetadataDeployVersion=0.0.n`: the version of the library itself
* - `-PdeployRepoUrl=repository_url`: (optional) the url of repository to deploy to;
* if not specified, the local directory repository `build/repo` will be used
* - `-PdeployRepoUsername=username`: (optional) the username to authenticate in the deployment repository
* - `-PdeployRepoPassword=password`: (optional) the password to authenticate in the deployment repository
*/
group = "org.jetbrains.kotlinx"
val deployVersion = findProperty("kotlinxMetadataDeployVersion") as String?
version = deployVersion ?: "0.1-SNAPSHOT"
//kotlin {
// explicitApiWarning()
//}
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(":kotlinx-metadata"))
embedded(project(":core:metadata"))
embedded(project(":core:metadata.jvm"))
embedded(protobufLite())
testImplementation(project(":kotlin-test:kotlin-test-junit"))
testImplementation(libs.junit4)
testImplementation(commonDependency("org.jetbrains.intellij.deps:asm-all"))
testImplementation(commonDependency("org.jetbrains.kotlin:kotlin-reflect")) { isTransitive = false }
}
kotlin {
explicitApi()
}
if (deployVersion != null) {
publish()
}
val runtimeJar = runtimeJarWithRelocation {
from(mainSourceSet.output)
exclude("**/*.proto")
relocate("org.jetbrains.kotlin", "kotlinx.metadata.internal")
}
tasks.apiBuild {
inputJar.value(runtimeJar.flatMap { it.archiveFile })
}
apiValidation {
ignoredPackages.add("kotlinx.metadata.internal")
nonPublicMarkers.addAll(
listOf(
"kotlinx.metadata.internal.IgnoreInApiDump",
"kotlinx.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(":kotlinx-metadata").getSources())
skipDeprecated.set(true)
reportUndocumented.set(true)
failOnWarning.set(true)
perPackageOption {
matchingRegex.set("kotlinx\\.metadata\\.internal(\$|\\.).*")
suppress.set(true)
reportUndocumented.set(false)
}
}
}
sourcesJar()
javadocJar()