0c094b1719
Basically this is revert of 427e34fe5a commit
This was done due to the KT-39728.
Also we do pick every file separately, because builtIn serializer
unable to filter expects
78 lines
2.2 KiB
Kotlin
78 lines
2.2 KiB
Kotlin
import org.gradle.api.tasks.PathSensitivity.RELATIVE
|
|
import java.io.File
|
|
|
|
plugins {
|
|
base
|
|
`maven-publish`
|
|
}
|
|
|
|
val builtinsSrc = fileFrom(rootDir, "core", "builtins", "src")
|
|
val builtinsNative = fileFrom(rootDir, "core", "builtins", "native")
|
|
val kotlinReflectCommon = fileFrom(rootDir, "libraries/stdlib/src/kotlin/reflect/")
|
|
val kotlinReflectJvm = fileFrom(rootDir, "libraries/stdlib/jvm/src/kotlin/reflect")
|
|
val builtinsCherryPicked = fileFrom(buildDir, "src")
|
|
|
|
val runtimeElements by configurations.creating {
|
|
isCanBeResolved = false
|
|
isCanBeConsumed = true
|
|
attributes {
|
|
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements.JAR))
|
|
}
|
|
}
|
|
|
|
val prepareSources by tasks.registering(Sync::class) {
|
|
from(kotlinReflectJvm) {
|
|
exclude("TypesJVM.kt")
|
|
exclude("KClassesImpl.kt")
|
|
}
|
|
from(kotlinReflectCommon) {
|
|
include("KTypeProjection.kt")
|
|
include("KClassifier.kt")
|
|
include("KTypeParameter.kt")
|
|
include("KVariance.kt")
|
|
}
|
|
into(builtinsCherryPicked)
|
|
}
|
|
|
|
val serialize by tasks.registering(NoDebugJavaExec::class) {
|
|
dependsOn(prepareSources)
|
|
val outDir = buildDir.resolve(name)
|
|
val inDirs = arrayOf(builtinsSrc, builtinsNative, builtinsCherryPicked)
|
|
inDirs.forEach { inputs.dir(it).withPathSensitivity(RELATIVE) }
|
|
|
|
outputs.dir(outDir)
|
|
outputs.cacheIf { true }
|
|
|
|
classpath(rootProject.buildscript.configurations["bootstrapCompilerClasspath"])
|
|
main = "org.jetbrains.kotlin.serialization.builtins.RunKt"
|
|
jvmArgs("-Didea.io.use.nio2=true")
|
|
args(
|
|
pathRelativeToWorkingDir(outDir),
|
|
*inDirs.map(::pathRelativeToWorkingDir).toTypedArray()
|
|
)
|
|
}
|
|
|
|
val builtinsJar by task<Jar> {
|
|
dependsOn(serialize)
|
|
from(serialize) { include("kotlin/**") }
|
|
destinationDir = File(buildDir, "libs")
|
|
}
|
|
|
|
val assemble by tasks.getting {
|
|
dependsOn(serialize)
|
|
}
|
|
|
|
val builtinsJarArtifact = artifacts.add(runtimeElements.name, builtinsJar)
|
|
|
|
publishing {
|
|
publications {
|
|
create<MavenPublication>("internal") {
|
|
artifact(builtinsJarArtifact)
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
maven("${rootProject.buildDir}/internal/repo")
|
|
}
|
|
}
|