Files
kotlin-fork/libraries/stdlib/jvm/build.gradle
T
Alexander Udalov 0925e1b497 Enable JVM IR for stdlib/reflect/test libraries
Changes in Gradle integration tests are needed because:
- in new-mpp-android, kotlin-stdlib-jdk8 is used, and JVM IR generates
  JDK 8-specific bytecode (invokedynamic). D8 needs to be configured to
  desugar it with source/target versions set to 1.8, otherwise it
  reports an error.
- in AndroidExtensionsManyVariants and AndroidIcepickProject, D8 fails
  with assertions enabled if AGP < 4.0.0 is used because of
  https://issuetracker.google.com/issues/148661132. The tests which use
  old AGP versions are probably not relevant anymore anyway.

Changes in kotlin-stdlib-runtime-merged.txt are caused by a slightly
different generation scheme of collection subclasses in JVM IR, and are
harmless.

(Previous attempt was at 15e978dbd311c2ba78ec32b394c21acde9811ccb.)
2021-08-05 12:36:35 +02:00

155 lines
3.9 KiB
Groovy

description = 'Kotlin Standard Library for JVM'
apply plugin: 'kotlin-platform-jvm'
archivesBaseName = 'kotlin-stdlib'
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_6)
configurePublishing(project)
configureJavadocJar()
configureSourcesJar()
configurations {
distSources
}
sourceSets {
main {
java {
srcDir "${rootDir}/core/builtins/src"
srcDir 'runtime'
srcDir 'src'
}
}
test {
kotlin {
srcDir 'test'
}
}
longRunningTest {
kotlin {
srcDir 'testLongRunning'
}
}
java9 {
java {
srcDir 'java9'
}
}
}
LibrariesCommon.configureJava9Compilation(project, 'kotlin.stdlib', [sourceSets.main.output])
configurations {
commonSources
longRunningTestCompile.extendsFrom(testCompile)
builtins {
attributes {
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements, LibraryElements.JAR))
}
}
compileOnly.extendsFrom(builtins)
}
dependencies {
expectedBy project(":kotlin-stdlib-common")
commonSources project(path: ":kotlin-stdlib-common", configuration: "sources")
compile group: 'org.jetbrains', name: 'annotations', version:'13.0'
testCompile project(':kotlin-test:kotlin-test-junit')
builtins project(':core:builtins')
}
jar {
dependsOn(configurations.builtins)
manifestAttributes(manifest, project, 'Main', true)
from {
zipTree(configurations.builtins.singleFile)
}
from sourceSets.java9.output
}
sourcesJar {
from "${rootDir}/core/builtins/native"
}
task distSourcesJar(type: Jar) {
dependsOn(sourcesJar, configurations.commonSources)
destinationDirectory = file("$buildDir/lib/dist")
classifier = 'sources'
duplicatesStrategy = DuplicatesStrategy.FAIL
from zipTree(sourcesJar.outputs.files.singleFile)
from(zipTree(configurations.commonSources.singleFile)) {
it.includeEmptyDirs = false
exclude 'META-INF/*'
into 'common'
}
}
configureModularJar {
dependsOn(jar)
manifestAttributes(manifest, project, 'Main', true)
from zipTree(jar.outputs.files.singleFile)
}
artifacts {
archives sourcesJar
sources sourcesJar
distSources distSourcesJar
archives modularJar
}
DexMethodCountKt.dexMethodCount(project) { task ->
task.from(jar)
task.ownPackages = ['kotlin']
}
compileKotlin {
kotlinOptions {
freeCompilerArgs = [
"-Xallow-kotlin-package",
"-Xmultifile-parts-inherit",
"-Xopt-in=kotlin.RequiresOptIn",
"-Xopt-in=kotlin.ExperimentalMultiplatform",
"-Xopt-in=kotlin.contracts.ExperimentalContracts",
"-Xuse-14-inline-classes-mangling-scheme",
"-Xsuppress-deprecated-jvm-target-warning",
]
moduleName = "kotlin-stdlib"
}
}
compileTestKotlin {
kotlinOptions {
freeCompilerArgs += [
"-Xopt-in=kotlin.RequiresOptIn",
"-Xopt-in=kotlin.ExperimentalUnsignedTypes",
"-Xopt-in=kotlin.ExperimentalStdlibApi",
"-Xsuppress-deprecated-jvm-target-warning",
]
// This is needed for JavaTypeTest; typeOf for non-reified type parameters doesn't work otherwise, for implementation reasons.
freeCompilerArgs.remove("-Xno-optimized-callable-references")
}
}
compileLongRunningTestKotlin {
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.ExperimentalStdlibApi"
}
task longRunningTest(type: Test, dependsOn: longRunningTestClasses) {
group = "verification"
testClassesDirs = sourceSets.longRunningTest.output.classesDirs
classpath = sourceSets.longRunningTest.runtimeClasspath
}
if (project.hasProperty("kotlin.stdlib.test.long.running")) {
check.dependsOn(longRunningTest)
}