Files
kotlin-fork/plugins/jvm-abi-gen/build.gradle.kts
T
2021-12-16 21:48:19 +03:00

75 lines
2.4 KiB
Kotlin

import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
description = "ABI generation for Kotlin/JVM"
plugins {
kotlin("jvm")
id("jps-compatible")
}
sourceSets {
"main" { projectDefault() }
"test" { projectDefault() }
}
val shadows: Configuration by configurations.creating {
isTransitive = false
}
configurations.getByName("compileOnly").extendsFrom(shadows)
configurations.getByName("testApi").extendsFrom(shadows)
dependencies {
// Should come before compiler dependencies, see comment in "compiler/build.gradle.kts"
testRuntimeOnly(intellijDep())
compileOnly(project(":compiler:util"))
compileOnly(project(":compiler:cli"))
compileOnly(project(":compiler:backend"))
compileOnly(project(":compiler:frontend"))
compileOnly(project(":compiler:frontend.java"))
compileOnly(project(":compiler:plugin-api"))
compileOnly(project(":kotlin-build-common"))
// Include kotlinx.metadata for metadata stripping.
// Note that kotlinx-metadata-jvm already includes kotlinx-metadata, core:metadata, core:metadata.jvm,
// and protobuf-lite, so we only need to include kotlinx-metadata-jvm in the shadow jar.
compileOnly(project(":kotlinx-metadata"))
shadows(commonDependency("org.jetbrains.kotlinx:kotlinx-metadata-jvm"))
compileOnly(intellijCoreDep()) { includeJars("intellij-core", "asm-all", rootProject = rootProject) }
testApi(intellijDep()) { includeJars("platform-impl", rootProject = rootProject) }
testRuntimeOnly(intellijCoreDep()) { includeJars("intellij-core") }
testRuntimeOnly(project(":kotlin-compiler"))
testImplementation(commonDependency("junit:junit"))
testImplementation(projectTests(":compiler:tests-common"))
testImplementation(projectTests(":compiler:incremental-compilation-impl"))
}
publish()
noDefaultJar()
val shadowJar = runtimeJar(tasks.register<ShadowJar>("shadowJar")) {
callGroovy("manifestAttributes", manifest, project)
manifest.attributes["Implementation-Version"] = archiveVersion
from(mainSourceSet.output)
configurations = listOf(shadows)
relocate("kotlinx.metadata", "org.jetbrains.kotlin.jvm.abi.kotlinx.metadata")
mergeServiceFiles() // This is needed to relocate the services files for kotlinx.metadata
}
sourcesJar()
javadocJar()
projectTest(parallel = true) {
workingDir = rootDir
dependsOn(":dist")
dependsOn(shadowJar)
}
testsJar()