Files
kotlin/libraries/stdlib/jvm/build.gradle
Alexander Udalov 0a9498f7e2 Build: suppress deprecated JVM target warning globally
There seems to be no point in configuring the compiler argument per
project. This argument will be deleted soon anyway, when we remove
support for JDK 1.6 & 1.7.

Also remove `disableDeprecatedJvmTargetWarning`. It didn't have any
effect in all modules where it was applied because these modules
reassign `freeCompilerArgs` anyway, with
`-Xsuppress-deprecated-jvm-target-warning` in it.
2021-07-27 13:35:39 +02:00

157 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"
}
configureJvmIrBackend(project)
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)
}